Skip to content

Commit b11ddd1

Browse files
committed
Merge branch 'main' of github.com:remy/nodemon
* 'main' of github.com:remy/nodemon: fix: remove ts mapping if loader present One more fix Get rid of spawning shell windows if nodemon is started without console.
2 parents 204af11 + 1468397 commit b11ddd1

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

lib/config/defaults.js

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
var ignoreRoot = require('ignore-by-default').directories();
22

33
// default options for config.options
4-
module.exports = {
4+
const defaults = {
55
restartable: 'rs',
66
colours: true,
77
execMap: {
@@ -12,7 +12,7 @@ module.exports = {
1212
// compatible with linux, mac and windows, or make the default.js
1313
// dynamically append the `.cmd` for node based utilities
1414
},
15-
ignoreRoot: ignoreRoot.map(_ => `**/${_}/**`),
15+
ignoreRoot: ignoreRoot.map((_) => `**/${_}/**`),
1616
watch: ['*.*'],
1717
stdin: true,
1818
runOnChangeOnly: false,
@@ -22,7 +22,11 @@ module.exports = {
2222
// but also includes stderr. If this is false, data is still dispatched via
2323
// nodemon.on('stdout/stderr')
2424
stdout: true,
25-
watchOptions: {
26-
27-
},
25+
watchOptions: {},
2826
};
27+
28+
if ((process.env.NODE_OPTIONS || '').includes('--loader')) {
29+
delete defaults.execMap.ts;
30+
}
31+
32+
module.exports = defaults;

lib/monitor/run.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ function run(options) {
9090
sh = process.env.comspec || 'cmd';
9191
shFlag = '/d /s /c';
9292
spawnOptions.windowsVerbatimArguments = true;
93+
spawnOptions.windowsHide = true;
9394
}
9495

9596
var args = runCmd ? utils.stringify(executable, cmd.args) : ':';
@@ -122,11 +123,15 @@ function run(options) {
122123
var forkArgs = cmd.args.slice(1);
123124
var env = utils.merge(options.execOptions.env, process.env);
124125
stdio.push('ipc');
125-
child = fork(options.execOptions.script, forkArgs, {
126+
const forkOptions = {
126127
env: env,
127128
stdio: stdio,
128129
silent: !hasStdio,
129-
});
130+
};
131+
if (utils.isWindows) {
132+
forkOptions.windowsHide = true;
133+
}
134+
child = fork(options.execOptions.script, forkArgs, forkOptions);
130135
utils.log.detail('forking');
131136
debug('fork', sh, shFlag, args);
132137
} else {

lib/spawn.js

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ module.exports = function spawnCommand(command, config, eventArgs) {
4444
sh = process.env.comspec || 'cmd';
4545
shFlag = '/d /s /c';
4646
spawnOptions.windowsVerbatimArguments = true;
47+
spawnOptions.windowsHide = true;
4748
}
4849

4950
const args = command.join(' ');

0 commit comments

Comments
 (0)