Comparing version 1.0.0-beta.10 to 1.0.0-beta.11
@@ -100,3 +100,3 @@ /** | ||
var commandNode = cmd.getCommand( args ); | ||
var commandModule = commandNode.module; | ||
var commandModule = commandNode ? commandNode.module : null; | ||
@@ -108,3 +108,3 @@ if ( !commandModule || !commandModule.cli ) { | ||
edp.log.error( 'DEBUG INFO: → %s', | ||
require.resolve( providerPackage ) ); | ||
util.resolve( providerPackage ) ); | ||
@@ -145,4 +145,4 @@ return; | ||
var dir = path.join( __dirname, '..', 'node_modules', providerPackage ); | ||
if ( !fs.existsSync( dir ) ) { | ||
var util = require( './util' ); | ||
if ( !util.isInstalled( providerPackage ) ) { | ||
// 不存在,直接安装 | ||
@@ -156,3 +156,3 @@ edp.log.info( 'Install %s automatically', providerPackage ); | ||
try { | ||
require( providerPackage ); | ||
util.require( providerPackage ); | ||
} | ||
@@ -159,0 +159,0 @@ catch( ex ) { |
@@ -19,6 +19,11 @@ /** | ||
exports.getPackageCommands = function( pkg ) { | ||
var dir = path.resolve( __dirname, '../node_modules', pkg ); | ||
var tempNode = new CommandNode( {}, pkg ); | ||
scanDir( path.join( dir, 'cli' ), tempNode ); | ||
return tempNode.children; | ||
try { | ||
var dir = require( './util' ).resolve( pkg ); | ||
var tempNode = new CommandNode( {}, pkg ); | ||
scanDir( path.join( dir, 'cli' ), tempNode ); | ||
return tempNode.children; | ||
} | ||
catch( ex ) { | ||
return null; | ||
} | ||
}; | ||
@@ -77,2 +82,6 @@ | ||
if ( !pkgCommands ) { | ||
return null; | ||
} | ||
var command = pkgCommands[ commandName ]; | ||
@@ -79,0 +88,0 @@ if ( !command ) { |
@@ -13,10 +13,31 @@ /** | ||
function getPackages( pattern, dir ) { | ||
dir = dir || path.join( __dirname, '..', 'node_modules' ); | ||
function filter( item ) { | ||
if ( item === 'edp-dev' || item === 'edp' ) { | ||
return false; | ||
} | ||
var pkgs = fs.readdirSync( dir ) | ||
.filter( function( item ){ | ||
return pattern.test( item ); | ||
}); | ||
return pattern.test( item ); | ||
} | ||
return pkgs; | ||
var pkgs = []; | ||
if ( dir ) { | ||
pkgs = fs.readdirSync( dir ); | ||
} | ||
else { | ||
// /foo/bar/edp | ||
// /foo/bar/edp/node_modules/edp-build | ||
// /foo/bar/edp/node_modules/edp-webserver | ||
// ... | ||
dir = path.join( __dirname, '..', 'node_modules' ); | ||
pkgs = pkgs.concat( fs.readdirSync( dir ) ); | ||
// /foo/bar/edp | ||
// /foo/bar/edp-build | ||
// /foo/bar/edp-webserver | ||
// ... | ||
dir = path.join( __dirname, '..', '..' ); | ||
pkgs = pkgs.concat( fs.readdirSync( dir ) ); | ||
} | ||
return pkgs.filter( filter ); | ||
} | ||
@@ -23,0 +44,0 @@ |
{ | ||
"name": "edp", | ||
"description": "Enterprise Develop Platform", | ||
"version": "1.0.0-beta.10", | ||
"version": "1.0.0-beta.11", | ||
"contributors": [ | ||
@@ -6,0 +6,0 @@ { "name": "errorrik", "email": "errorrik@gmail.com" }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
74076
54
1054
20