check-node-version
Advanced tools
Comparing version 1.0.1 to 1.1.0
20
bin.js
@@ -61,2 +61,22 @@ #!/usr/bin/env node | ||
}; | ||
if (argv.package) { | ||
try { | ||
var packageJson = require(path.join(process.cwd(), 'package.json')); | ||
} catch (e) { | ||
console.log('Error: When running with --package, a package.json file is expected in the current working directory'); | ||
console.log('Current working directory is: ' + process.cwd()); | ||
process.exit(1); | ||
} | ||
if (!packageJson.engines) { | ||
console.log('Error: When running with --package, your package.json is expected to contain the "engines" key'); | ||
console.log('See https://docs.npmjs.com/files/package.json#engines for the supported syntax'); | ||
process.exit(1); | ||
} | ||
options = { | ||
node: packageJson.engines.node, | ||
npm: packageJson.engines.npm, | ||
}; | ||
} | ||
check(options, function(err, result) { | ||
@@ -63,0 +83,0 @@ if (err) { |
{ | ||
"name": "check-node-version", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "Check installed versions of node and npm", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -13,2 +13,6 @@ Usage: check-node-version [OPTIONS] | ||
--package | ||
Use the "engines" key in the current package.json for the | ||
semver version ranges. | ||
-q, --quiet | ||
@@ -15,0 +19,0 @@ Don't output anything. Exit with an error code if the node |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
7243
151
2