Skip to content

Commit

Permalink
Fix issue babel#8326, quiet the @babel/cli with --quiet cli option.
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-peng-1244 committed Sep 6, 2019
1 parent d05bd9e commit df71c83
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 8 additions & 6 deletions packages/babel-cli/src/babel/dir.js
Expand Up @@ -56,7 +56,7 @@ export default async function({
outputFileSync(dest, res.code);
util.chmod(src, dest);

if (cliOptions.verbose) {
if (cliOptions.verbose && !cliOptions.quiet) {
console.log(src + " -> " + dest);
}

Expand Down 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
2 changes: 2 additions & 0 deletions packages/babel-cli/src/babel/options.js
Expand Up @@ -145,6 +145,7 @@ commander.option(
"Include dotfiles when compiling and copying non-compilable files",
);
commander.option("--verbose", "Log everything");
commander.option("--quiet", "Don't log anything");
commander.option(
"--delete-dir-on-start",
"Delete the out directory before compilation",
Expand Down Expand Up @@ -282,6 +283,7 @@ export default function parseArgv(args: Array<string>): CmdOptions {
copyFiles: opts.copyFiles,
includeDotfiles: opts.includeDotfiles,
verbose: opts.verbose,
quiet: opts.quiet,
deleteDirOnStart: opts.deleteDirOnStart,
sourceMapTarget: opts.sourceMapTarget,
},
Expand Down

0 comments on commit df71c83

Please sign in to comment.