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

better-npm-run

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

better-npm-run - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

.env

0

index.js

@@ -0,0 +0,0 @@ #!/usr/bin/env node

42

lib/exec.js

@@ -1,34 +0,36 @@

var child_exec = require('child_process').exec;
var spawn = require('child_process').spawn;
var dotenv = require('./dot-env');
var objectAssign = require('object-assign');
module.exports = function exec(script) {
var command_line = script.command;
// Grab the command section of the entered command
var command = script.command.split(' ')[0];
// Anything else is options
var options = script.command.split(' ').slice(1);
Object.keys(script.env).forEach(function (key) {
var value = script.env[key];
var argv = process.argv.splice(3);
if(process.platform === 'win32') {
command_line = 'set ' + key + '=' + script.env[key] + '&& ' + command_line;
} else {
command_line = key + '=' + script.env[key] + ' ' + command_line;
}
});
options = options.concat(argv);
console.log('to be executed:' + command_line);
var command = child_exec(command_line, function (error, stdout, stderr) {
if (error) {
process.exit(error.code || 1);
}
});
script.env = script.env || {};
var env = objectAssign(process.env, script.env, dotenv);
console.log('to be executed:', command, options.join(' '));
var command = spawn(command, options, {env: env});
command.stdout.on('data', function(data) {
process.stdout.write(data);
process.stdout.write(data);
});
command.stderr.on('data', function(data) {
process.stderr.write(data);
process.stderr.write(data);
});
command.on('error', function(err) {
process.stderr.write(err);
process.exit(err.code || 1);
process.stderr.write(err);
process.exit(err.code || 1);
});
}
{
"name": "better-npm-run",
"description": "Better NPM scripts runner",
"version": "0.0.3",
"version": "0.0.4",
"license": "MIT",

@@ -20,4 +20,16 @@ "author": "Benjamin Orozco <benoror@gmail.com>",

"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "node index.js test --test"
},
"dependencies": {
"endofline": "0.0.3",
"object-assign": "^4.0.1"
},
"betterScripts": {
"test": {
"command": "node test.js",
"env": {
"FOO": "bar"
}
}
}
}

@@ -73,1 +73,8 @@ [![NPM](https://nodei.co/npm/better-npm-run.png)](https://npmjs.org/package/better-npm-run)

```
Also if you have .env file in your project root it will be loaded on every command
```
NODE_PATH=./:./lib
PORT=5000
```

Sorry, the diff of this file is not supported yet

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