Socket
Socket
Sign inDemoInstall

nodemon

Package Overview
Dependencies
Maintainers
1
Versions
256
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nodemon - npm Package Compare versions

Comparing version 2.0.4 to 2.0.5

2

bin/postinstall.js
#!/usr/bin/env node
function main() {
if (process.env.SUPPRESS_SUPPORT) {
if (process.env.SUPPRESS_SUPPORT || process.env.OPENCOLLECTIVE_HIDE) {
return;

@@ -6,0 +6,0 @@ }

@@ -77,3 +77,5 @@ var debug = require('debug')('nodemon');

// line, then we move any of the pre double-dash args in execArgs
const n = options.scriptPosition || options.args.length;
const n = options.scriptPosition === null ?
options.args.length : options.scriptPosition;
options.execArgs = (options.execArgs || [])

@@ -80,0 +82,0 @@ .concat(options.args.splice(0, n));

@@ -21,12 +21,27 @@ var debug = require('debug')('nodemon:run');

var cmd = config.command.raw;
// moved up
// we need restart function below in the global scope for run.kill
/*jshint validthis:true*/
restart = run.bind(this, options);
run.restart = restart;
// binding options with instance of run
// so that we can use it in run.kill
run.options = options;
var runCmd = !options.runOnChangeOnly || config.lastStarted !== 0;
if (runCmd) {
utils.log.status('starting `' + config.command.string + '`');
} else {
// should just watch file if command is not to be run
// had another alternate approach
// to stop process being forked/spawned in the below code
// but this approach does early exit and makes code cleaner
debug('start watch on: %s', config.options.watch);
if (config.options.watch !== false) {
watch();
return;
}
}
/*jshint validthis:true*/
restart = run.bind(this, options);
run.restart = restart;
config.lastStarted = Date.now();

@@ -101,2 +116,4 @@

if (shouldFork) {
// this assumes the first argument is the script and slices it out, since
// we're forking
var forkArgs = cmd.args.slice(1);

@@ -240,50 +257,6 @@ var env = utils.merge(options.execOptions.env, process.env);

run.kill = function (noRestart, callback) {
// I hate code like this :( - Remy (author of said code)
if (typeof noRestart === 'function') {
callback = noRestart;
noRestart = false;
}
// moved the run.kill outside to handle both the cases
// intial start
// no start
if (!callback) {
callback = noop;
}
if (child !== null) {
// if the stdin piping is on, we need to unpipe, but also close stdin on
// the child, otherwise linux can throw EPIPE or ECONNRESET errors.
if (options.stdin) {
process.stdin.unpipe(child.stdin);
}
// For the on('exit', ...) handler above the following looks like a
// crash, so we set the killedAfterChange flag if a restart is planned
if (!noRestart) {
killedAfterChange = true;
}
/* Now kill the entire subtree of processes belonging to nodemon */
var oldPid = child.pid;
if (child) {
kill(child, config.signal, function () {
// this seems to fix the 0.11.x issue with the "rs" restart command,
// though I'm unsure why. it seems like more data is streamed in to
// stdin after we close.
if (child && options.stdin && child.stdin && oldPid === child.pid) {
child.stdin.end();
}
callback();
});
}
} else if (!noRestart) {
// if there's no child, then we need to manually start the process
// this is because as there was no child, the child.on('exit') event
// handler doesn't exist which would normally trigger the restart.
bus.once('start', callback);
restart();
} else {
callback();
}
};
// connect stdin to the child process (options.stdin is on by default)

@@ -385,8 +358,50 @@ if (options.stdin) {

// stubbed out for now, filled in during run
run.kill = function (flag, callback) {
if (callback) {
run.kill = function (noRestart, callback) {
// I hate code like this :( - Remy (author of said code)
if (typeof noRestart === 'function') {
callback = noRestart;
noRestart = false;
}
if (!callback) {
callback = noop;
}
if (child !== null) {
// if the stdin piping is on, we need to unpipe, but also close stdin on
// the child, otherwise linux can throw EPIPE or ECONNRESET errors.
if (run.options.stdin) {
process.stdin.unpipe(child.stdin);
}
// For the on('exit', ...) handler above the following looks like a
// crash, so we set the killedAfterChange flag if a restart is planned
if (!noRestart) {
killedAfterChange = true;
}
/* Now kill the entire subtree of processes belonging to nodemon */
var oldPid = child.pid;
if (child) {
kill(child, config.signal, function () {
// this seems to fix the 0.11.x issue with the "rs" restart command,
// though I'm unsure why. it seems like more data is streamed in to
// stdin after we close.
if (child && run.options.stdin && child.stdin && oldPid === child.pid) {
child.stdin.end();
}
callback();
});
}
} else if (!noRestart) {
// if there's no child, then we need to manually start the process
// this is because as there was no child, the child.on('exit') event
// handler doesn't exist which would normally trigger the restart.
bus.once('start', callback);
run.restart();
} else {
callback();
}
};
run.restart = noop;

@@ -393,0 +408,0 @@

@@ -180,3 +180,3 @@ module.exports.watch = watch;

// running script, if so, let's allow a restart
if (config.options.execOptions.script) {
if (config.options.execOptions && config.options.execOptions.script) {
const script = path.resolve(config.options.execOptions.script);

@@ -183,0 +183,0 @@ if (matched.result.length === 0 && script) {

@@ -1,1 +0,1 @@

{"name":"nodemon","homepage":"http://nodemon.io","author":{"name":"Remy Sharp","url":"http://github.com/remy"},"bin":{"nodemon":"./bin/nodemon.js"},"engines":{"node":">=8.10.0"},"repository":{"type":"git","url":"https://github.com/remy/nodemon.git"},"description":"Simple monitor script for use during development of a node.js app.","keywords":["monitor","development","restart","autoload","reload","terminal"],"license":"MIT","main":"./lib/nodemon","scripts":{"commitmsg":"commitlint -e","coverage":"istanbul cover _mocha -- --timeout 30000 --ui bdd --reporter list test/**/*.test.js","lint":"jscs lib/**/*.js -v",":spec":"node_modules/.bin/mocha --timeout 30000 --ui bdd test/**/*.test.js","test":"npm run lint && npm run spec","spec":"for FILE in test/**/*.test.js; do echo $FILE; TEST=1 mocha --exit --timeout 30000 $FILE; if [ $? -ne 0 ]; then exit 1; fi; sleep 1; done","postspec":"npm run clean","clean":"rm -rf test/fixtures/test*.js test/fixtures/test*.md","web":"node web","semantic-release":"semantic-release pre && npm publish && semantic-release post","prepush":"npm run lint","killall":"ps auxww | grep node | grep -v grep | awk '{ print $2 }' | xargs kill -9","postinstall":"node bin/postinstall || exit 0"},"devDependencies":{"@commitlint/cli":"^3.1.3","@commitlint/config-angular":"^3.1.1","async":"1.4.2","coffee-script":"~1.7.1","husky":"^0.14.3","istanbul":"^0.4.5","jscs":"^3.0.7","mocha":"^2.5.3","proxyquire":"^1.8.0","semantic-release":"^8.2.3","should":"~4.0.0"},"dependencies":{"chokidar":"^3.2.2","debug":"^3.2.6","ignore-by-default":"^1.0.1","minimatch":"^3.0.4","pstree.remy":"^1.1.7","semver":"^5.7.1","supports-color":"^5.5.0","touch":"^3.1.0","undefsafe":"^2.0.2","update-notifier":"^4.0.0"},"version":"2.0.4","funding":{"type":"opencollective","url":"https://opencollective.com/nodemon"}}
{"name":"nodemon","homepage":"http://nodemon.io","author":{"name":"Remy Sharp","url":"http://github.com/remy"},"bin":{"nodemon":"./bin/nodemon.js"},"engines":{"node":">=8.10.0"},"repository":{"type":"git","url":"https://github.com/remy/nodemon.git"},"description":"Simple monitor script for use during development of a node.js app.","keywords":["monitor","development","restart","autoload","reload","terminal"],"license":"MIT","main":"./lib/nodemon","scripts":{"commitmsg":"commitlint -e","coverage":"istanbul cover _mocha -- --timeout 30000 --ui bdd --reporter list test/**/*.test.js","lint":"jscs lib/**/*.js -v",":spec":"node_modules/.bin/mocha --timeout 30000 --ui bdd test/**/*.test.js","test":"npm run lint && npm run spec","spec":"for FILE in test/**/*.test.js; do echo $FILE; TEST=1 mocha --exit --timeout 30000 $FILE; if [ $? -ne 0 ]; then exit 1; fi; sleep 1; done","postspec":"npm run clean","clean":"rm -rf test/fixtures/test*.js test/fixtures/test*.md","web":"node web","semantic-release":"semantic-release pre && npm publish && semantic-release post","prepush":"npm run lint","killall":"ps auxww | grep node | grep -v grep | awk '{ print $2 }' | xargs kill -9","postinstall":"node bin/postinstall || exit 0"},"devDependencies":{"@commitlint/cli":"^3.1.3","@commitlint/config-angular":"^3.1.1","async":"1.4.2","coffee-script":"~1.7.1","husky":"^0.14.3","istanbul":"^0.4.5","jscs":"^3.0.7","mocha":"^2.5.3","proxyquire":"^1.8.0","semantic-release":"^8.2.3","should":"~4.0.0"},"dependencies":{"chokidar":"^3.2.2","debug":"^3.2.6","ignore-by-default":"^1.0.1","minimatch":"^3.0.4","pstree.remy":"^1.1.7","semver":"^5.7.1","supports-color":"^5.5.0","touch":"^3.1.0","undefsafe":"^2.0.3","update-notifier":"^4.1.0"},"version":"2.0.5","funding":{"type":"opencollective","url":"https://opencollective.com/nodemon"}}
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