Skip to content

Commit

Permalink
Fix #8326, add back --quiet option. (#10399)
Browse files Browse the repository at this point in the history
* Fix issue #8326, quiet the @babel/cli with --quiet cli option.

* --quiet and --verbose options now conflict with each other.
  • Loading branch information
chris-peng-1244 authored and nicolo-ribaudo committed Oct 29, 2019
1 parent 1d1fab4 commit 4e5ac1f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
12 changes: 7 additions & 5 deletions packages/babel-cli/src/babel/dir.js
Expand Up @@ -129,11 +129,13 @@ export default async function({
compiledFiles += await handle(filename);
}

console.log(
`Successfully compiled ${compiledFiles} ${
compiledFiles !== 1 ? "files" : "file"
} with Babel.`,
);
if (!cliOptions.quiet) {
console.log(
`Successfully compiled ${compiledFiles} ${
compiledFiles !== 1 ? "files" : "file"
} with Babel.`,
);
}
}

if (cliOptions.watch) {
Expand Down
14 changes: 13 additions & 1 deletion packages/babel-cli/src/babel/options.js
Expand Up @@ -144,7 +144,14 @@ commander.option(
"--include-dotfiles",
"Include dotfiles when compiling and copying non-compilable files",
);
commander.option("--verbose", "Log everything");
commander.option(
"--verbose",
"Log everything. This option conflicts with --quiet",
);
commander.option(
"--quiet",
"Don't log anything. This option conflicts with --verbose",
);
commander.option(
"--delete-dir-on-start",
"Delete the out directory before compilation",
Expand Down Expand Up @@ -207,6 +214,10 @@ export default function parseArgv(args: Array<string>): CmdOptions | null {
errors.push("--delete-dir-on-start requires --out-dir");
}

if (commander.verbose && commander.quiet) {
errors.push("--verbose and --quiet cannot be used together");
}

if (
!commander.outDir &&
filenames.length === 0 &&
Expand Down Expand Up @@ -282,6 +293,7 @@ export default function parseArgv(args: Array<string>): CmdOptions | null {
copyFiles: opts.copyFiles,
includeDotfiles: opts.includeDotfiles,
verbose: opts.verbose,
quiet: opts.quiet,
deleteDirOnStart: opts.deleteDirOnStart,
sourceMapTarget: opts.sourceMapTarget,
},
Expand Down

0 comments on commit 4e5ac1f

Please sign in to comment.