Skip to content

Commit 6a4fb22

Browse files
authoredDec 5, 2017
fix: pass through execArgs from config (#1142)
* fix: pass through execArgs from config Also updating some deps and linting tweaks * chore: add message on postinstall Lost funds from gratipay and codesponsor 😢
1 parent 18c03f9 commit 6a4fb22

File tree

8 files changed

+173
-111
lines changed

8 files changed

+173
-111
lines changed
 

‎lib/config/exec.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@ function execFromPackage() {
1919
if (pkg.main !== undefined) {
2020
// no app found to run - so give them a tip and get the feck out
2121
return { exec: null, script: pkg.main };
22-
} else if (pkg.scripts && pkg.scripts.start) {
22+
}
23+
24+
if (pkg.scripts && pkg.scripts.start) {
2325
return { exec: pkg.scripts.start };
2426
}
25-
} catch (e) {}
27+
} catch (e) { }
2628

2729
return null;
2830
}
@@ -84,7 +86,7 @@ function exec(nodemonOptions, execMap) {
8486
execDefined = true;
8587
}
8688

87-
options.execArgs = [];
89+
options.execArgs = nodemonOptions.execArgs || [];
8890

8991
if (Array.isArray(options.exec)) {
9092
options.execArgs = options.exec;

‎lib/config/load.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ function load(settings, options, config, callback) {
7979
args: options.args,
8080
scriptPosition: options.scriptPosition,
8181
nodeArgs: options.nodeArgs,
82+
execArgs: options.execArgs,
8283
ext: options.ext,
8384
env: options.env,
8485
}, options.execMap);
@@ -172,7 +173,7 @@ function normaliseRules(options, ready) {
172173
*/
173174
function loadFile(options, config, dir, ready) {
174175
if (!ready) {
175-
ready = function () {};
176+
ready = function () { };
176177
}
177178

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

217218
function loadPackageJSON(config, ready) {
218219
if (!ready) {
219-
ready = function () {};
220+
ready = function () { };
220221
}
221222

222223
utils.log.detail('Looking in package.json for nodemonConfig');

‎lib/monitor/match.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,9 @@ function match(files, monitor, ext) {
137137
if (aIsIgnore || bIsIgnore) {
138138
if (aIsIgnore) {
139139
return -1;
140-
} else {
141-
return 1;
142140
}
141+
142+
return 1;
143143
}
144144

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

152152
if (prefix === '!') {
153153
return '!**' + (prefix !== path.sep ? path.sep : '') + s.slice(1);
154-
} else if (s.slice(0, 2) === '..') {
154+
}
155+
156+
if (s.slice(0, 2) === '..') {
155157
return path.resolve(process.cwd(), s);
156158
}
157159
return '**' + (prefix !== path.sep ? path.sep : '') + s;

‎lib/monitor/run.js

+10-8
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ var watch = require('./watch').watch;
88
var config = require('../config');
99
var child = null; // the actual child process we spawn
1010
var killedAfterChange = false;
11-
var noop = function () {};
11+
var noop = function () { };
1212
var restart = null;
1313
var psTree = require('ps-tree');
1414
var hasPS = true;
@@ -39,8 +39,8 @@ function run(options) {
3939

4040
if (config.options.stdout) {
4141
stdio = ['pipe',
42-
process.stdout,
43-
process.stderr,];
42+
process.stdout,
43+
process.stderr,];
4444
}
4545

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

@@ -155,7 +155,9 @@ function run(options) {
155155
// exit the monitor, but do it gracefully
156156
if (signal === config.signal) {
157157
return restart();
158-
} else if (code === 0) { // clean exit - wait until file change to restart
158+
}
159+
160+
if (code === 0) { // clean exit - wait until file change to restart
159161
if (runCmd) {
160162
utils.log.status('clean exit - waiting for changes before restart');
161163
}
@@ -170,7 +172,7 @@ function run(options) {
170172
}
171173
} else {
172174
utils.log.fail('app crashed - waiting for file changes before' +
173-
' starting...');
175+
' starting...');
174176
child = null;
175177
}
176178
}
@@ -258,7 +260,7 @@ function run(options) {
258260

259261
function kill(child, signal, callback) {
260262
if (!callback) {
261-
callback = function () {};
263+
callback = function () { };
262264
}
263265

264266
if (utils.isWindows) {

‎lib/utils/index.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,9 @@ var utils = (module.exports = {
6868
// around it to indicate that it is a single argument
6969
if (arg.indexOf(' ') === -1) {
7070
return arg;
71-
} else {
72-
// this should correctly escape nested quotes
73-
return JSON.stringify(arg);
7471
}
72+
// this should correctly escape nested quotes
73+
return JSON.stringify(arg);
7574
})
7675
)
7776
.join(' ')

‎package-lock.json

+103-58
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)