-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: introduce
log-level
config option
- Loading branch information
1 parent
fb95190
commit 3fb6584
Showing
11 changed files
with
100 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,19 +36,20 @@ Alternatively some options may be set via CLI flags. | |
|
||
### Options | ||
|
||
| Option | Type | CLI Flag | Description | | ||
| ------ | ---- | -------- | ----------- | | ||
| 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.** | | ||
| firstParent | `boolean` | `--first-parent` | Apply commit filtering to current branch only. | | ||
| ignorePrivate | `boolean` | `--ignore-private` | Exclude private packages. **True by default.** | | ||
| ignorePackages | `String \| Array` | `--ignore-packages` | Packages list to be ignored on bumping process (appended to the ones that already exist at package.json workspaces). If using the CLI flag, supply a comma seperated list of strings. | | ||
| tagFormat | `String` | `--tag-format` | Format to use when creating tag names. Should include "name" and "version" vars. Default: `"${name}@${version}"` which generates "[email protected]" | | ||
| deps | `Object` | N/A | Depedency handling, see below for possible values. | | ||
| Option | Type | CLI Flag | Description | | ||
|-------------------|-------------------|------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ||
| dryRun | `boolean` | `--dry-run` | Dry run mode. | | ||
| logLevel | `String` | `--log-level` | Sets the internal logger verbosity level: `error, warn, info, debug, trace`. Defaults to `info`. | | ||
| debug | `boolean` | `--debug` | Output debugging information. Shortcut for `--logLevel=debug`. | | ||
| silent | `boolean` | `--silent` | Do not print configuration information. Shortcut for `--logLevel=error`. | | ||
| 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.** | | ||
| firstParent | `boolean` | `--first-parent` | Apply commit filtering to current branch only. | | ||
| ignorePrivate | `boolean` | `--ignore-private` | Exclude private packages. **True by default.** | | ||
| ignorePackages | `String \| Array` | `--ignore-packages` | Packages list to be ignored on bumping process (appended to the ones that already exist at package.json workspaces). If using the CLI flag, supply a comma seperated list of strings. | | ||
| tagFormat | `String` | `--tag-format` | Format to use when creating tag names. Should include "name" and "version" vars. Default: `"${name}@${version}"` which generates "[email protected]" | | ||
| deps | `Object` | N/A | Dependency handling, see below for possible values. | | ||
|
||
### `deps` Options | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import dbg from "debug"; | ||
import singnale from "signale"; | ||
|
||
const { Signale } = singnale; | ||
const severityOrder = ["error", "warn", "info", "debug", "trace"]; | ||
const assertLevel = (level, limit) => severityOrder.indexOf(level) <= severityOrder.indexOf(limit); | ||
const aliases = { | ||
failure: "error", | ||
log: "info", | ||
success: "info", | ||
complete: "info", | ||
}; | ||
|
||
export const logger = { | ||
prefix: "msr:", | ||
config: { | ||
_level: "info", | ||
_stderr: process.stderr, | ||
_stdout: process.stdout, | ||
_signale: {}, | ||
set level(l) { | ||
if (assertLevel(l, "debug")) { | ||
dbg.enable("msr:"); | ||
} | ||
if (assertLevel(l, "trace")) { | ||
dbg.enable("semantic-release:"); | ||
} | ||
this._level = l; | ||
}, | ||
get level() { | ||
return this._level; | ||
}, | ||
set stdio([stderr, stdout]) { | ||
this._stdout = stdout; | ||
this._stderr = stderr; | ||
this._signale = new Signale({ | ||
config: { displayTimestamp: true, displayLabel: false }, | ||
// scope: "multirelease", | ||
stream: stdout, | ||
types: { | ||
error: { color: "red", label: "", stream: [stderr] }, | ||
log: { color: "magenta", label: "", stream: [stdout], badge: "•" }, | ||
success: { color: "green", label: "", stream: [stdout] }, | ||
complete: { color: "green", label: "", stream: [stdout], badge: "🎉" }, | ||
}, | ||
}); | ||
}, | ||
get stdio() { | ||
return [this._stderr, this._stdout]; | ||
}, | ||
}, | ||
withScope(prefix) { | ||
return { | ||
...this, | ||
prefix, | ||
debug: dbg(prefix || this.prefix), | ||
}; | ||
}, | ||
...[...severityOrder, ...Object.keys(aliases)].reduce((m, l) => { | ||
m[l] = function (...args) { | ||
if (assertLevel(aliases[l] || l, this.config.level)) { | ||
(this.config._signale[l] || console[l] || (() => {}))(this.prefix, ...args); | ||
} | ||
}; | ||
return m; | ||
}, {}), | ||
debug: dbg("msr:"), | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2956,17 +2956,6 @@ fast-glob@^3.1.1: | |
merge2 "^1.3.0" | ||
micromatch "^4.0.4" | ||
|
||
fast-glob@^3.2.11: | ||
version "3.2.11" | ||
resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.11.tgz#a1172ad95ceb8a16e20caa5c5e56480e5129c1d9" | ||
integrity sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew== | ||
dependencies: | ||
"@nodelib/fs.stat" "^2.0.2" | ||
"@nodelib/fs.walk" "^1.2.3" | ||
glob-parent "^5.1.2" | ||
merge2 "^1.3.0" | ||
micromatch "^4.0.4" | ||
|
||
fast-glob@^3.2.12: | ||
version "3.2.12" | ||
resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.12.tgz#7f39ec99c2e6ab030337142da9e0c18f37afae80" | ||
|
@@ -3272,17 +3261,6 @@ globals@^13.19.0: | |
dependencies: | ||
type-fest "^0.20.2" | ||
|
||
[email protected]: | ||
version "13.1.4" | ||
resolved "https://registry.yarnpkg.com/globby/-/globby-13.1.4.tgz#2f91c116066bcec152465ba36e5caa4a13c01317" | ||
integrity sha512-iui/IiiW+QrJ1X1hKH5qwlMQyv34wJAYwH1vrf8b9kBA4sNiif3gKsMHa+BrdnOpEudWjpotfa7LrTzB1ERS/g== | ||
dependencies: | ||
dir-glob "^3.0.1" | ||
fast-glob "^3.2.11" | ||
ignore "^5.2.0" | ||
merge2 "^1.4.1" | ||
slash "^4.0.0" | ||
|
||
globby@^11.0.0, globby@^11.0.1: | ||
version "11.0.4" | ||
resolved "https://registry.yarnpkg.com/globby/-/globby-11.0.4.tgz#2cbaff77c2f2a62e71e9b2813a67b97a3a3001a5" | ||
|
@@ -4618,7 +4596,7 @@ merge-stream@^2.0.0: | |
resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" | ||
integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== | ||
|
||
merge2@^1.3.0, merge2@^1.4.1: | ||
merge2@^1.3.0: | ||
version "1.4.1" | ||
resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" | ||
integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== | ||
|
@@ -5906,11 +5884,6 @@ slash@^3.0.0: | |
resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" | ||
integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== | ||
|
||
slash@^4.0.0: | ||
version "4.0.0" | ||
resolved "https://registry.yarnpkg.com/slash/-/slash-4.0.0.tgz#2422372176c4c6c5addb5e2ada885af984b396a7" | ||
integrity sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew== | ||
|
||
smart-buffer@^4.2.0: | ||
version "4.2.0" | ||
resolved "https://registry.yarnpkg.com/smart-buffer/-/smart-buffer-4.2.0.tgz#6e1d71fa4f18c05f7d0ff216dd16a481d0e8d9ae" | ||
|