@juit/check-updates 2.0.7 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +109 -20
- package/dist/debug.cjs +51 -0
- package/dist/debug.cjs.map +6 -0
- package/dist/debug.d.ts +8 -0
- package/dist/debug.mjs +20 -0
- package/dist/debug.mjs.map +6 -0
- package/dist/index.cjs +37 -0
- package/dist/index.cjs.map +6 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.mjs +10 -0
- package/dist/index.mjs.map +6 -0
- package/dist/main.d.mts +2 -0
- package/dist/main.mjs +168 -0
- package/dist/main.mjs.map +6 -0
- package/dist/npmrc.cjs +74 -0
- package/dist/npmrc.cjs.map +6 -0
- package/dist/npmrc.d.ts +1 -0
- package/dist/npmrc.mjs +39 -0
- package/dist/npmrc.mjs.map +6 -0
- package/dist/updater.cjs +314 -0
- package/dist/updater.cjs.map +6 -0
- package/dist/updater.d.ts +50 -0
- package/dist/updater.mjs +279 -0
- package/dist/updater.mjs.map +6 -0
- package/dist/versions.cjs +65 -0
- package/dist/versions.cjs.map +6 -0
- package/dist/versions.d.ts +8 -0
- package/dist/versions.mjs +30 -0
- package/dist/versions.mjs.map +6 -0
- package/package.json +23 -10
- package/src/debug.ts +14 -0
- package/src/index.ts +5 -0
- package/src/main.mts +165 -0
- package/src/npmrc.ts +4 -4
- package/src/updater.ts +303 -149
- package/src/versions.ts +43 -0
- package/check-updates.js +0 -228
- package/src/main.ts +0 -75
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@ Dependencies Update Checker
|
|
|
2
2
|
===========================
|
|
3
3
|
|
|
4
4
|
This package contains a simple script to update the dependencies of a given
|
|
5
|
-
package file.
|
|
5
|
+
package file (or files).
|
|
6
6
|
|
|
7
7
|
By default it will _extend_ the semantics of `semver` checking for _minor_
|
|
8
8
|
version updates for tilde ranges (`~x.y.z`) and checking for _major_ version
|
|
@@ -12,38 +12,127 @@ To adhere to the standard `semver` rules simply specify the `--strict` option.
|
|
|
12
12
|
|
|
13
13
|
When installed, the `check-updates` script can be invoked directly:
|
|
14
14
|
|
|
15
|
-
```
|
|
15
|
+
```console
|
|
16
16
|
$ check-updates --help
|
|
17
|
-
|
|
17
|
+
|
|
18
|
+
Usage:
|
|
19
|
+
check-updates [--options ...] [package.json ...]
|
|
18
20
|
|
|
19
21
|
Options:
|
|
20
|
-
-h, --help
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
22
|
+
-h, --help Show this help.
|
|
23
|
+
|
|
24
|
+
-v, --version Show the version and exit.
|
|
25
|
+
|
|
26
|
+
-b, --bump Bump the version of the package file when changes in the
|
|
27
|
+
dependencies are found. Specifiy either "major", "minor"
|
|
28
|
+
or "patch" (default) to indicate which version to bump.
|
|
29
|
+
|
|
30
|
+
-s, --strict Strictly adhere to semver rules for tilde (~x.y.z) and
|
|
31
|
+
caret (^x.y.z) dependency ranges.
|
|
32
|
+
|
|
33
|
+
-q, --quick Consider dev/peer/optional dependency updates if and only
|
|
34
|
+
if the main depenencies also had updates.
|
|
35
|
+
|
|
36
|
+
-d, --debug Output debugging informations.
|
|
37
|
+
|
|
38
|
+
-x, --dry-run Do not write package changes.
|
|
39
|
+
|
|
40
|
+
--no-errors Exit with 0 in case of no updates. Normally the updater
|
|
41
|
+
will exit with 255 in this case.
|
|
42
|
+
|
|
43
|
+
--no-workspaces Do not process workspaces.
|
|
44
|
+
|
|
45
|
+
--no-align Do not align workspaces versions. By default all versions
|
|
46
|
+
will be set to the highest one amongst all workspaces
|
|
47
|
+
after bumping.
|
|
48
|
+
|
|
49
|
+
Remarks:
|
|
50
|
+
Multiple package.json files can be specified on the command line. In case no
|
|
51
|
+
files are specified, the default is to process the package.json file in the
|
|
52
|
+
current directory.
|
|
53
|
+
|
|
36
54
|
$
|
|
37
55
|
```
|
|
38
56
|
|
|
39
57
|
Alternatively it can be invoked via `npx '@juit/check-updates'`.
|
|
40
58
|
|
|
41
|
-
|
|
59
|
+
By default (unless `--no-errors` is specified) the exit code returned to the
|
|
60
|
+
caller will be:
|
|
42
61
|
|
|
43
62
|
* `0`: dependencies were updated and `package.json` was changed.
|
|
44
63
|
* `255`: nothing was updated, no changes.
|
|
45
64
|
* _any other_: error from NodeJS.
|
|
46
65
|
|
|
66
|
+
|
|
67
|
+
Options
|
|
68
|
+
-------
|
|
69
|
+
|
|
70
|
+
#### `--bump` (or `-b`)
|
|
71
|
+
|
|
72
|
+
Bump the `major`, `minor` or `patch` revision level if changes were detected.
|
|
73
|
+
|
|
74
|
+
By default no versions will be bumped, and when the `--bump` version is
|
|
75
|
+
specified without any argument, the `patch` version will be bumped.
|
|
76
|
+
|
|
77
|
+
#### `--strict` (or `-s`)
|
|
78
|
+
|
|
79
|
+
By default, version ranges specified by `~` (tilde: match on patch version) or
|
|
80
|
+
`^` (caret: match patch or minor versions) will be _extended_ so that `~` will
|
|
81
|
+
behave like `^` and match both patch _and_ minor versions, while `^` will match
|
|
82
|
+
any version _above_ the one specified.
|
|
83
|
+
|
|
84
|
+
The `--strict` flag makes the updater work with the strict definition of `~` or
|
|
85
|
+
`^` ranges. See [here](https://nodesource.com/blog/semver-tilde-and-caret/) for
|
|
86
|
+
more informations on range specifiers.
|
|
87
|
+
|
|
88
|
+
#### `--quick` (or `-q`)
|
|
89
|
+
|
|
90
|
+
By specifying the `--quick` flags, the updater will process the main
|
|
91
|
+
`dependencies` _first_ and only if any changes were detected then the other
|
|
92
|
+
dependencies in `devDependencies`, `peerDependencies` and `optionalDependencies`
|
|
93
|
+
will be processed.
|
|
94
|
+
|
|
95
|
+
#### `--dry-run` (or `-x`)
|
|
96
|
+
|
|
97
|
+
Only process and display changes _without_ writing the updated `package.json`
|
|
98
|
+
files.
|
|
99
|
+
|
|
100
|
+
#### `--debug` (or `-d`)
|
|
101
|
+
|
|
102
|
+
Dump out lots of debugging informations while updating packages.
|
|
103
|
+
|
|
104
|
+
#### `--no-errors`
|
|
105
|
+
|
|
106
|
+
By default the updater will _exit_ with `255` if _no changes_ were detected in
|
|
107
|
+
the dependencies. Specifying `--no-errors` will make the updater exit with `0`
|
|
108
|
+
unless a real error happened.
|
|
109
|
+
|
|
110
|
+
The `255` exit code is useful in scripts to detect whether changes were not
|
|
111
|
+
detected. For example the following script will exit with zero if no changes
|
|
112
|
+
were detected, will fail if an error occurred, and will perform some tasks if
|
|
113
|
+
changes were detected:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
#!/bin/bash
|
|
117
|
+
|
|
118
|
+
set -e # exit on errors
|
|
119
|
+
npx '@juit/check-updates' --quick --bump || exit $(( $? == 255 ? 0 : $? ))
|
|
120
|
+
# ... do stuff when changes were detected
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
#### `--no-workspaces`
|
|
124
|
+
|
|
125
|
+
By default the updater will _recursively_ process workspaces defined in the
|
|
126
|
+
various _package.json_ files. The `--no-workspaces` flag disables this.
|
|
127
|
+
|
|
128
|
+
#### `--no-align`
|
|
129
|
+
|
|
130
|
+
By default, when workspaces are present, versions will be aligned to the
|
|
131
|
+
greates versions amongst all workspaces after (if specified) bumping. When
|
|
132
|
+
`--no-align` is specified,
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
47
136
|
Legal
|
|
48
137
|
-----
|
|
49
138
|
|
package/dist/debug.cjs
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// debug.ts
|
|
21
|
+
var debug_exports = {};
|
|
22
|
+
__export(debug_exports, {
|
|
23
|
+
B: () => B,
|
|
24
|
+
G: () => G,
|
|
25
|
+
K: () => K,
|
|
26
|
+
R: () => R,
|
|
27
|
+
X: () => X,
|
|
28
|
+
Y: () => Y,
|
|
29
|
+
makeDebug: () => makeDebug
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(debug_exports);
|
|
32
|
+
var X = "\x1B[0m";
|
|
33
|
+
var R = "\x1B[38;5;203m";
|
|
34
|
+
var G = "\x1B[38;5;76m";
|
|
35
|
+
var Y = "\x1B[38;5;220m";
|
|
36
|
+
var B = "\x1B[38;5;69m";
|
|
37
|
+
var K = "\x1B[38;5;240m";
|
|
38
|
+
function makeDebug(debug) {
|
|
39
|
+
return debug ? (...args) => void (args.length && console.log(`${K}[DEBUG]${X}`, ...args)) : () => void 0;
|
|
40
|
+
}
|
|
41
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
42
|
+
0 && (module.exports = {
|
|
43
|
+
B,
|
|
44
|
+
G,
|
|
45
|
+
K,
|
|
46
|
+
R,
|
|
47
|
+
X,
|
|
48
|
+
Y,
|
|
49
|
+
makeDebug
|
|
50
|
+
});
|
|
51
|
+
//# sourceMappingURL=debug.cjs.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/debug.ts"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACO,IAAM,IAAI;AACV,IAAM,IAAI;AACV,IAAM,IAAI;AACV,IAAM,IAAI;AACV,IAAM,IAAI;AACV,IAAM,IAAI;AAGV,SAAS,UAAU,OAA2C;AACnE,SAAO,QACL,IAAI,SAAgB,MAAM,KAAK,UAAU,QAAQ,IAAI,GAAG,CAAC,UAAU,CAAC,IAAI,GAAG,IAAI,KAC/E,MAAM;AACV;",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
package/dist/debug.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Our colors */
|
|
2
|
+
export declare const X = "\u001B[0m";
|
|
3
|
+
export declare const R = "\u001B[38;5;203m";
|
|
4
|
+
export declare const G = "\u001B[38;5;76m";
|
|
5
|
+
export declare const Y = "\u001B[38;5;220m";
|
|
6
|
+
export declare const B = "\u001B[38;5;69m";
|
|
7
|
+
export declare const K = "\u001B[38;5;240m";
|
|
8
|
+
export declare function makeDebug(debug?: boolean): (...args: any[]) => void;
|
package/dist/debug.mjs
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// debug.ts
|
|
2
|
+
var X = "\x1B[0m";
|
|
3
|
+
var R = "\x1B[38;5;203m";
|
|
4
|
+
var G = "\x1B[38;5;76m";
|
|
5
|
+
var Y = "\x1B[38;5;220m";
|
|
6
|
+
var B = "\x1B[38;5;69m";
|
|
7
|
+
var K = "\x1B[38;5;240m";
|
|
8
|
+
function makeDebug(debug) {
|
|
9
|
+
return debug ? (...args) => void (args.length && console.log(`${K}[DEBUG]${X}`, ...args)) : () => void 0;
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
B,
|
|
13
|
+
G,
|
|
14
|
+
K,
|
|
15
|
+
R,
|
|
16
|
+
X,
|
|
17
|
+
Y,
|
|
18
|
+
makeDebug
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=debug.mjs.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/debug.ts"],
|
|
4
|
+
"mappings": ";AACO,IAAM,IAAI;AACV,IAAM,IAAI;AACV,IAAM,IAAI;AACV,IAAM,IAAI;AACV,IAAM,IAAI;AACV,IAAM,IAAI;AAGV,SAAS,UAAU,OAA2C;AACnE,SAAO,QACL,IAAI,SAAgB,MAAM,KAAK,UAAU,QAAQ,IAAI,GAAG,CAAC,UAAU,CAAC,IAAI,GAAG,IAAI,KAC/E,MAAM;AACV;",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// index.ts
|
|
21
|
+
var src_exports = {};
|
|
22
|
+
__export(src_exports, {
|
|
23
|
+
Updater: () => import_updater.Updater,
|
|
24
|
+
VersionsCache: () => import_versions.VersionsCache,
|
|
25
|
+
readNpmRc: () => import_npmrc.readNpmRc
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(src_exports);
|
|
28
|
+
var import_npmrc = require("./npmrc.cjs");
|
|
29
|
+
var import_updater = require("./updater.cjs");
|
|
30
|
+
var import_versions = require("./versions.cjs");
|
|
31
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
32
|
+
0 && (module.exports = {
|
|
33
|
+
Updater,
|
|
34
|
+
VersionsCache,
|
|
35
|
+
readNpmRc
|
|
36
|
+
});
|
|
37
|
+
//# sourceMappingURL=index.cjs.map
|
package/dist/index.d.ts
ADDED
package/dist/index.mjs
ADDED
package/dist/main.d.mts
ADDED
package/dist/main.mjs
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// main.mts
|
|
4
|
+
import { readFileSync } from "node:fs";
|
|
5
|
+
import { resolve } from "node:path";
|
|
6
|
+
import { fileURLToPath } from "node:url";
|
|
7
|
+
import yargsParser from "yargs-parser";
|
|
8
|
+
import { B, G, K, R, X, Y, makeDebug } from "./debug.mjs";
|
|
9
|
+
import { Updater } from "./updater.mjs";
|
|
10
|
+
import { VersionsCache } from "./versions.mjs";
|
|
11
|
+
function releaseType(releaseType2) {
|
|
12
|
+
if (releaseType2 === void 0)
|
|
13
|
+
return;
|
|
14
|
+
if (releaseType2 === "")
|
|
15
|
+
return "patch";
|
|
16
|
+
if (releaseType2 === "major")
|
|
17
|
+
return "major";
|
|
18
|
+
if (releaseType2 === "minor")
|
|
19
|
+
return "minor";
|
|
20
|
+
if (releaseType2 === "patch")
|
|
21
|
+
return "patch";
|
|
22
|
+
console.log(`Invalid flag for --bump: "${releaseType2}"`);
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
function showVersion() {
|
|
26
|
+
const path = fileURLToPath(import.meta.url);
|
|
27
|
+
const file = resolve(path, "..", "..", "package.json");
|
|
28
|
+
const data = readFileSync(file, "utf-8");
|
|
29
|
+
const json = JSON.parse(data);
|
|
30
|
+
console.log(`v${json.version}`);
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
function showHelp() {
|
|
34
|
+
console.log(`
|
|
35
|
+
${Y}Usage${X}:
|
|
36
|
+
${G}check-updates${X} [--options ...] [package.json ...]
|
|
37
|
+
|
|
38
|
+
${Y}Options${X}:
|
|
39
|
+
${G}-h${X}, ${G}--help${X} Show this help.
|
|
40
|
+
|
|
41
|
+
${G}-v${X}, ${G}--version${X} Show the version and exit.
|
|
42
|
+
|
|
43
|
+
${G}-b${X}, ${G}--bump${X} Bump the version of the package file when changes in the
|
|
44
|
+
dependencies are found. Specifiy either "${B}major${X}", "${B}minor${X}"
|
|
45
|
+
or "${B}patch${X}" ${K}(default)${X} to indicate which version to bump.
|
|
46
|
+
|
|
47
|
+
${G}-s${X}, ${G}--strict${X} Strictly adhere to semver rules for tilde ${K}(~x.y.z)${X} and
|
|
48
|
+
caret ${K}(^x.y.z)${X} dependency ranges.
|
|
49
|
+
|
|
50
|
+
${G}-q${X}, ${G}--quick${X} Consider dev/peer/optional dependency updates if and only
|
|
51
|
+
if the main depenencies also had updates.
|
|
52
|
+
|
|
53
|
+
${G}-d${X}, ${G}--debug${X} Output debugging informations.
|
|
54
|
+
|
|
55
|
+
${G}-x${X}, ${G}--dry-run${X} Do not write package changes.
|
|
56
|
+
|
|
57
|
+
${G}--no-errors${X} Exit with ${B}0${X} in case of no updates. Normally the updater
|
|
58
|
+
will exit with ${B}255${X} in this case.
|
|
59
|
+
|
|
60
|
+
${G}--no-workspaces${X} Do not process workspaces.
|
|
61
|
+
|
|
62
|
+
${G}--no-align${X} Do not align workspaces versions. By default all versions
|
|
63
|
+
will be set to the highest one amongst all workspaces
|
|
64
|
+
after bumping.
|
|
65
|
+
|
|
66
|
+
${Y}Remarks${X}:
|
|
67
|
+
Multiple ${B}package.json${X} files can be specified on the command line. In case no
|
|
68
|
+
files are specified, the default is to process the ${B}package.json${X} file in the
|
|
69
|
+
current directory.
|
|
70
|
+
`);
|
|
71
|
+
process.exit(1);
|
|
72
|
+
}
|
|
73
|
+
var { _: args, ...opts } = yargsParser(process.argv.slice(2), {
|
|
74
|
+
configuration: {
|
|
75
|
+
"camel-case-expansion": false,
|
|
76
|
+
"strip-aliased": true,
|
|
77
|
+
"strip-dashed": true
|
|
78
|
+
},
|
|
79
|
+
alias: {
|
|
80
|
+
"bump": ["b"],
|
|
81
|
+
"debug": ["d"],
|
|
82
|
+
"dry-run": ["x"],
|
|
83
|
+
"help": ["h"],
|
|
84
|
+
"quick": ["q"],
|
|
85
|
+
"strict": ["s"],
|
|
86
|
+
"version": ["v"]
|
|
87
|
+
},
|
|
88
|
+
string: ["bump"],
|
|
89
|
+
boolean: [
|
|
90
|
+
"align",
|
|
91
|
+
"debug",
|
|
92
|
+
"dry-run",
|
|
93
|
+
"help",
|
|
94
|
+
"errors",
|
|
95
|
+
"quick",
|
|
96
|
+
"strict",
|
|
97
|
+
"version",
|
|
98
|
+
"workspaces"
|
|
99
|
+
]
|
|
100
|
+
});
|
|
101
|
+
makeDebug(opts.debug)("Options:", { args, ...opts });
|
|
102
|
+
if (opts.version)
|
|
103
|
+
showVersion();
|
|
104
|
+
if (opts.help)
|
|
105
|
+
showHelp();
|
|
106
|
+
var align = true;
|
|
107
|
+
var dryRun = false;
|
|
108
|
+
var errors = true;
|
|
109
|
+
var options = {
|
|
110
|
+
bump: void 0,
|
|
111
|
+
debug: false,
|
|
112
|
+
quick: false,
|
|
113
|
+
strict: false,
|
|
114
|
+
workspaces: true
|
|
115
|
+
};
|
|
116
|
+
for (const [key, value] of Object.entries(opts)) {
|
|
117
|
+
switch (key) {
|
|
118
|
+
case "align":
|
|
119
|
+
align = !!value;
|
|
120
|
+
break;
|
|
121
|
+
case "bump":
|
|
122
|
+
options.bump = releaseType(value);
|
|
123
|
+
break;
|
|
124
|
+
case "debug":
|
|
125
|
+
options.debug = !!value;
|
|
126
|
+
break;
|
|
127
|
+
case "dry-run":
|
|
128
|
+
dryRun = !!value;
|
|
129
|
+
break;
|
|
130
|
+
case "errors":
|
|
131
|
+
errors = !!value;
|
|
132
|
+
break;
|
|
133
|
+
case "quick":
|
|
134
|
+
options.quick = !!value;
|
|
135
|
+
break;
|
|
136
|
+
case "strict":
|
|
137
|
+
options.strict = !!value;
|
|
138
|
+
break;
|
|
139
|
+
case "workspaces":
|
|
140
|
+
options.workspaces = !!value;
|
|
141
|
+
break;
|
|
142
|
+
default:
|
|
143
|
+
console.log(`${R}[ERROR]${X} Unsupported / unknown option: --${key}
|
|
144
|
+
`);
|
|
145
|
+
showHelp();
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
var files = args.map((arg) => arg.toString());
|
|
149
|
+
if (!files.length)
|
|
150
|
+
files.push("package.json");
|
|
151
|
+
try {
|
|
152
|
+
const cache = new VersionsCache();
|
|
153
|
+
let changed = false;
|
|
154
|
+
for (const file of files) {
|
|
155
|
+
const updater = await new Updater(file, options, cache).init();
|
|
156
|
+
await updater.update();
|
|
157
|
+
if (align)
|
|
158
|
+
await updater.align();
|
|
159
|
+
if (!dryRun)
|
|
160
|
+
await updater.write();
|
|
161
|
+
changed ||= updater.changed;
|
|
162
|
+
}
|
|
163
|
+
process.exitCode = changed ? 0 : errors ? -1 : 0;
|
|
164
|
+
} catch (error) {
|
|
165
|
+
console.error(error);
|
|
166
|
+
process.exitCode = 1;
|
|
167
|
+
}
|
|
168
|
+
//# sourceMappingURL=main.mjs.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/main.mts"],
|
|
4
|
+
"mappings": ";;;AAEA,SAAS,oBAAoB;AAC7B,SAAS,eAAe;AACxB,SAAS,qBAAqB;AAE9B,OAAO,iBAAiB;AAExB,SAAS,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": ["releaseType"]
|
|
6
|
+
}
|
package/dist/npmrc.cjs
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// npmrc.ts
|
|
31
|
+
var npmrc_exports = {};
|
|
32
|
+
__export(npmrc_exports, {
|
|
33
|
+
readNpmRc: () => readNpmRc
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(npmrc_exports);
|
|
36
|
+
var import_promises = __toESM(require("node:fs/promises"), 1);
|
|
37
|
+
var import_node_path = __toESM(require("node:path"), 1);
|
|
38
|
+
var import_ini = require("ini");
|
|
39
|
+
function replaceEnvironmentVariable(token) {
|
|
40
|
+
return token.replace(/^\$\{?([^}]*)\}?$/, (_match, ...vars) => {
|
|
41
|
+
return process.env[vars[0]] || "";
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
async function readIniFile(filename) {
|
|
45
|
+
try {
|
|
46
|
+
const data = await import_promises.default.readFile(filename, "utf8");
|
|
47
|
+
const npmrc = (0, import_ini.parse)(data);
|
|
48
|
+
for (const key in npmrc) {
|
|
49
|
+
if (typeof npmrc[key] === "string") {
|
|
50
|
+
npmrc[key] = replaceEnvironmentVariable(npmrc[key]);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return npmrc;
|
|
54
|
+
} catch (error) {
|
|
55
|
+
if (error.code === "ENOENT")
|
|
56
|
+
return {};
|
|
57
|
+
throw error;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
async function readNpmRc(packageJsonFile) {
|
|
61
|
+
const local = readIniFile(import_node_path.default.resolve(packageJsonFile, "..", ".npmrc"));
|
|
62
|
+
const user = readIniFile(
|
|
63
|
+
process.env.NPM_CONFIG_USERCONFIG ? process.env.NPM_CONFIG_USERCONFIG : process.env.HOME ? import_node_path.default.resolve(process.env.HOME, ".npmrc") : ""
|
|
64
|
+
);
|
|
65
|
+
const global = readIniFile(
|
|
66
|
+
process.env.NPM_CONFIG_GLOBALCONFIG ? process.env.NPM_CONFIG_GLOBALCONFIG : "/etc/npmrc"
|
|
67
|
+
);
|
|
68
|
+
return Object.assign({}, ...await Promise.all([global, user, local]));
|
|
69
|
+
}
|
|
70
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
71
|
+
0 && (module.exports = {
|
|
72
|
+
readNpmRc
|
|
73
|
+
});
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
|
5
|
+
"names": ["fs", "path"]
|
|
6
|
+
}
|
package/dist/npmrc.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function readNpmRc(packageJsonFile: string): Promise<Record<string, any>>;
|
package/dist/npmrc.mjs
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// npmrc.ts
|
|
2
|
+
import fs from "node:fs/promises";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { parse } from "ini";
|
|
5
|
+
function replaceEnvironmentVariable(token) {
|
|
6
|
+
return token.replace(/^\$\{?([^}]*)\}?$/, (_match, ...vars) => {
|
|
7
|
+
return process.env[vars[0]] || "";
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
async function readIniFile(filename) {
|
|
11
|
+
try {
|
|
12
|
+
const data = await fs.readFile(filename, "utf8");
|
|
13
|
+
const npmrc = parse(data);
|
|
14
|
+
for (const key in npmrc) {
|
|
15
|
+
if (typeof npmrc[key] === "string") {
|
|
16
|
+
npmrc[key] = replaceEnvironmentVariable(npmrc[key]);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return npmrc;
|
|
20
|
+
} catch (error) {
|
|
21
|
+
if (error.code === "ENOENT")
|
|
22
|
+
return {};
|
|
23
|
+
throw error;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
async function readNpmRc(packageJsonFile) {
|
|
27
|
+
const local = readIniFile(path.resolve(packageJsonFile, "..", ".npmrc"));
|
|
28
|
+
const user = readIniFile(
|
|
29
|
+
process.env.NPM_CONFIG_USERCONFIG ? process.env.NPM_CONFIG_USERCONFIG : process.env.HOME ? path.resolve(process.env.HOME, ".npmrc") : ""
|
|
30
|
+
);
|
|
31
|
+
const global = readIniFile(
|
|
32
|
+
process.env.NPM_CONFIG_GLOBALCONFIG ? process.env.NPM_CONFIG_GLOBALCONFIG : "/etc/npmrc"
|
|
33
|
+
);
|
|
34
|
+
return Object.assign({}, ...await Promise.all([global, user, local]));
|
|
35
|
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