Skip to content

Commit 47a27d8

Browse files
feat: introduce a silent mode(#88)
when silent flag is enabled, don't print the configuration
1 parent d061827 commit 47a27d8

File tree

6 files changed

+21
-9
lines changed

6 files changed

+21
-9
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Alternatively some options may be set via CLI flags.
4040
| ------ | ---- | -------- | ----------- |
4141
| dryRun | `boolean` | `--dry-run` | Dry run mode. |
4242
| debug | `boolean` | `--debug` | Output debugging information. |
43+
| silent | `boolean` | `--silent` | Do not print configuration information. |
4344
| 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. |
4445
| sequentialInit | `boolean` | `--sequential-init` | Avoid hypothetical concurrent initialization collisions. |
4546
| sequentialPrepare | `boolean` | `--sequential-prepare` | Avoid hypothetical concurrent preparation collisions. **True by default.** |

bin/cli.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const cli = meow(
1313
Options
1414
--dry-run Dry run mode.
1515
--debug Output debugging information.
16+
--silent Do not print configuration information.
1617
--sequential-init Avoid hypothetical concurrent initialization collisions.
1718
--sequential-prepare Avoid hypothetical concurrent preparation collisions. Do not use if your project have cyclic dependencies.
1819
--first-parent Apply commit filtering to current branch only.
@@ -70,6 +71,9 @@ const cli = meow(
7071
dryRun: {
7172
type: "boolean",
7273
},
74+
silent: {
75+
type: "boolean",
76+
},
7377
},
7478
}
7579
);

bin/runner.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,23 @@ export default async (cliFlags) => {
1717
try {
1818
const flags = await getConfigMultiSemrel(cwd, cliFlags);
1919

20+
const silent = flags.silent && !flags.debug;
21+
2022
if (flags.debug) {
2123
require("debug").enable("msr:*");
2224
}
2325

24-
console.log(`multi-semantic-release version: ${multisemrelPkgJson.version}`);
25-
console.log(`semantic-release version: ${semrelPkgJson.version}`);
26-
console.log(`flags: ${JSON.stringify(flags, null, 2)}`);
26+
if (!silent) {
27+
console.log(`multi-semantic-release version: ${multisemrelPkgJson.version}`);
28+
console.log(`semantic-release version: ${semrelPkgJson.version}`);
29+
console.log(`flags: ${JSON.stringify(flags, null, 2)}`);
30+
}
2731

2832
// Get list of package.json paths according to workspaces.
2933
const paths = getPackagePaths(cwd, flags.ignorePackages);
30-
console.log("package paths", paths);
34+
if (!silent) {
35+
console.log("package paths", paths);
36+
}
3137

3238
// Do multirelease (log out any errors).
3339
multiSemanticRelease(paths, {}, { cwd }, flags).then(

lib/getConfigMultiSemrel.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ export default async function getConfig(cwd, cliOptions) {
7373
release: "patch",
7474
prefix: "",
7575
},
76+
silent: false,
7677
},
7778
options
7879
);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
"meow": "^10.1.2",
7070
"promise-events": "^0.2.4",
7171
"resolve-from": "^5.0.0",
72-
"semantic-release": "^19.0.2",
72+
"semantic-release": "^19.0.5",
7373
"semver": "^7.3.7",
7474
"signale": "^1.4.0",
7575
"stream-buffers": "^3.0.2"

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5594,10 +5594,10 @@ safe-buffer@~5.1.0, safe-buffer@~5.1.1:
55945594
resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
55955595
integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==
55965596

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

0 commit comments

Comments
 (0)