chokidar-cli
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -36,3 +36,3 @@ #!/usr/bin/env node | ||
.usage( | ||
'Usage: $0 <pattern> [<pattern>...] [options]\n\n' + | ||
'Usage: chokidar <pattern> [<pattern>...] [options]\n\n' + | ||
'<pattern>:\n' + | ||
@@ -44,4 +44,4 @@ 'Glob pattern to specify files to be watched.\n' + | ||
) | ||
.example('$0 "**/*.js" -c "npm run build-js"', 'build when any .js file changes') | ||
.example('$0 "**/*.js" "**/*.less"', 'output changes of .js and .less files') | ||
.example('chokidar "**/*.js" -c "npm run build-js"', 'build when any .js file changes') | ||
.example('chokidar "**/*.js" "**/*.less"', 'output changes of .js and .less files') | ||
.demand(1) | ||
@@ -48,0 +48,0 @@ .option('c', { |
{ | ||
"name": "chokidar-cli", | ||
"description": "Ultra-fast cross-platform command line utility to watch file system changes.", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"keywords": [ | ||
@@ -6,0 +6,0 @@ "fs", |
17
utils.js
@@ -6,3 +6,16 @@ var childProcess = require('child_process'); | ||
// Try to resolve path to shell. | ||
// We assume that Windows provides COMSPEC env variable | ||
// and other platforms provide SHELL env variable | ||
var SHELL_PATH = process.env.SHELL || process.env.COMSPEC; | ||
var EXECUTE_OPTION = process.env.COMSPEC !== undefined ? '/c' : '-c'; | ||
// XXX: Wrapping tos to a promise is a bit wrong abstraction. Maybe RX suits | ||
// better? | ||
function run(cmd, opts) { | ||
if (!SHELL_PATH) { | ||
// If we cannot resolve shell, better to just crash | ||
throw new Error('$SHELL environment variable is not set.'); | ||
} | ||
opts = _.merge({ | ||
@@ -22,5 +35,5 @@ pipe: true, | ||
var child; | ||
var parts = shellQuote.parse(cmd); | ||
try { | ||
child = childProcess.spawn(_.head(parts), _.tail(parts), { | ||
child = childProcess.spawn(SHELL_PATH, [EXECUTE_OPTION, cmd], { | ||
cwd: opts.cwd, | ||
@@ -27,0 +40,0 @@ stdio: opts.pipe ? 'inherit' : null |
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances 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
25469
515
5