bumpp 9.11.0 → 10.0.0
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/bin/bumpp.mjs +4 -0
- package/dist/{cli/index.js → cli.mjs} +52 -55
- package/dist/index.mjs +19 -0
- package/dist/{chunk-BEM77VRK.js → shared/bumpp.DE3hJRX3.mjs} +313 -380
- package/package.json +31 -32
- package/bin/bumpp.js +0 -5
- package/dist/cli/index.cjs +0 -1161
- package/dist/index.cjs +0 -1070
- package/dist/index.js +0 -23
- /package/dist/{cli/index.d.cts → cli.d.mts} +0 -0
- /package/dist/{cli/index.d.ts → cli.d.ts} +0 -0
- /package/dist/{index.d.cts → index.d.mts} +0 -0
|
@@ -1,232 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
var __copyProps = (to, from, except, desc) => {
|
|
16
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
-
for (let key of __getOwnPropNames(from))
|
|
18
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
19
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
20
|
-
}
|
|
21
|
-
return to;
|
|
22
|
-
};
|
|
23
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
24
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
25
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
26
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
27
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
28
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
29
|
-
mod
|
|
30
|
-
));
|
|
31
|
-
|
|
32
|
-
// node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
|
|
33
|
-
var require_picocolors = __commonJS({
|
|
34
|
-
"node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js"(exports, module) {
|
|
35
|
-
var p = process || {};
|
|
36
|
-
var argv = p.argv || [];
|
|
37
|
-
var env = p.env || {};
|
|
38
|
-
var isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
|
|
39
|
-
var formatter = (open, close, replace = open) => (input) => {
|
|
40
|
-
let string = "" + input, index = string.indexOf(close, open.length);
|
|
41
|
-
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
42
|
-
};
|
|
43
|
-
var replaceClose = (string, close, replace, index) => {
|
|
44
|
-
let result = "", cursor = 0;
|
|
45
|
-
do {
|
|
46
|
-
result += string.substring(cursor, index) + replace;
|
|
47
|
-
cursor = index + close.length;
|
|
48
|
-
index = string.indexOf(close, cursor);
|
|
49
|
-
} while (~index);
|
|
50
|
-
return result + string.substring(cursor);
|
|
51
|
-
};
|
|
52
|
-
var createColors = (enabled = isColorSupported) => {
|
|
53
|
-
let f = enabled ? formatter : () => String;
|
|
54
|
-
return {
|
|
55
|
-
isColorSupported: enabled,
|
|
56
|
-
reset: f("\x1B[0m", "\x1B[0m"),
|
|
57
|
-
bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
58
|
-
dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
|
59
|
-
italic: f("\x1B[3m", "\x1B[23m"),
|
|
60
|
-
underline: f("\x1B[4m", "\x1B[24m"),
|
|
61
|
-
inverse: f("\x1B[7m", "\x1B[27m"),
|
|
62
|
-
hidden: f("\x1B[8m", "\x1B[28m"),
|
|
63
|
-
strikethrough: f("\x1B[9m", "\x1B[29m"),
|
|
64
|
-
black: f("\x1B[30m", "\x1B[39m"),
|
|
65
|
-
red: f("\x1B[31m", "\x1B[39m"),
|
|
66
|
-
green: f("\x1B[32m", "\x1B[39m"),
|
|
67
|
-
yellow: f("\x1B[33m", "\x1B[39m"),
|
|
68
|
-
blue: f("\x1B[34m", "\x1B[39m"),
|
|
69
|
-
magenta: f("\x1B[35m", "\x1B[39m"),
|
|
70
|
-
cyan: f("\x1B[36m", "\x1B[39m"),
|
|
71
|
-
white: f("\x1B[37m", "\x1B[39m"),
|
|
72
|
-
gray: f("\x1B[90m", "\x1B[39m"),
|
|
73
|
-
bgBlack: f("\x1B[40m", "\x1B[49m"),
|
|
74
|
-
bgRed: f("\x1B[41m", "\x1B[49m"),
|
|
75
|
-
bgGreen: f("\x1B[42m", "\x1B[49m"),
|
|
76
|
-
bgYellow: f("\x1B[43m", "\x1B[49m"),
|
|
77
|
-
bgBlue: f("\x1B[44m", "\x1B[49m"),
|
|
78
|
-
bgMagenta: f("\x1B[45m", "\x1B[49m"),
|
|
79
|
-
bgCyan: f("\x1B[46m", "\x1B[49m"),
|
|
80
|
-
bgWhite: f("\x1B[47m", "\x1B[49m"),
|
|
81
|
-
blackBright: f("\x1B[90m", "\x1B[39m"),
|
|
82
|
-
redBright: f("\x1B[91m", "\x1B[39m"),
|
|
83
|
-
greenBright: f("\x1B[92m", "\x1B[39m"),
|
|
84
|
-
yellowBright: f("\x1B[93m", "\x1B[39m"),
|
|
85
|
-
blueBright: f("\x1B[94m", "\x1B[39m"),
|
|
86
|
-
magentaBright: f("\x1B[95m", "\x1B[39m"),
|
|
87
|
-
cyanBright: f("\x1B[96m", "\x1B[39m"),
|
|
88
|
-
whiteBright: f("\x1B[97m", "\x1B[39m"),
|
|
89
|
-
bgBlackBright: f("\x1B[100m", "\x1B[49m"),
|
|
90
|
-
bgRedBright: f("\x1B[101m", "\x1B[49m"),
|
|
91
|
-
bgGreenBright: f("\x1B[102m", "\x1B[49m"),
|
|
92
|
-
bgYellowBright: f("\x1B[103m", "\x1B[49m"),
|
|
93
|
-
bgBlueBright: f("\x1B[104m", "\x1B[49m"),
|
|
94
|
-
bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
|
|
95
|
-
bgCyanBright: f("\x1B[106m", "\x1B[49m"),
|
|
96
|
-
bgWhiteBright: f("\x1B[107m", "\x1B[49m")
|
|
97
|
-
};
|
|
98
|
-
};
|
|
99
|
-
module.exports = createColors();
|
|
100
|
-
module.exports.createColors = createColors;
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
// node_modules/.pnpm/log-symbols@7.0.0/node_modules/log-symbols/symbols.js
|
|
105
|
-
var symbols_exports = {};
|
|
106
|
-
__export(symbols_exports, {
|
|
107
|
-
error: () => error,
|
|
108
|
-
info: () => info,
|
|
109
|
-
success: () => success,
|
|
110
|
-
warning: () => warning
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
// node_modules/.pnpm/yoctocolors@2.1.1/node_modules/yoctocolors/base.js
|
|
114
|
-
import tty from "node:tty";
|
|
115
|
-
var hasColors = tty?.WriteStream?.prototype?.hasColors?.() ?? false;
|
|
116
|
-
var format = (open, close) => {
|
|
117
|
-
if (!hasColors) {
|
|
118
|
-
return (input) => input;
|
|
119
|
-
}
|
|
120
|
-
const openCode = `\x1B[${open}m`;
|
|
121
|
-
const closeCode = `\x1B[${close}m`;
|
|
122
|
-
return (input) => {
|
|
123
|
-
const string = input + "";
|
|
124
|
-
let index = string.indexOf(closeCode);
|
|
125
|
-
if (index === -1) {
|
|
126
|
-
return openCode + string + closeCode;
|
|
127
|
-
}
|
|
128
|
-
let result = openCode;
|
|
129
|
-
let lastIndex = 0;
|
|
130
|
-
while (index !== -1) {
|
|
131
|
-
result += string.slice(lastIndex, index) + openCode;
|
|
132
|
-
lastIndex = index + closeCode.length;
|
|
133
|
-
index = string.indexOf(closeCode, lastIndex);
|
|
134
|
-
}
|
|
135
|
-
result += string.slice(lastIndex) + closeCode;
|
|
136
|
-
return result;
|
|
137
|
-
};
|
|
138
|
-
};
|
|
139
|
-
var reset = format(0, 0);
|
|
140
|
-
var bold = format(1, 22);
|
|
141
|
-
var dim = format(2, 22);
|
|
142
|
-
var italic = format(3, 23);
|
|
143
|
-
var underline = format(4, 24);
|
|
144
|
-
var overline = format(53, 55);
|
|
145
|
-
var inverse = format(7, 27);
|
|
146
|
-
var hidden = format(8, 28);
|
|
147
|
-
var strikethrough = format(9, 29);
|
|
148
|
-
var black = format(30, 39);
|
|
149
|
-
var red = format(31, 39);
|
|
150
|
-
var green = format(32, 39);
|
|
151
|
-
var yellow = format(33, 39);
|
|
152
|
-
var blue = format(34, 39);
|
|
153
|
-
var magenta = format(35, 39);
|
|
154
|
-
var cyan = format(36, 39);
|
|
155
|
-
var white = format(37, 39);
|
|
156
|
-
var gray = format(90, 39);
|
|
157
|
-
var bgBlack = format(40, 49);
|
|
158
|
-
var bgRed = format(41, 49);
|
|
159
|
-
var bgGreen = format(42, 49);
|
|
160
|
-
var bgYellow = format(43, 49);
|
|
161
|
-
var bgBlue = format(44, 49);
|
|
162
|
-
var bgMagenta = format(45, 49);
|
|
163
|
-
var bgCyan = format(46, 49);
|
|
164
|
-
var bgWhite = format(47, 49);
|
|
165
|
-
var bgGray = format(100, 49);
|
|
166
|
-
var redBright = format(91, 39);
|
|
167
|
-
var greenBright = format(92, 39);
|
|
168
|
-
var yellowBright = format(93, 39);
|
|
169
|
-
var blueBright = format(94, 39);
|
|
170
|
-
var magentaBright = format(95, 39);
|
|
171
|
-
var cyanBright = format(96, 39);
|
|
172
|
-
var whiteBright = format(97, 39);
|
|
173
|
-
var bgRedBright = format(101, 49);
|
|
174
|
-
var bgGreenBright = format(102, 49);
|
|
175
|
-
var bgYellowBright = format(103, 49);
|
|
176
|
-
var bgBlueBright = format(104, 49);
|
|
177
|
-
var bgMagentaBright = format(105, 49);
|
|
178
|
-
var bgCyanBright = format(106, 49);
|
|
179
|
-
var bgWhiteBright = format(107, 49);
|
|
180
|
-
|
|
181
|
-
// node_modules/.pnpm/is-unicode-supported@2.1.0/node_modules/is-unicode-supported/index.js
|
|
182
|
-
import process2 from "node:process";
|
|
183
|
-
function isUnicodeSupported() {
|
|
184
|
-
const { env } = process2;
|
|
185
|
-
const { TERM, TERM_PROGRAM } = env;
|
|
186
|
-
if (process2.platform !== "win32") {
|
|
187
|
-
return TERM !== "linux";
|
|
188
|
-
}
|
|
189
|
-
return Boolean(env.WT_SESSION) || Boolean(env.TERMINUS_SUBLIME) || env.ConEmuTask === "{cmd::Cmder}" || TERM_PROGRAM === "Terminus-Sublime" || TERM_PROGRAM === "vscode" || TERM === "xterm-256color" || TERM === "alacritty" || TERM === "rxvt-unicode" || TERM === "rxvt-unicode-256color" || env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
// node_modules/.pnpm/log-symbols@7.0.0/node_modules/log-symbols/symbols.js
|
|
193
|
-
var _isUnicodeSupported = isUnicodeSupported();
|
|
194
|
-
var info = blue(_isUnicodeSupported ? "\u2139" : "i");
|
|
195
|
-
var success = green(_isUnicodeSupported ? "\u2714" : "\u221A");
|
|
196
|
-
var warning = yellow(_isUnicodeSupported ? "\u26A0" : "\u203C");
|
|
197
|
-
var error = red(_isUnicodeSupported ? "\u2716\uFE0F" : "\xD7");
|
|
198
|
-
|
|
199
|
-
// src/release-type.ts
|
|
200
|
-
var prereleaseTypes = ["premajor", "preminor", "prepatch", "prerelease"];
|
|
201
|
-
var releaseTypes = prereleaseTypes.concat(["major", "minor", "patch", "next", "conventional"]);
|
|
202
|
-
function isPrerelease(value) {
|
|
203
|
-
return prereleaseTypes.includes(value);
|
|
204
|
-
}
|
|
205
|
-
function isReleaseType(value) {
|
|
206
|
-
return releaseTypes.includes(value);
|
|
207
|
-
}
|
|
1
|
+
import process$1 from 'node:process';
|
|
2
|
+
import prompts from 'prompts';
|
|
3
|
+
import { execSync } from 'node:child_process';
|
|
4
|
+
import { x } from 'tinyexec';
|
|
5
|
+
import semver, { valid, SemVer, clean } from 'semver';
|
|
6
|
+
import fs, { existsSync } from 'node:fs';
|
|
7
|
+
import * as path from 'node:path';
|
|
8
|
+
import path__default, { dirname } from 'node:path';
|
|
9
|
+
import * as jsonc from 'jsonc-parser';
|
|
10
|
+
import fs$1 from 'node:fs/promises';
|
|
11
|
+
import yaml from 'js-yaml';
|
|
12
|
+
import { glob } from 'tinyglobby';
|
|
13
|
+
import { loadConfig } from 'c12';
|
|
14
|
+
import escalade from 'escalade/sync';
|
|
208
15
|
|
|
209
|
-
// src/
|
|
210
|
-
var ProgressEvent = /* @__PURE__ */ ((ProgressEvent2) => {
|
|
211
|
-
ProgressEvent2["FileUpdated"] = "file updated";
|
|
212
|
-
ProgressEvent2["FileSkipped"] = "file skipped";
|
|
213
|
-
ProgressEvent2["GitCommit"] = "git commit";
|
|
214
|
-
ProgressEvent2["GitTag"] = "git tag";
|
|
215
|
-
ProgressEvent2["GitPush"] = "git push";
|
|
216
|
-
ProgressEvent2["NpmScript"] = "npm script";
|
|
217
|
-
return ProgressEvent2;
|
|
218
|
-
})(ProgressEvent || {});
|
|
219
|
-
var NpmScript = /* @__PURE__ */ ((NpmScript2) => {
|
|
220
|
-
NpmScript2["PreVersion"] = "preversion";
|
|
221
|
-
NpmScript2["Version"] = "version";
|
|
222
|
-
NpmScript2["PostVersion"] = "postversion";
|
|
223
|
-
return NpmScript2;
|
|
224
|
-
})(NpmScript || {});
|
|
225
|
-
|
|
226
|
-
// src/version-bump.ts
|
|
227
|
-
import process5 from "node:process";
|
|
228
|
-
|
|
229
|
-
// node_modules/.pnpm/args-tokenizer@0.3.0/node_modules/args-tokenizer/dist/args-tokenizer.js
|
|
16
|
+
// src/args-tokenizer.ts
|
|
230
17
|
var spaceRegex = /\s/;
|
|
231
18
|
var tokenizeArgs = (argsString, options) => {
|
|
232
19
|
const tokens = [];
|
|
@@ -246,7 +33,7 @@ var tokenizeArgs = (argsString, options) => {
|
|
|
246
33
|
escaped = true;
|
|
247
34
|
continue;
|
|
248
35
|
}
|
|
249
|
-
if (openningQuote ===
|
|
36
|
+
if (openningQuote === undefined && spaceRegex.test(char)) {
|
|
250
37
|
if (currentToken.length > 0) {
|
|
251
38
|
tokens.push(currentToken);
|
|
252
39
|
currentToken = "";
|
|
@@ -254,12 +41,12 @@ var tokenizeArgs = (argsString, options) => {
|
|
|
254
41
|
continue;
|
|
255
42
|
}
|
|
256
43
|
if (char === "'" || char === '"') {
|
|
257
|
-
if (openningQuote ===
|
|
44
|
+
if (openningQuote === undefined) {
|
|
258
45
|
openningQuote = char;
|
|
259
46
|
continue;
|
|
260
47
|
}
|
|
261
48
|
if (openningQuote === char) {
|
|
262
|
-
openningQuote =
|
|
49
|
+
openningQuote = undefined;
|
|
263
50
|
continue;
|
|
264
51
|
}
|
|
265
52
|
}
|
|
@@ -268,28 +55,190 @@ var tokenizeArgs = (argsString, options) => {
|
|
|
268
55
|
if (currentToken.length > 0) {
|
|
269
56
|
tokens.push(currentToken);
|
|
270
57
|
}
|
|
271
|
-
if (options?.loose) {
|
|
272
|
-
return tokens;
|
|
273
|
-
}
|
|
274
58
|
if (openningQuote) {
|
|
275
59
|
throw Error("Unexpected end of string. Closing quote is missing.");
|
|
276
60
|
}
|
|
277
61
|
return tokens;
|
|
278
62
|
};
|
|
279
63
|
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
64
|
+
const info = 'ℹ️';
|
|
65
|
+
const success = '✅';
|
|
66
|
+
|
|
67
|
+
function getDefaultExportFromCjs (x) {
|
|
68
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
var picocolors = {exports: {}};
|
|
72
|
+
|
|
73
|
+
var hasRequiredPicocolors;
|
|
74
|
+
|
|
75
|
+
function requirePicocolors () {
|
|
76
|
+
if (hasRequiredPicocolors) return picocolors.exports;
|
|
77
|
+
hasRequiredPicocolors = 1;
|
|
78
|
+
let p = process || {}, argv = p.argv || [], env = p.env || {};
|
|
79
|
+
let isColorSupported =
|
|
80
|
+
!(!!env.NO_COLOR || argv.includes("--no-color")) &&
|
|
81
|
+
(!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || ((p.stdout || {}).isTTY && env.TERM !== "dumb") || !!env.CI);
|
|
82
|
+
|
|
83
|
+
let formatter = (open, close, replace = open) =>
|
|
84
|
+
input => {
|
|
85
|
+
let string = "" + input, index = string.indexOf(close, open.length);
|
|
86
|
+
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
let replaceClose = (string, close, replace, index) => {
|
|
90
|
+
let result = "", cursor = 0;
|
|
91
|
+
do {
|
|
92
|
+
result += string.substring(cursor, index) + replace;
|
|
93
|
+
cursor = index + close.length;
|
|
94
|
+
index = string.indexOf(close, cursor);
|
|
95
|
+
} while (~index)
|
|
96
|
+
return result + string.substring(cursor)
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
let createColors = (enabled = isColorSupported) => {
|
|
100
|
+
let f = enabled ? formatter : () => String;
|
|
101
|
+
return {
|
|
102
|
+
isColorSupported: enabled,
|
|
103
|
+
reset: f("\x1b[0m", "\x1b[0m"),
|
|
104
|
+
bold: f("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m"),
|
|
105
|
+
dim: f("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m"),
|
|
106
|
+
italic: f("\x1b[3m", "\x1b[23m"),
|
|
107
|
+
underline: f("\x1b[4m", "\x1b[24m"),
|
|
108
|
+
inverse: f("\x1b[7m", "\x1b[27m"),
|
|
109
|
+
hidden: f("\x1b[8m", "\x1b[28m"),
|
|
110
|
+
strikethrough: f("\x1b[9m", "\x1b[29m"),
|
|
285
111
|
|
|
286
|
-
|
|
287
|
-
|
|
112
|
+
black: f("\x1b[30m", "\x1b[39m"),
|
|
113
|
+
red: f("\x1b[31m", "\x1b[39m"),
|
|
114
|
+
green: f("\x1b[32m", "\x1b[39m"),
|
|
115
|
+
yellow: f("\x1b[33m", "\x1b[39m"),
|
|
116
|
+
blue: f("\x1b[34m", "\x1b[39m"),
|
|
117
|
+
magenta: f("\x1b[35m", "\x1b[39m"),
|
|
118
|
+
cyan: f("\x1b[36m", "\x1b[39m"),
|
|
119
|
+
white: f("\x1b[37m", "\x1b[39m"),
|
|
120
|
+
gray: f("\x1b[90m", "\x1b[39m"),
|
|
121
|
+
|
|
122
|
+
bgBlack: f("\x1b[40m", "\x1b[49m"),
|
|
123
|
+
bgRed: f("\x1b[41m", "\x1b[49m"),
|
|
124
|
+
bgGreen: f("\x1b[42m", "\x1b[49m"),
|
|
125
|
+
bgYellow: f("\x1b[43m", "\x1b[49m"),
|
|
126
|
+
bgBlue: f("\x1b[44m", "\x1b[49m"),
|
|
127
|
+
bgMagenta: f("\x1b[45m", "\x1b[49m"),
|
|
128
|
+
bgCyan: f("\x1b[46m", "\x1b[49m"),
|
|
129
|
+
bgWhite: f("\x1b[47m", "\x1b[49m"),
|
|
130
|
+
|
|
131
|
+
blackBright: f("\x1b[90m", "\x1b[39m"),
|
|
132
|
+
redBright: f("\x1b[91m", "\x1b[39m"),
|
|
133
|
+
greenBright: f("\x1b[92m", "\x1b[39m"),
|
|
134
|
+
yellowBright: f("\x1b[93m", "\x1b[39m"),
|
|
135
|
+
blueBright: f("\x1b[94m", "\x1b[39m"),
|
|
136
|
+
magentaBright: f("\x1b[95m", "\x1b[39m"),
|
|
137
|
+
cyanBright: f("\x1b[96m", "\x1b[39m"),
|
|
138
|
+
whiteBright: f("\x1b[97m", "\x1b[39m"),
|
|
139
|
+
|
|
140
|
+
bgBlackBright: f("\x1b[100m", "\x1b[49m"),
|
|
141
|
+
bgRedBright: f("\x1b[101m", "\x1b[49m"),
|
|
142
|
+
bgGreenBright: f("\x1b[102m", "\x1b[49m"),
|
|
143
|
+
bgYellowBright: f("\x1b[103m", "\x1b[49m"),
|
|
144
|
+
bgBlueBright: f("\x1b[104m", "\x1b[49m"),
|
|
145
|
+
bgMagentaBright: f("\x1b[105m", "\x1b[49m"),
|
|
146
|
+
bgCyanBright: f("\x1b[106m", "\x1b[49m"),
|
|
147
|
+
bgWhiteBright: f("\x1b[107m", "\x1b[49m"),
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
picocolors.exports = createColors();
|
|
152
|
+
picocolors.exports.createColors = createColors;
|
|
153
|
+
return picocolors.exports;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
var picocolorsExports = /*@__PURE__*/ requirePicocolors();
|
|
157
|
+
const c = /*@__PURE__*/getDefaultExportFromCjs(picocolorsExports);
|
|
158
|
+
|
|
159
|
+
function execCommand(cmd, options) {
|
|
160
|
+
try {
|
|
161
|
+
return execSync(cmd, { encoding: "utf8", cwd: options?.cwd }).trim();
|
|
162
|
+
} catch (error) {
|
|
163
|
+
return "";
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
function getLastGitTag() {
|
|
167
|
+
return execCommand("git describe --tags --abbrev=0")?.split("\n").at(0) || undefined;
|
|
168
|
+
}
|
|
169
|
+
const GIT_LOG_FORMAT = "%h|%s|%an|%ae|%ad|%b[GIT_LOG_COMMIT_END]";
|
|
170
|
+
function getGitLog(from, to = "HEAD") {
|
|
171
|
+
return execCommand(`git --no-pager log "${from ? `${from}...${to}` : to}" --pretty="${GIT_LOG_FORMAT}"`).split("[GIT_LOG_COMMIT_END]\n").filter(Boolean);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
const ConventionalCommitRegex = /(?<emoji>:.+:|(\uD83C[\uDF00-\uDFFF])|(\uD83D[\uDC00-\uDE4F\uDE80-\uDEFF])|[\u2600-\u2B55])?( *)(?<type>[a-z]+)(\((?<scope>.+)\))?(?<breaking>!)?: (?<description>.+)/i;
|
|
175
|
+
const CoAuthoredByRegex = /co-authored-by:\s*(?<name>.+)(<(?<email>.+)>)/gi;
|
|
176
|
+
const PullRequestRE = /\([ a-z]*(#\d+)\s*\)/g;
|
|
177
|
+
const IssueRE = /(#\d+)/g;
|
|
178
|
+
const BreakingRE = /breaking[ -]changes?:/i;
|
|
179
|
+
function parseRawCommit(commit) {
|
|
180
|
+
const [shortHash, message, authorName, authorEmail, data, ..._body] = commit.split("|");
|
|
181
|
+
const body = _body.filter(Boolean).join("\n");
|
|
182
|
+
return {
|
|
183
|
+
author: { name: authorName, email: authorEmail },
|
|
184
|
+
body,
|
|
185
|
+
data,
|
|
186
|
+
message,
|
|
187
|
+
shortHash
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
function parseCommit(rawCommit) {
|
|
191
|
+
const { shortHash, message, body, data } = rawCommit;
|
|
192
|
+
const match = message.match(ConventionalCommitRegex);
|
|
193
|
+
const isConventional = match !== null;
|
|
194
|
+
const type = match?.groups?.type || "";
|
|
195
|
+
const scope = match?.groups?.scope || "";
|
|
196
|
+
let description = match?.groups?.description || message;
|
|
197
|
+
const hasBreakingBody = BreakingRE.test(body);
|
|
198
|
+
const isBreaking = Boolean(match?.groups?.breaking || hasBreakingBody);
|
|
199
|
+
const references = [];
|
|
200
|
+
for (const m of description.matchAll(PullRequestRE)) {
|
|
201
|
+
references.push({ type: "pull-request", value: m[1] });
|
|
202
|
+
}
|
|
203
|
+
for (const m of description.matchAll(IssueRE)) {
|
|
204
|
+
if (!references.some((i) => i.value === m[1])) {
|
|
205
|
+
references.push({ type: "issue", value: m[1] });
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
description = description.replace(PullRequestRE, "").trim();
|
|
209
|
+
const authors = [rawCommit.author];
|
|
210
|
+
for (const match2 of body.matchAll(CoAuthoredByRegex)) {
|
|
211
|
+
authors.push({
|
|
212
|
+
name: (match2.groups?.name || "").trim(),
|
|
213
|
+
email: (match2.groups?.email || "").trim()
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
return {
|
|
217
|
+
authors,
|
|
218
|
+
body,
|
|
219
|
+
data,
|
|
220
|
+
description,
|
|
221
|
+
isBreaking,
|
|
222
|
+
isConventional,
|
|
223
|
+
message,
|
|
224
|
+
references,
|
|
225
|
+
scope,
|
|
226
|
+
shortHash,
|
|
227
|
+
type
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
function getCommits(from, to) {
|
|
232
|
+
return getGitLog(from, to).map(parseRawCommit).map(parseCommit);
|
|
233
|
+
}
|
|
234
|
+
function getRecentCommits(from, to) {
|
|
235
|
+
if (!from)
|
|
236
|
+
from = getLastGitTag();
|
|
237
|
+
if (!to)
|
|
238
|
+
to = "HEAD";
|
|
239
|
+
return getCommits(from, to);
|
|
240
|
+
}
|
|
288
241
|
|
|
289
|
-
// src/fs.ts
|
|
290
|
-
import fs from "node:fs";
|
|
291
|
-
import path from "node:path";
|
|
292
|
-
import * as jsonc from "jsonc-parser";
|
|
293
242
|
async function readJsoncFile(name, cwd) {
|
|
294
243
|
const file = await readTextFile(name, cwd);
|
|
295
244
|
const data = jsonc.parse(file.data);
|
|
@@ -306,7 +255,7 @@ async function writeJsoncFile(file) {
|
|
|
306
255
|
}
|
|
307
256
|
function readTextFile(name, cwd) {
|
|
308
257
|
return new Promise((resolve, reject) => {
|
|
309
|
-
const filePath =
|
|
258
|
+
const filePath = path__default.join(cwd, name);
|
|
310
259
|
fs.readFile(filePath, "utf8", (err, text) => {
|
|
311
260
|
if (err) {
|
|
312
261
|
reject(err);
|
|
@@ -330,7 +279,6 @@ function writeTextFile(file) {
|
|
|
330
279
|
});
|
|
331
280
|
}
|
|
332
281
|
|
|
333
|
-
// src/manifest.ts
|
|
334
282
|
function isManifest(obj) {
|
|
335
283
|
return obj && typeof obj === "object" && isOptionalString(obj.name) && isOptionalString(obj.version) && isOptionalString(obj.description);
|
|
336
284
|
}
|
|
@@ -342,7 +290,6 @@ function isOptionalString(value) {
|
|
|
342
290
|
return value === null || type === "undefined" || type === "string";
|
|
343
291
|
}
|
|
344
292
|
|
|
345
|
-
// src/get-current-version.ts
|
|
346
293
|
async function getCurrentVersion(operation) {
|
|
347
294
|
if (operation.state.currentVersion)
|
|
348
295
|
return operation;
|
|
@@ -371,19 +318,23 @@ async function readVersion(file, cwd) {
|
|
|
371
318
|
try {
|
|
372
319
|
const { data: manifest } = await readJsoncFile(file, cwd);
|
|
373
320
|
if (isManifest(manifest)) {
|
|
374
|
-
if (
|
|
321
|
+
if (valid(manifest.version))
|
|
375
322
|
return manifest.version;
|
|
376
323
|
}
|
|
377
324
|
} catch {
|
|
378
|
-
return
|
|
325
|
+
return undefined;
|
|
379
326
|
}
|
|
380
327
|
}
|
|
381
328
|
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
329
|
+
const prereleaseTypes = ["premajor", "preminor", "prepatch", "prerelease"];
|
|
330
|
+
const releaseTypes = prereleaseTypes.concat(["major", "minor", "patch", "next", "conventional"]);
|
|
331
|
+
function isPrerelease(value) {
|
|
332
|
+
return prereleaseTypes.includes(value);
|
|
333
|
+
}
|
|
334
|
+
function isReleaseType(value) {
|
|
335
|
+
return releaseTypes.includes(value);
|
|
336
|
+
}
|
|
337
|
+
|
|
387
338
|
async function getNewVersion(operation, commits) {
|
|
388
339
|
const { release } = operation.options;
|
|
389
340
|
const { currentVersion } = operation.state;
|
|
@@ -431,9 +382,9 @@ function determineSemverChange(commits) {
|
|
|
431
382
|
}
|
|
432
383
|
function getNextVersions(currentVersion, preid, commits) {
|
|
433
384
|
const next = {};
|
|
434
|
-
const
|
|
435
|
-
if (typeof
|
|
436
|
-
preid =
|
|
385
|
+
const parse = semver.parse(currentVersion);
|
|
386
|
+
if (typeof parse?.prerelease[0] === "string")
|
|
387
|
+
preid = parse?.prerelease[0] || "preid";
|
|
437
388
|
for (const type of releaseTypes)
|
|
438
389
|
next[type] = getNextVersion(currentVersion, { type, preid }, commits);
|
|
439
390
|
return next;
|
|
@@ -448,21 +399,21 @@ async function promptForNewVersion(operation, commits) {
|
|
|
448
399
|
{
|
|
449
400
|
type: "autocomplete",
|
|
450
401
|
name: "release",
|
|
451
|
-
message: `Current version ${
|
|
402
|
+
message: `Current version ${c.green(currentVersion)}`,
|
|
452
403
|
initial: configCustomVersion ? "config" : "next",
|
|
453
404
|
choices: [
|
|
454
|
-
{ value: "major", title: `${"major".padStart(PADDING, " ")} ${
|
|
455
|
-
{ value: "minor", title: `${"minor".padStart(PADDING, " ")} ${
|
|
456
|
-
{ value: "patch", title: `${"patch".padStart(PADDING, " ")} ${
|
|
457
|
-
{ value: "next", title: `${"next".padStart(PADDING, " ")} ${
|
|
458
|
-
{ value: "conventional", title: `${"conventional".padStart(PADDING, " ")} ${
|
|
405
|
+
{ value: "major", title: `${"major".padStart(PADDING, " ")} ${c.bold(next.major)}` },
|
|
406
|
+
{ value: "minor", title: `${"minor".padStart(PADDING, " ")} ${c.bold(next.minor)}` },
|
|
407
|
+
{ value: "patch", title: `${"patch".padStart(PADDING, " ")} ${c.bold(next.patch)}` },
|
|
408
|
+
{ value: "next", title: `${"next".padStart(PADDING, " ")} ${c.bold(next.next)}` },
|
|
409
|
+
{ value: "conventional", title: `${"conventional".padStart(PADDING, " ")} ${c.bold(next.conventional)}` },
|
|
459
410
|
...configCustomVersion ? [
|
|
460
|
-
{ value: "config", title: `${"from config".padStart(PADDING, " ")} ${
|
|
411
|
+
{ value: "config", title: `${"from config".padStart(PADDING, " ")} ${c.bold(configCustomVersion)}` }
|
|
461
412
|
] : [],
|
|
462
|
-
{ value: "prepatch", title: `${"pre-patch".padStart(PADDING, " ")} ${
|
|
463
|
-
{ value: "preminor", title: `${"pre-minor".padStart(PADDING, " ")} ${
|
|
464
|
-
{ value: "premajor", title: `${"pre-major".padStart(PADDING, " ")} ${
|
|
465
|
-
{ value: "none", title: `${"as-is".padStart(PADDING, " ")} ${
|
|
413
|
+
{ value: "prepatch", title: `${"pre-patch".padStart(PADDING, " ")} ${c.bold(next.prepatch)}` },
|
|
414
|
+
{ value: "preminor", title: `${"pre-minor".padStart(PADDING, " ")} ${c.bold(next.preminor)}` },
|
|
415
|
+
{ value: "premajor", title: `${"pre-major".padStart(PADDING, " ")} ${c.bold(next.premajor)}` },
|
|
416
|
+
{ value: "none", title: `${"as-is".padStart(PADDING, " ")} ${c.bold(currentVersion)}` },
|
|
466
417
|
{ value: "custom", title: "custom ...".padStart(PADDING + 4, " ") }
|
|
467
418
|
]
|
|
468
419
|
},
|
|
@@ -472,13 +423,13 @@ async function promptForNewVersion(operation, commits) {
|
|
|
472
423
|
message: "Enter the new version number:",
|
|
473
424
|
initial: currentVersion,
|
|
474
425
|
validate: (custom) => {
|
|
475
|
-
return
|
|
426
|
+
return valid(custom) ? true : "That's not a valid version number";
|
|
476
427
|
}
|
|
477
428
|
}
|
|
478
429
|
]);
|
|
479
|
-
const newVersion = answers.release === "none" ? currentVersion : answers.release === "custom" ?
|
|
430
|
+
const newVersion = answers.release === "none" ? currentVersion : answers.release === "custom" ? clean(answers.custom) : answers.release === "config" ? clean(configCustomVersion) : next[answers.release];
|
|
480
431
|
if (!newVersion)
|
|
481
|
-
|
|
432
|
+
process$1.exit(1);
|
|
482
433
|
switch (answers.release) {
|
|
483
434
|
case "custom":
|
|
484
435
|
case "config":
|
|
@@ -491,8 +442,22 @@ async function promptForNewVersion(operation, commits) {
|
|
|
491
442
|
}
|
|
492
443
|
}
|
|
493
444
|
|
|
494
|
-
|
|
495
|
-
|
|
445
|
+
var ProgressEvent = /* @__PURE__ */ ((ProgressEvent2) => {
|
|
446
|
+
ProgressEvent2["FileUpdated"] = "file updated";
|
|
447
|
+
ProgressEvent2["FileSkipped"] = "file skipped";
|
|
448
|
+
ProgressEvent2["GitCommit"] = "git commit";
|
|
449
|
+
ProgressEvent2["GitTag"] = "git tag";
|
|
450
|
+
ProgressEvent2["GitPush"] = "git push";
|
|
451
|
+
ProgressEvent2["NpmScript"] = "npm script";
|
|
452
|
+
return ProgressEvent2;
|
|
453
|
+
})(ProgressEvent || {});
|
|
454
|
+
var NpmScript = /* @__PURE__ */ ((NpmScript2) => {
|
|
455
|
+
NpmScript2["PreVersion"] = "preversion";
|
|
456
|
+
NpmScript2["Version"] = "version";
|
|
457
|
+
NpmScript2["PostVersion"] = "postversion";
|
|
458
|
+
return NpmScript2;
|
|
459
|
+
})(NpmScript || {});
|
|
460
|
+
|
|
496
461
|
async function gitCommit(operation) {
|
|
497
462
|
if (!operation.options.commit)
|
|
498
463
|
return operation;
|
|
@@ -513,7 +478,7 @@ async function gitCommit(operation) {
|
|
|
513
478
|
if (!all)
|
|
514
479
|
args = args.concat(updatedFiles);
|
|
515
480
|
await x("git", ["commit", ...args], { throwOnError: true });
|
|
516
|
-
return operation.update({ event:
|
|
481
|
+
return operation.update({ event: ProgressEvent.GitCommit, commitMessage });
|
|
517
482
|
}
|
|
518
483
|
async function gitTag(operation) {
|
|
519
484
|
if (!operation.options.tag)
|
|
@@ -534,7 +499,7 @@ async function gitTag(operation) {
|
|
|
534
499
|
args.push("--sign");
|
|
535
500
|
}
|
|
536
501
|
await x("git", ["tag", ...args], { throwOnError: true });
|
|
537
|
-
return operation.update({ event:
|
|
502
|
+
return operation.update({ event: ProgressEvent.GitTag, tagName });
|
|
538
503
|
}
|
|
539
504
|
async function gitPush(operation) {
|
|
540
505
|
if (!operation.options.push)
|
|
@@ -543,7 +508,7 @@ async function gitPush(operation) {
|
|
|
543
508
|
if (operation.options.tag) {
|
|
544
509
|
await x("git", ["push", "--tags"], { throwOnError: true });
|
|
545
510
|
}
|
|
546
|
-
return operation.update({ event:
|
|
511
|
+
return operation.update({ event: ProgressEvent.GitPush });
|
|
547
512
|
}
|
|
548
513
|
function formatVersionString(template, newVersion) {
|
|
549
514
|
if (template.includes("%s"))
|
|
@@ -552,12 +517,6 @@ function formatVersionString(template, newVersion) {
|
|
|
552
517
|
return template + newVersion;
|
|
553
518
|
}
|
|
554
519
|
|
|
555
|
-
// src/normalize-options.ts
|
|
556
|
-
import fsSync from "node:fs";
|
|
557
|
-
import fs2 from "node:fs/promises";
|
|
558
|
-
import process4 from "node:process";
|
|
559
|
-
import yaml from "js-yaml";
|
|
560
|
-
import { glob } from "tinyglobby";
|
|
561
520
|
async function normalizeOptions(raw) {
|
|
562
521
|
const preid = typeof raw.preid === "string" ? raw.preid : "beta";
|
|
563
522
|
const sign = Boolean(raw.sign);
|
|
@@ -565,7 +524,7 @@ async function normalizeOptions(raw) {
|
|
|
565
524
|
const all = Boolean(raw.all);
|
|
566
525
|
const install = Boolean(raw.install);
|
|
567
526
|
const noVerify = Boolean(raw.noVerify);
|
|
568
|
-
const cwd = raw.cwd ||
|
|
527
|
+
const cwd = raw.cwd || process$1.cwd();
|
|
569
528
|
const ignoreScripts = Boolean(raw.ignoreScripts);
|
|
570
529
|
const execute = raw.execute;
|
|
571
530
|
const recursive = Boolean(raw.recursive);
|
|
@@ -596,8 +555,8 @@ async function normalizeOptions(raw) {
|
|
|
596
555
|
"deno.json",
|
|
597
556
|
"deno.jsonc"
|
|
598
557
|
];
|
|
599
|
-
if (
|
|
600
|
-
const pnpmWorkspace = await
|
|
558
|
+
if (fs.existsSync("pnpm-workspace.yaml")) {
|
|
559
|
+
const pnpmWorkspace = await fs$1.readFile("pnpm-workspace.yaml", "utf8");
|
|
601
560
|
const workspaces = yaml.load(pnpmWorkspace);
|
|
602
561
|
const workspacesWithPackageJson = workspaces.packages.map((workspace) => `${workspace}/package.json`);
|
|
603
562
|
const withoutExcludedWorkspaces = workspacesWithPackageJson.filter((workspace) => !workspace.startsWith("!") && !raw.files?.includes(workspace));
|
|
@@ -621,13 +580,13 @@ async function normalizeOptions(raw) {
|
|
|
621
580
|
if (raw.interface === false) {
|
|
622
581
|
ui = { input: false, output: false };
|
|
623
582
|
} else if (raw.interface === true || !raw.interface) {
|
|
624
|
-
ui = { input:
|
|
583
|
+
ui = { input: process$1.stdin, output: process$1.stdout };
|
|
625
584
|
} else {
|
|
626
585
|
let { input, output, ...other } = raw.interface;
|
|
627
586
|
if (input === true || input !== false && !input)
|
|
628
|
-
input =
|
|
587
|
+
input = process$1.stdin;
|
|
629
588
|
if (output === true || output !== false && !output)
|
|
630
|
-
output =
|
|
589
|
+
output = process$1.stdout;
|
|
631
590
|
ui = { input, output, ...other };
|
|
632
591
|
}
|
|
633
592
|
if (release.type === "prompt" && !(ui.input && ui.output))
|
|
@@ -650,8 +609,7 @@ async function normalizeOptions(raw) {
|
|
|
650
609
|
};
|
|
651
610
|
}
|
|
652
611
|
|
|
653
|
-
|
|
654
|
-
var Operation = class _Operation {
|
|
612
|
+
class Operation {
|
|
655
613
|
/**
|
|
656
614
|
* The options for this operation.
|
|
657
615
|
*/
|
|
@@ -660,7 +618,7 @@ var Operation = class _Operation {
|
|
|
660
618
|
* The current state of the operation.
|
|
661
619
|
*/
|
|
662
620
|
state = {
|
|
663
|
-
release:
|
|
621
|
+
release: undefined,
|
|
664
622
|
currentVersion: "",
|
|
665
623
|
currentVersionSource: "",
|
|
666
624
|
newVersion: "",
|
|
@@ -707,7 +665,7 @@ var Operation = class _Operation {
|
|
|
707
665
|
*/
|
|
708
666
|
static async start(input) {
|
|
709
667
|
const options = await normalizeOptions(input);
|
|
710
|
-
return new
|
|
668
|
+
return new Operation(options, input.progress);
|
|
711
669
|
}
|
|
712
670
|
/**
|
|
713
671
|
* Updates the operation state and results, and reports the updated progress to the user.
|
|
@@ -719,64 +677,62 @@ var Operation = class _Operation {
|
|
|
719
677
|
}
|
|
720
678
|
return this;
|
|
721
679
|
}
|
|
722
|
-
}
|
|
680
|
+
}
|
|
723
681
|
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
revert: import_picocolors2.default.red,
|
|
744
|
-
breaking: import_picocolors2.default.red
|
|
682
|
+
const messageColorMap = {
|
|
683
|
+
feat: c.green,
|
|
684
|
+
feature: c.green,
|
|
685
|
+
refactor: c.cyan,
|
|
686
|
+
style: c.cyan,
|
|
687
|
+
docs: c.blue,
|
|
688
|
+
doc: c.blue,
|
|
689
|
+
types: c.blue,
|
|
690
|
+
type: c.blue,
|
|
691
|
+
chore: c.gray,
|
|
692
|
+
ci: c.gray,
|
|
693
|
+
build: c.gray,
|
|
694
|
+
deps: c.gray,
|
|
695
|
+
dev: c.gray,
|
|
696
|
+
fix: c.yellow,
|
|
697
|
+
test: c.yellow,
|
|
698
|
+
perf: c.magenta,
|
|
699
|
+
revert: c.red,
|
|
700
|
+
breaking: c.red
|
|
745
701
|
};
|
|
746
702
|
function formatParsedCommits(commits) {
|
|
747
703
|
const typeLength = commits.map(({ type }) => type.length).reduce((a, b) => Math.max(a, b), 0);
|
|
748
704
|
const scopeLength = commits.map(({ scope }) => scope.length).reduce((a, b) => Math.max(a, b), 0);
|
|
749
705
|
return commits.map((commit) => {
|
|
750
|
-
let color = messageColorMap[commit.type] || ((
|
|
706
|
+
let color = messageColorMap[commit.type] || ((c2) => c2);
|
|
751
707
|
if (commit.isBreaking) {
|
|
752
|
-
color = (s) =>
|
|
708
|
+
color = (s) => c.inverse(c.red(s));
|
|
753
709
|
}
|
|
754
710
|
const paddedType = commit.type.padStart(typeLength + 1, " ");
|
|
755
|
-
const paddedScope = !commit.scope ? " ".repeat(scopeLength ? scopeLength + 2 : 0) :
|
|
711
|
+
const paddedScope = !commit.scope ? " ".repeat(scopeLength ? scopeLength + 2 : 0) : c.dim("(") + commit.scope + c.dim(")") + " ".repeat(scopeLength - commit.scope.length);
|
|
756
712
|
return [
|
|
757
|
-
|
|
713
|
+
c.dim(commit.shortHash),
|
|
758
714
|
" ",
|
|
759
|
-
color ===
|
|
715
|
+
color === c.gray ? color(paddedType) : c.bold(color(paddedType)),
|
|
760
716
|
" ",
|
|
761
717
|
paddedScope,
|
|
762
|
-
|
|
718
|
+
c.dim(":"),
|
|
763
719
|
" ",
|
|
764
|
-
color ===
|
|
720
|
+
color === c.gray ? color(commit.description) : commit.description
|
|
765
721
|
].join("");
|
|
766
722
|
});
|
|
767
723
|
}
|
|
768
724
|
function printRecentCommits(commits) {
|
|
769
725
|
if (!commits.length) {
|
|
770
726
|
console.log();
|
|
771
|
-
console.log(
|
|
727
|
+
console.log(c.blue(`i`) + c.gray(` No commits since the last version`));
|
|
772
728
|
console.log();
|
|
773
729
|
return;
|
|
774
730
|
}
|
|
775
731
|
const prettified = formatParsedCommits(commits);
|
|
776
732
|
console.log();
|
|
777
733
|
console.log(
|
|
778
|
-
|
|
779
|
-
`${
|
|
734
|
+
c.bold(
|
|
735
|
+
`${c.green(commits.length)} Commits since the last version:`
|
|
780
736
|
)
|
|
781
737
|
);
|
|
782
738
|
console.log();
|
|
@@ -784,17 +740,15 @@ function printRecentCommits(commits) {
|
|
|
784
740
|
console.log();
|
|
785
741
|
}
|
|
786
742
|
|
|
787
|
-
// src/run-npm-script.ts
|
|
788
|
-
import { x as x2 } from "tinyexec";
|
|
789
743
|
async function runNpmScript(script, operation) {
|
|
790
744
|
const { cwd, ignoreScripts } = operation.options;
|
|
791
745
|
if (!ignoreScripts) {
|
|
792
746
|
const { data: manifest } = await readJsoncFile("package.json", cwd);
|
|
793
747
|
if (isManifest(manifest) && hasScript(manifest, script)) {
|
|
794
|
-
await
|
|
748
|
+
await x("npm", ["run", script, "--silent"], {
|
|
795
749
|
nodeOptions: { stdio: "inherit" }
|
|
796
750
|
});
|
|
797
|
-
operation.update({ event:
|
|
751
|
+
operation.update({ event: ProgressEvent.NpmScript, script });
|
|
798
752
|
}
|
|
799
753
|
}
|
|
800
754
|
return operation;
|
|
@@ -806,21 +760,18 @@ function hasScript(manifest, script) {
|
|
|
806
760
|
return false;
|
|
807
761
|
}
|
|
808
762
|
|
|
809
|
-
// src/update-files.ts
|
|
810
|
-
import { existsSync } from "node:fs";
|
|
811
|
-
import * as path2 from "node:path";
|
|
812
763
|
async function updateFiles(operation) {
|
|
813
764
|
const { files } = operation.options;
|
|
814
765
|
for (const relPath of files) {
|
|
815
766
|
const modified = await updateFile(relPath, operation);
|
|
816
767
|
if (modified) {
|
|
817
768
|
operation.update({
|
|
818
|
-
event:
|
|
769
|
+
event: ProgressEvent.FileUpdated,
|
|
819
770
|
updatedFiles: operation.state.updatedFiles.concat(relPath)
|
|
820
771
|
});
|
|
821
772
|
} else {
|
|
822
773
|
operation.update({
|
|
823
|
-
event:
|
|
774
|
+
event: ProgressEvent.FileSkipped,
|
|
824
775
|
skippedFiles: operation.state.skippedFiles.concat(relPath)
|
|
825
776
|
});
|
|
826
777
|
}
|
|
@@ -828,10 +779,10 @@ async function updateFiles(operation) {
|
|
|
828
779
|
return operation;
|
|
829
780
|
}
|
|
830
781
|
async function updateFile(relPath, operation) {
|
|
831
|
-
if (!existsSync(
|
|
782
|
+
if (!existsSync(path.join(operation.options.cwd, relPath))) {
|
|
832
783
|
return false;
|
|
833
784
|
}
|
|
834
|
-
const name =
|
|
785
|
+
const name = path.basename(relPath).trim().toLowerCase();
|
|
835
786
|
switch (name) {
|
|
836
787
|
case "package.json":
|
|
837
788
|
case "package-lock.json":
|
|
@@ -881,7 +832,6 @@ async function updateTextFile(relPath, operation) {
|
|
|
881
832
|
return modified;
|
|
882
833
|
}
|
|
883
834
|
|
|
884
|
-
// src/version-bump.ts
|
|
885
835
|
async function versionBump(arg = {}) {
|
|
886
836
|
if (typeof arg === "string")
|
|
887
837
|
arg = { release: arg };
|
|
@@ -894,77 +844,77 @@ async function versionBump(arg = {}) {
|
|
|
894
844
|
await getNewVersion(operation, commits);
|
|
895
845
|
if (arg.confirm) {
|
|
896
846
|
printSummary(operation);
|
|
897
|
-
if (!await
|
|
847
|
+
if (!await prompts({
|
|
898
848
|
name: "yes",
|
|
899
849
|
type: "confirm",
|
|
900
850
|
message: "Bump?",
|
|
901
851
|
initial: true
|
|
902
852
|
}).then((r) => r.yes)) {
|
|
903
|
-
|
|
853
|
+
process$1.exit(1);
|
|
904
854
|
}
|
|
905
855
|
}
|
|
906
|
-
await runNpmScript(
|
|
856
|
+
await runNpmScript(NpmScript.PreVersion, operation);
|
|
907
857
|
await updateFiles(operation);
|
|
908
858
|
if (operation.options.install) {
|
|
909
|
-
const { detect } = await import(
|
|
859
|
+
const { detect } = await import('package-manager-detector/detect');
|
|
910
860
|
const pm = await detect();
|
|
911
861
|
if (!pm?.name) {
|
|
912
862
|
throw new Error("Could not detect package manager, failed to run npm install");
|
|
913
863
|
}
|
|
914
|
-
const { COMMANDS, constructCommand } = await import(
|
|
864
|
+
const { COMMANDS, constructCommand } = await import('package-manager-detector/commands');
|
|
915
865
|
const command = constructCommand(COMMANDS[pm.name].install, []);
|
|
916
866
|
if (!command) {
|
|
917
867
|
throw new Error("Could not find install command for package manager");
|
|
918
868
|
}
|
|
919
|
-
console.log(
|
|
920
|
-
await
|
|
869
|
+
console.log(info, "Installing dependencies with", `${command.command} ${command.args.join(" ")}`);
|
|
870
|
+
await x(command.command, command.args, {
|
|
921
871
|
throwOnError: true,
|
|
922
872
|
nodeOptions: {
|
|
923
873
|
stdio: "inherit",
|
|
924
874
|
cwd: operation.options.cwd
|
|
925
875
|
}
|
|
926
876
|
});
|
|
927
|
-
console.log(
|
|
877
|
+
console.log(success, "Dependencies installed");
|
|
928
878
|
}
|
|
929
879
|
if (operation.options.execute) {
|
|
930
880
|
if (typeof operation.options.execute === "function") {
|
|
931
881
|
await operation.options.execute(operation);
|
|
932
882
|
} else {
|
|
933
883
|
const [command, ...args] = tokenizeArgs(operation.options.execute);
|
|
934
|
-
console.log(
|
|
935
|
-
await
|
|
884
|
+
console.log(info, "Executing script", command, ...args);
|
|
885
|
+
await x(command, args, {
|
|
936
886
|
throwOnError: true,
|
|
937
887
|
nodeOptions: {
|
|
938
888
|
stdio: "inherit",
|
|
939
889
|
cwd: operation.options.cwd
|
|
940
890
|
}
|
|
941
891
|
});
|
|
942
|
-
console.log(
|
|
892
|
+
console.log(success, "Script finished");
|
|
943
893
|
}
|
|
944
894
|
}
|
|
945
|
-
await runNpmScript(
|
|
895
|
+
await runNpmScript(NpmScript.Version, operation);
|
|
946
896
|
await gitCommit(operation);
|
|
947
897
|
await gitTag(operation);
|
|
948
|
-
await runNpmScript(
|
|
898
|
+
await runNpmScript(NpmScript.PostVersion, operation);
|
|
949
899
|
await gitPush(operation);
|
|
950
900
|
return operation.results;
|
|
951
901
|
}
|
|
952
902
|
function printSummary(operation) {
|
|
953
903
|
console.log();
|
|
954
|
-
console.log(` files ${operation.options.files.map((i) =>
|
|
904
|
+
console.log(` files ${operation.options.files.map((i) => c.bold(i)).join("\n ")}`);
|
|
955
905
|
if (operation.options.commit)
|
|
956
|
-
console.log(` commit ${
|
|
906
|
+
console.log(` commit ${c.bold(formatVersionString(operation.options.commit.message, operation.state.newVersion))}`);
|
|
957
907
|
if (operation.options.tag)
|
|
958
|
-
console.log(` tag ${
|
|
908
|
+
console.log(` tag ${c.bold(formatVersionString(operation.options.tag.name, operation.state.newVersion))}`);
|
|
959
909
|
if (operation.options.execute)
|
|
960
|
-
console.log(` execute ${
|
|
910
|
+
console.log(` execute ${c.bold(typeof operation.options.execute === "function" ? "function" : operation.options.execute)}`);
|
|
961
911
|
if (operation.options.push)
|
|
962
|
-
console.log(` push ${
|
|
912
|
+
console.log(` push ${c.cyan(c.bold("yes"))}`);
|
|
963
913
|
if (operation.options.install)
|
|
964
|
-
console.log(` install ${
|
|
914
|
+
console.log(` install ${c.cyan(c.bold("yes"))}`);
|
|
965
915
|
console.log();
|
|
966
|
-
console.log(` from ${
|
|
967
|
-
console.log(` to ${
|
|
916
|
+
console.log(` from ${c.bold(operation.state.currentVersion)}`);
|
|
917
|
+
console.log(` to ${c.green(c.bold(operation.state.newVersion))}`);
|
|
968
918
|
console.log();
|
|
969
919
|
}
|
|
970
920
|
async function versionBumpInfo(arg = {}) {
|
|
@@ -977,12 +927,7 @@ async function versionBumpInfo(arg = {}) {
|
|
|
977
927
|
return operation;
|
|
978
928
|
}
|
|
979
929
|
|
|
980
|
-
|
|
981
|
-
import { dirname } from "node:path";
|
|
982
|
-
import process6 from "node:process";
|
|
983
|
-
import { loadConfig } from "c12";
|
|
984
|
-
import escalade from "escalade/sync";
|
|
985
|
-
var bumpConfigDefaults = {
|
|
930
|
+
const bumpConfigDefaults = {
|
|
986
931
|
commit: true,
|
|
987
932
|
push: true,
|
|
988
933
|
tag: true,
|
|
@@ -996,7 +941,7 @@ var bumpConfigDefaults = {
|
|
|
996
941
|
noGitCheck: true,
|
|
997
942
|
files: []
|
|
998
943
|
};
|
|
999
|
-
async function loadBumpConfig(overrides, cwd =
|
|
944
|
+
async function loadBumpConfig(overrides, cwd = process$1.cwd()) {
|
|
1000
945
|
const name = "bump";
|
|
1001
946
|
const configFile = findConfigFile(name, cwd);
|
|
1002
947
|
const { config } = await loadConfig({
|
|
@@ -1028,26 +973,14 @@ function findConfigFile(name, cwd) {
|
|
|
1028
973
|
}
|
|
1029
974
|
return false;
|
|
1030
975
|
});
|
|
1031
|
-
} catch (
|
|
976
|
+
} catch (error) {
|
|
1032
977
|
if (foundRepositoryRoot)
|
|
1033
978
|
return null;
|
|
1034
|
-
throw
|
|
979
|
+
throw error;
|
|
1035
980
|
}
|
|
1036
981
|
}
|
|
1037
982
|
function defineConfig(config) {
|
|
1038
983
|
return config;
|
|
1039
984
|
}
|
|
1040
985
|
|
|
1041
|
-
export {
|
|
1042
|
-
__toESM,
|
|
1043
|
-
symbols_exports,
|
|
1044
|
-
require_picocolors,
|
|
1045
|
-
isReleaseType,
|
|
1046
|
-
ProgressEvent,
|
|
1047
|
-
NpmScript,
|
|
1048
|
-
versionBump,
|
|
1049
|
-
versionBumpInfo,
|
|
1050
|
-
bumpConfigDefaults,
|
|
1051
|
-
loadBumpConfig,
|
|
1052
|
-
defineConfig
|
|
1053
|
-
};
|
|
986
|
+
export { NpmScript as N, ProgressEvent as P, versionBumpInfo as a, bumpConfigDefaults as b, c, defineConfig as d, info as e, isReleaseType as i, loadBumpConfig as l, success as s, versionBump as v };
|