Skip to content

Commit

Permalink
fix: (cli) remove watch boolean when false
Browse files Browse the repository at this point in the history
  • Loading branch information
shakyShane committed Apr 29, 2018
1 parent 99a69ce commit b41f602
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions lib/cli/command.start.ts
@@ -1,5 +1,6 @@
import * as path from "path";
import { existsSync } from "fs";
import { fromJS } from "immutable";
import * as utils from "../utils";
import { explodeFilesArg } from "./cli-options";
const _ = require("../lodash.custom");
Expand Down Expand Up @@ -51,10 +52,11 @@ export default function(opts) {
* @returns {*}
*/
function preprocessFlags(flags) {
return [stripUndefined, legacyFilesArgs].reduce(
(flags, fn) => fn.call(null, flags),
flags
);
return [
stripUndefined,
legacyFilesArgs,
removeWatchBooleanWhenFalse
].reduce((flags, fn) => fn.call(null, flags), flags);
}

/**
Expand Down Expand Up @@ -87,3 +89,18 @@ function legacyFilesArgs(flags) {
}
return flags;
}

/**
* `watch` is a CLI boolean so should be removed if false to
* allow config to set watch: true
* @param flags
* @returns {any}
*/
function removeWatchBooleanWhenFalse(flags) {
if (flags.watch === false) {
return fromJS(flags)
.delete("watch")
.toJS();
}
return flags;
}

0 comments on commit b41f602

Please sign in to comment.