Skip to content

Commit b41f602

Browse files
committed
fix: (cli) remove watch boolean when false
1 parent 99a69ce commit b41f602

1 file changed

Lines changed: 21 additions & 4 deletions

File tree

lib/cli/command.start.ts

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as path from "path";
22
import { existsSync } from "fs";
3+
import { fromJS } from "immutable";
34
import * as utils from "../utils";
45
import { explodeFilesArg } from "./cli-options";
56
const _ = require("../lodash.custom");
@@ -51,10 +52,11 @@ export default function(opts) {
5152
* @returns {*}
5253
*/
5354
function preprocessFlags(flags) {
54-
return [stripUndefined, legacyFilesArgs].reduce(
55-
(flags, fn) => fn.call(null, flags),
56-
flags
57-
);
55+
return [
56+
stripUndefined,
57+
legacyFilesArgs,
58+
removeWatchBooleanWhenFalse
59+
].reduce((flags, fn) => fn.call(null, flags), flags);
5860
}
5961

6062
/**
@@ -87,3 +89,18 @@ function legacyFilesArgs(flags) {
8789
}
8890
return flags;
8991
}
92+
93+
/**
94+
* `watch` is a CLI boolean so should be removed if false to
95+
* allow config to set watch: true
96+
* @param flags
97+
* @returns {any}
98+
*/
99+
function removeWatchBooleanWhenFalse(flags) {
100+
if (flags.watch === false) {
101+
return fromJS(flags)
102+
.delete("watch")
103+
.toJS();
104+
}
105+
return flags;
106+
}

0 commit comments

Comments
 (0)