Skip to content

Commit

Permalink
feat: introduce a silent mode(#88)
Browse files Browse the repository at this point in the history
when silent flag is enabled, don't print the configuration
  • Loading branch information
clementprevot committed May 23, 2023
1 parent d061827 commit 47a27d8
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 9 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Alternatively some options may be set via CLI flags.
| ------ | ---- | -------- | ----------- |
| dryRun | `boolean` | `--dry-run` | Dry run mode. |
| debug | `boolean` | `--debug` | Output debugging information. |
| silent | `boolean` | `--silent` | Do not print configuration information. |
| extends | `String \| Array` | N/A | List of modules or file paths containing a shareable configuration. If multiple shareable configurations are set, they will be imported in the order defined with each configuration option taking precedence over the options defined in the previous. |
| sequentialInit | `boolean` | `--sequential-init` | Avoid hypothetical concurrent initialization collisions. |
| sequentialPrepare | `boolean` | `--sequential-prepare` | Avoid hypothetical concurrent preparation collisions. **True by default.** |
Expand Down
4 changes: 4 additions & 0 deletions bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const cli = meow(
Options
--dry-run Dry run mode.
--debug Output debugging information.
--silent Do not print configuration information.
--sequential-init Avoid hypothetical concurrent initialization collisions.
--sequential-prepare Avoid hypothetical concurrent preparation collisions. Do not use if your project have cyclic dependencies.
--first-parent Apply commit filtering to current branch only.
Expand Down Expand Up @@ -70,6 +71,9 @@ const cli = meow(
dryRun: {
type: "boolean",
},
silent: {
type: "boolean",
},
},
}
);
Expand Down
14 changes: 10 additions & 4 deletions bin/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,23 @@ export default async (cliFlags) => {
try {
const flags = await getConfigMultiSemrel(cwd, cliFlags);

const silent = flags.silent && !flags.debug;

if (flags.debug) {
require("debug").enable("msr:*");
}

console.log(`multi-semantic-release version: ${multisemrelPkgJson.version}`);
console.log(`semantic-release version: ${semrelPkgJson.version}`);
console.log(`flags: ${JSON.stringify(flags, null, 2)}`);
if (!silent) {
console.log(`multi-semantic-release version: ${multisemrelPkgJson.version}`);
console.log(`semantic-release version: ${semrelPkgJson.version}`);
console.log(`flags: ${JSON.stringify(flags, null, 2)}`);
}

// Get list of package.json paths according to workspaces.
const paths = getPackagePaths(cwd, flags.ignorePackages);
console.log("package paths", paths);
if (!silent) {
console.log("package paths", paths);
}

// Do multirelease (log out any errors).
multiSemanticRelease(paths, {}, { cwd }, flags).then(
Expand Down
1 change: 1 addition & 0 deletions lib/getConfigMultiSemrel.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export default async function getConfig(cwd, cliOptions) {
release: "patch",
prefix: "",
},
silent: false,
},
options
);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"meow": "^10.1.2",
"promise-events": "^0.2.4",
"resolve-from": "^5.0.0",
"semantic-release": "^19.0.2",
"semantic-release": "^19.0.5",
"semver": "^7.3.7",
"signale": "^1.4.0",
"stream-buffers": "^3.0.2"
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5594,10 +5594,10 @@ safe-buffer@~5.1.0, safe-buffer@~5.1.1:
resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==

semantic-release@^19.0.3:
version "19.0.3"
resolved "https://registry.yarnpkg.com/semantic-release/-/semantic-release-19.0.3.tgz#9291053ad9890052f28e7c5921d4741530d516fd"
integrity sha512-HaFbydST1cDKZHuFZxB8DTrBLJVK/AnDExpK0s3EqLIAAUAHUgnd+VSJCUtTYQKkAkauL8G9CucODrVCc7BuAA==
semantic-release@^19.0.5:
version "19.0.5"
resolved "https://registry.yarnpkg.com/semantic-release/-/semantic-release-19.0.5.tgz#d7fab4b33fc20f1288eafd6c441e5d0938e5e174"
integrity sha512-NMPKdfpXTnPn49FDogMBi36SiBfXkSOJqCkk0E4iWOY1tusvvgBwqUmxTX1kmlT6kIYed9YwNKD1sfPpqa5yaA==
dependencies:
"@semantic-release/commit-analyzer" "^9.0.2"
"@semantic-release/error" "^3.0.0"
Expand Down

0 comments on commit 47a27d8

Please sign in to comment.