Skip to content

Commit

Permalink
fix: pass through execArgs from config (#1142)
Browse files Browse the repository at this point in the history
* fix: pass through execArgs from config

Also updating some deps and linting tweaks

* chore: add message on postinstall

Lost funds from gratipay and codesponsor 😢
  • Loading branch information
remy authored Dec 5, 2017
1 parent 18c03f9 commit 6a4fb22
Show file tree
Hide file tree
Showing 8 changed files with 173 additions and 111 deletions.
8 changes: 5 additions & 3 deletions lib/config/exec.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ function execFromPackage() {
if (pkg.main !== undefined) {
// no app found to run - so give them a tip and get the feck out
return { exec: null, script: pkg.main };
} else if (pkg.scripts && pkg.scripts.start) {
}

if (pkg.scripts && pkg.scripts.start) {
return { exec: pkg.scripts.start };
}
} catch (e) {}
} catch (e) { }

return null;
}
Expand Down Expand Up @@ -84,7 +86,7 @@ function exec(nodemonOptions, execMap) {
execDefined = true;
}

options.execArgs = [];
options.execArgs = nodemonOptions.execArgs || [];

if (Array.isArray(options.exec)) {
options.execArgs = options.exec;
Expand Down
5 changes: 3 additions & 2 deletions lib/config/load.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ function load(settings, options, config, callback) {
args: options.args,
scriptPosition: options.scriptPosition,
nodeArgs: options.nodeArgs,
execArgs: options.execArgs,
ext: options.ext,
env: options.env,
}, options.execMap);
Expand Down Expand Up @@ -172,7 +173,7 @@ function normaliseRules(options, ready) {
*/
function loadFile(options, config, dir, ready) {
if (!ready) {
ready = function () {};
ready = function () { };
}

var callback = function (settings) {
Expand Down Expand Up @@ -216,7 +217,7 @@ function loadFile(options, config, dir, ready) {

function loadPackageJSON(config, ready) {
if (!ready) {
ready = function () {};
ready = function () { };
}

utils.log.detail('Looking in package.json for nodemonConfig');
Expand Down
8 changes: 5 additions & 3 deletions lib/monitor/match.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ function match(files, monitor, ext) {
if (aIsIgnore || bIsIgnore) {
if (aIsIgnore) {
return -1;
} else {
return 1;
}

return 1;
}

if (r === 0) {
Expand All @@ -151,7 +151,9 @@ function match(files, monitor, ext) {

if (prefix === '!') {
return '!**' + (prefix !== path.sep ? path.sep : '') + s.slice(1);
} else if (s.slice(0, 2) === '..') {
}

if (s.slice(0, 2) === '..') {
return path.resolve(process.cwd(), s);
}
return '**' + (prefix !== path.sep ? path.sep : '') + s;
Expand Down
18 changes: 10 additions & 8 deletions lib/monitor/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var watch = require('./watch').watch;
var config = require('../config');
var child = null; // the actual child process we spawn
var killedAfterChange = false;
var noop = function () {};
var noop = function () { };
var restart = null;
var psTree = require('ps-tree');
var hasPS = true;
Expand Down Expand Up @@ -39,8 +39,8 @@ function run(options) {

if (config.options.stdout) {
stdio = ['pipe',
process.stdout,
process.stderr,];
process.stdout,
process.stderr,];
}

var sh = 'sh';
Expand All @@ -63,9 +63,9 @@ function run(options) {
// if the executable path contains a space the whole string must be quoted
// to get windows treat it as 1 argument for cmd.exe
if (executable.indexOf(' ') !== -1 && executable[0] !== '\"'
&& executable[executable.length - 1] !== '\"') {
&& executable[executable.length - 1] !== '\"') {
// remove all quotes from executable (possible backward compat hacks)
executable = executable.replace (/\"/g, '');
executable = executable.replace(/\"/g, '');
}
}

Expand Down Expand Up @@ -155,7 +155,9 @@ function run(options) {
// exit the monitor, but do it gracefully
if (signal === config.signal) {
return restart();
} else if (code === 0) { // clean exit - wait until file change to restart
}

if (code === 0) { // clean exit - wait until file change to restart
if (runCmd) {
utils.log.status('clean exit - waiting for changes before restart');
}
Expand All @@ -170,7 +172,7 @@ function run(options) {
}
} else {
utils.log.fail('app crashed - waiting for file changes before' +
' starting...');
' starting...');
child = null;
}
}
Expand Down Expand Up @@ -258,7 +260,7 @@ function run(options) {

function kill(child, signal, callback) {
if (!callback) {
callback = function () {};
callback = function () { };
}

if (utils.isWindows) {
Expand Down
5 changes: 2 additions & 3 deletions lib/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,9 @@ var utils = (module.exports = {
// around it to indicate that it is a single argument
if (arg.indexOf(' ') === -1) {
return arg;
} else {
// this should correctly escape nested quotes
return JSON.stringify(arg);
}
// this should correctly escape nested quotes
return JSON.stringify(arg);
})
)
.join(' ')
Expand Down
161 changes: 103 additions & 58 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 6a4fb22

Please sign in to comment.