better-npm-run
Advanced tools
Comparing version 0.0.13 to 0.0.14
19
index.js
#!/usr/bin/env node | ||
console.log('running better-npm-run in', process.cwd()); | ||
var scriptName = process.argv[2]; | ||
var isSilent = process.argv.indexOf('-s') > -1 || process.argv.indexOf('--silent') > -1; | ||
isSilent || console.log('running better-npm-run in', process.cwd()); | ||
var join = require('path').join; | ||
@@ -17,14 +21,16 @@ var fullPackagePath = join(process.cwd(), 'package.json'); | ||
} | ||
if (!process.argv[2]) { | ||
if (!scriptName) { | ||
process.stderr.write('ERROR: No script name provided!'); | ||
process.exit(1); | ||
} | ||
if (!pkg.betterScripts[process.argv[2]]) { | ||
process.stderr.write('ERROR: No betterScript with name "'+process.argv[2]+'" was found!'); | ||
if (!pkg.betterScripts[scriptName]) { | ||
process.stderr.write('ERROR: No betterScript with name "'+scriptName+'" was found!'); | ||
process.exit(1); | ||
} | ||
console.log('Executing script: ' + process.argv[2] + '\n'); | ||
exec(pkg.betterScripts[process.argv[2]], function (error, stdout, stderr) { | ||
isSilent || console.log('Executing script: ' + scriptName + '\n'); | ||
exec(pkg.betterScripts[scriptName], isSilent, function (error, stdout, stderr) { | ||
process.stderr.write(stderr); | ||
@@ -36,1 +42,2 @@ process.stdout.write(stdout); | ||
}); | ||
@@ -6,3 +6,3 @@ require('dotenv').config({silent: true}); | ||
module.exports = function exec(script) { | ||
module.exports = function exec(script, isSilent) { | ||
@@ -23,3 +23,3 @@ var argv = process.argv.splice(3); | ||
console.log('to be executed:', command); | ||
isSilent || console.log('to be executed:', command); | ||
spawn(sh, [shFlag, command], { | ||
@@ -33,2 +33,2 @@ env: env, | ||
} | ||
}; |
{ | ||
"name": "better-npm-run", | ||
"description": "Better NPM scripts runner", | ||
"version": "0.0.13", | ||
"version": "0.0.14", | ||
"license": "MIT", | ||
@@ -26,3 +26,4 @@ "author": "Benjamin Orozco <benoror@gmail.com>", | ||
"test:command:string": "node index.js test:command:string", | ||
"test": "npm run test:env && npm run test:env-extend && npm run test:params && npm run test:command:object && npm run test:command:string" | ||
"test:silent": "node index.js test:command:object -s && node index.js test:command:object --silent", | ||
"test": "npm run test:env && npm run test:env-extend && npm run test:params && npm run test:command:object && npm run test:command:string && npm run test:silent" | ||
}, | ||
@@ -29,0 +30,0 @@ "dependencies": { |
@@ -125,1 +125,7 @@ [![NPM](https://nodei.co/npm/better-npm-run.png)](https://npmjs.org/package/better-npm-run) | ||
``` | ||
Also for silence output, you can use `-s` or verbose `--silence` flags | ||
``` | ||
bnr watch-client -s | ||
``` |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
9189
72
131
1