Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hadron-package-manager

Package Overview
Dependencies
Maintainers
20
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hadron-package-manager - npm Package Compare versions

Comparing version 0.2.0 to 1.0.0

49

lib/package-manager.js

@@ -6,3 +6,2 @@ 'use strict';

const path = require('path');
const os = require('os');
const debug = require('debug')('hadron-package-manager:package-manager');

@@ -13,12 +12,2 @@ const Package = require('./package');

/**
* The name of the directory to hold public packages.
*/
const CPM_PATH_NAME = '.cpm';
/**
* The fully qualified name to the cpm packages.
*/
const CPM_PACKAGES_PATH = path.join(os.homedir(), CPM_PATH_NAME);
/**
* Manages packages in the application.

@@ -33,6 +22,7 @@ */

*/
constructor(packagesPath) {
this.packagePaths = [ packagesPath, CPM_PACKAGES_PATH ];
constructor(packagesPath, baseDir, externalPackages) {
this.packagesPath = packagesPath;
this.baseDir = baseDir;
this.externalPackages = externalPackages;
this.expectedPackageCount = 0;
this.directoriesScannedCount = 0;
this.packages = [];

@@ -75,20 +65,2 @@ }

/**
* Increment the number of directories scanned for packages.
*/
_incrementDirectoriesScannedCount() {
this.directoriesScannedCount += 1;
}
/**
* Increments the expected package count by the value, usually
* the number of files in the currently scanned directory.
*
* @param {Integer} value - The number to increment by.
*/
_incrementExpectedPackageCount(value) {
this._incrementDirectoriesScannedCount();
this.expectedPackageCount += value;
}
/**
* Checks if the reading of packages is complete.

@@ -99,4 +71,3 @@ *

_isReadingComplete() {
return (this.expectedPackageCount === this.packages.length) &&
(this.directoriesScannedCount === this.packagePaths.length);
return this.expectedPackageCount === this.packages.length;
}

@@ -112,4 +83,5 @@

if (this.packages.length === 0) {
_.each(this.packagePaths, (packagesPath) => {
this._scanPackagePaths(packagesPath);
this._scanPackagePaths(this.packagesPath);
_.each(this.externalPackages, (externalPackage) => {
this._scanPackagePath(this.baseDir, externalPackage);
});

@@ -143,3 +115,3 @@ }

_resetExpectedPackageCount() {
this.expectedPackages = 0;
this.expectedPackageCount = 0;
}

@@ -157,2 +129,3 @@

var packagePath = path.join(packagesPath, file);
this.expectedPackageCount += 1;
fs.stat(packagePath, (error, f) => {

@@ -178,6 +151,4 @@ if (error) {

if (error) {
this._incrementDirectoriesScannedCount();
Action.packageScanFailed(error);
} else {
this._incrementExpectedPackageCount(files.length);
_.each(files, (file) => {

@@ -184,0 +155,0 @@ this._scanPackagePath(packagesPath, file);

@@ -7,3 +7,3 @@ {

"homepage": "https://github.com/mongodb-js/hadron-package-manager",
"version": "0.2.0",
"version": "1.0.0",
"repository": {

@@ -34,9 +34,9 @@ "type": "git",

"eslint-config-mongodb-js": "^2.2.0",
"mocha": "^2.3.4",
"mocha": "^3.1.2",
"mongodb-js-fmt": "^0.0.3",
"mongodb-js-precommit": "^0.2.9",
"pre-commit": "^1.1.2",
"react": "^0.14.8",
"react": "^15.3.2",
"sinon": "^1.17.6"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc