bumpp 9.2.0 → 9.3.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/README.md +4 -3
- package/dist/{chunk-UEJT3NCU.mjs → chunk-ZY4OVS4D.mjs} +29 -13
- package/dist/cli/index.d.mts +0 -2
- package/dist/cli/index.d.ts +0 -2
- package/dist/cli/index.js +57 -27
- package/dist/cli/index.mjs +20 -5
- package/dist/index.d.mts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +37 -23
- package/dist/index.mjs +2 -3
- package/package.json +17 -15
package/README.md
CHANGED
|
@@ -9,14 +9,15 @@ Forked from [`version-bump-prompt`](https://github.com/JS-DevTools/version-bump-
|
|
|
9
9
|
- Renamed to `bumpp` - so you can use `npx bumpp` directly.
|
|
10
10
|
- Ships ESM and CJS bundles.
|
|
11
11
|
- Add a new argument `--execute` to execute the command before committing.
|
|
12
|
-
- Use current version's `preid` when
|
|
12
|
+
- Use the current version's `preid` when available.
|
|
13
13
|
- Confirmation before bumping.
|
|
14
14
|
- Enable `--commit` `--tag` `--push` by default. (opt-out by `--no-push`, etc.)
|
|
15
15
|
- `-r` or `--recursive` to bump all packages in the monorepo.
|
|
16
|
-
- Conventional Commits by default.
|
|
17
|
-
- Supports config file `
|
|
16
|
+
- Conventional Commits by default.
|
|
17
|
+
- Supports config file `bump.config.ts`:
|
|
18
18
|
|
|
19
19
|
```ts
|
|
20
|
+
// bump.config.ts
|
|
20
21
|
import { defineConfig } from 'bumpp'
|
|
21
22
|
|
|
22
23
|
export default defineConfig({
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {createRequire as __createRequire} from 'module';var require=__createRequire(import.meta.url);
|
|
1
2
|
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __defProps = Object.defineProperties;
|
|
@@ -109,7 +110,7 @@ var require_picocolors = __commonJS({
|
|
|
109
110
|
}
|
|
110
111
|
});
|
|
111
112
|
|
|
112
|
-
// node_modules/.pnpm/chalk@5.
|
|
113
|
+
// node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
113
114
|
var ANSI_BACKGROUND_OFFSET = 10;
|
|
114
115
|
var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
|
115
116
|
var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
|
|
@@ -295,7 +296,7 @@ function assembleStyles() {
|
|
|
295
296
|
var ansiStyles = assembleStyles();
|
|
296
297
|
var ansi_styles_default = ansiStyles;
|
|
297
298
|
|
|
298
|
-
// node_modules/.pnpm/chalk@5.
|
|
299
|
+
// node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/supports-color/index.js
|
|
299
300
|
import process2 from "process";
|
|
300
301
|
import os from "os";
|
|
301
302
|
import tty from "tty";
|
|
@@ -369,7 +370,7 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
|
369
370
|
return 1;
|
|
370
371
|
}
|
|
371
372
|
if ("CI" in env) {
|
|
372
|
-
if ("GITHUB_ACTIONS" in env) {
|
|
373
|
+
if ("GITHUB_ACTIONS" in env || "GITEA_ACTIONS" in env) {
|
|
373
374
|
return 3;
|
|
374
375
|
}
|
|
375
376
|
if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
|
|
@@ -420,7 +421,7 @@ var supportsColor = {
|
|
|
420
421
|
};
|
|
421
422
|
var supports_color_default = supportsColor;
|
|
422
423
|
|
|
423
|
-
// node_modules/.pnpm/chalk@5.
|
|
424
|
+
// node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/utilities.js
|
|
424
425
|
function stringReplaceAll(string, substring, replacer) {
|
|
425
426
|
let index = string.indexOf(substring);
|
|
426
427
|
if (index === -1) {
|
|
@@ -450,7 +451,7 @@ function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
|
|
|
450
451
|
return returnValue;
|
|
451
452
|
}
|
|
452
453
|
|
|
453
|
-
// node_modules/.pnpm/chalk@5.
|
|
454
|
+
// node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/index.js
|
|
454
455
|
var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
|
|
455
456
|
var GENERATOR = Symbol("GENERATOR");
|
|
456
457
|
var STYLER = Symbol("STYLER");
|
|
@@ -605,7 +606,7 @@ function isUnicodeSupported() {
|
|
|
605
606
|
return Boolean(process3.env.CI) || Boolean(process3.env.WT_SESSION) || Boolean(process3.env.TERMINUS_SUBLIME) || process3.env.ConEmuTask === "{cmd::Cmder}" || process3.env.TERM_PROGRAM === "Terminus-Sublime" || process3.env.TERM_PROGRAM === "vscode" || process3.env.TERM === "xterm-256color" || process3.env.TERM === "alacritty" || process3.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
606
607
|
}
|
|
607
608
|
|
|
608
|
-
// node_modules/.pnpm/log-symbols@
|
|
609
|
+
// node_modules/.pnpm/log-symbols@6.0.0/node_modules/log-symbols/index.js
|
|
609
610
|
var main = {
|
|
610
611
|
info: source_default.blue("\u2139"),
|
|
611
612
|
success: source_default.green("\u2714"),
|
|
@@ -622,7 +623,6 @@ var logSymbols = isUnicodeSupported() ? main : fallback;
|
|
|
622
623
|
var log_symbols_default = logSymbols;
|
|
623
624
|
|
|
624
625
|
// src/release-type.ts
|
|
625
|
-
import { ReleaseType } from "semver";
|
|
626
626
|
var prereleaseTypes = ["premajor", "preminor", "prepatch", "prerelease"];
|
|
627
627
|
var releaseTypes = prereleaseTypes.concat(["major", "minor", "patch"]);
|
|
628
628
|
function isPrerelease(value) {
|
|
@@ -698,21 +698,26 @@ function getNextVersions(oldVersion, preid) {
|
|
|
698
698
|
return next;
|
|
699
699
|
}
|
|
700
700
|
async function promptForNewVersion(operation) {
|
|
701
|
+
var _a, _b;
|
|
701
702
|
const { oldVersion } = operation.state;
|
|
702
703
|
const release = operation.options.release;
|
|
703
704
|
const next = getNextVersions(oldVersion, release.preid);
|
|
705
|
+
const configCustomVersion = await ((_b = (_a = operation.options).customVersion) == null ? void 0 : _b.call(_a, oldVersion, semver));
|
|
704
706
|
const PADDING = 13;
|
|
705
707
|
const answers = await prompts([
|
|
706
708
|
{
|
|
707
709
|
type: "autocomplete",
|
|
708
710
|
name: "release",
|
|
709
711
|
message: `Current version ${import_picocolors.default.green(oldVersion)}`,
|
|
710
|
-
initial: "next",
|
|
712
|
+
initial: configCustomVersion ? "config" : "next",
|
|
711
713
|
choices: [
|
|
712
714
|
{ value: "major", title: `${"major".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.major)}` },
|
|
713
715
|
{ value: "minor", title: `${"minor".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.minor)}` },
|
|
714
716
|
{ value: "patch", title: `${"patch".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.patch)}` },
|
|
715
717
|
{ value: "next", title: `${"next".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.next)}` },
|
|
718
|
+
...configCustomVersion ? [
|
|
719
|
+
{ value: "config", title: `${"from config".padStart(PADDING, " ")} ${import_picocolors.default.bold(configCustomVersion)}` }
|
|
720
|
+
] : [],
|
|
716
721
|
{ value: "prepatch", title: `${"pre-patch".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.prepatch)}` },
|
|
717
722
|
{ value: "preminor", title: `${"pre-minor".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.preminor)}` },
|
|
718
723
|
{ value: "premajor", title: `${"pre-major".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.premajor)}` },
|
|
@@ -730,11 +735,12 @@ async function promptForNewVersion(operation) {
|
|
|
730
735
|
}
|
|
731
736
|
}
|
|
732
737
|
]);
|
|
733
|
-
const newVersion = answers.release === "none" ? oldVersion : answers.release === "custom" ? cleanVersion(answers.custom) : next[answers.release];
|
|
738
|
+
const newVersion = answers.release === "none" ? oldVersion : answers.release === "custom" ? cleanVersion(answers.custom) : answers.release === "config" ? cleanVersion(configCustomVersion) : next[answers.release];
|
|
734
739
|
if (!newVersion)
|
|
735
740
|
process4.exit(1);
|
|
736
741
|
switch (answers.release) {
|
|
737
742
|
case "custom":
|
|
743
|
+
case "config":
|
|
738
744
|
case "next":
|
|
739
745
|
case "none":
|
|
740
746
|
return operation.update({ newVersion });
|
|
@@ -850,7 +856,7 @@ function detectIndent(string) {
|
|
|
850
856
|
};
|
|
851
857
|
}
|
|
852
858
|
|
|
853
|
-
// node_modules/.pnpm/detect-newline@4.0.
|
|
859
|
+
// node_modules/.pnpm/detect-newline@4.0.1/node_modules/detect-newline/index.js
|
|
854
860
|
function detectNewline(string) {
|
|
855
861
|
if (typeof string !== "string") {
|
|
856
862
|
throw new TypeError("Expected a string");
|
|
@@ -951,7 +957,7 @@ async function gitCommit(operation) {
|
|
|
951
957
|
return operation;
|
|
952
958
|
const { all, noVerify, message } = operation.options.commit;
|
|
953
959
|
const { updatedFiles, newVersion } = operation.state;
|
|
954
|
-
let args = [];
|
|
960
|
+
let args = ["--allow-empty"];
|
|
955
961
|
if (all) {
|
|
956
962
|
args.push("--all");
|
|
957
963
|
}
|
|
@@ -1053,7 +1059,18 @@ async function normalizeOptions(raw) {
|
|
|
1053
1059
|
}
|
|
1054
1060
|
if (release.type === "prompt" && !(ui.input && ui.output))
|
|
1055
1061
|
throw new Error("Cannot prompt for the version number because input or output has been disabled.");
|
|
1056
|
-
return {
|
|
1062
|
+
return {
|
|
1063
|
+
release,
|
|
1064
|
+
commit,
|
|
1065
|
+
tag,
|
|
1066
|
+
push,
|
|
1067
|
+
files,
|
|
1068
|
+
cwd,
|
|
1069
|
+
interface: ui,
|
|
1070
|
+
ignoreScripts,
|
|
1071
|
+
execute,
|
|
1072
|
+
customVersion: raw.customVersion
|
|
1073
|
+
};
|
|
1057
1074
|
}
|
|
1058
1075
|
|
|
1059
1076
|
// src/operation.ts
|
|
@@ -1280,7 +1297,6 @@ export {
|
|
|
1280
1297
|
__toESM,
|
|
1281
1298
|
require_picocolors,
|
|
1282
1299
|
log_symbols_default,
|
|
1283
|
-
ReleaseType,
|
|
1284
1300
|
isReleaseType,
|
|
1285
1301
|
ProgressEvent,
|
|
1286
1302
|
NpmScript,
|
package/dist/cli/index.d.mts
CHANGED
package/dist/cli/index.d.ts
CHANGED
package/dist/cli/index.js
CHANGED
|
@@ -115,7 +115,7 @@ __export(cli_exports, {
|
|
|
115
115
|
module.exports = __toCommonJS(cli_exports);
|
|
116
116
|
var import_node_process8 = __toESM(require("process"));
|
|
117
117
|
|
|
118
|
-
// node_modules/.pnpm/chalk@5.
|
|
118
|
+
// node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
119
119
|
var ANSI_BACKGROUND_OFFSET = 10;
|
|
120
120
|
var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
|
121
121
|
var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
|
|
@@ -301,7 +301,7 @@ function assembleStyles() {
|
|
|
301
301
|
var ansiStyles = assembleStyles();
|
|
302
302
|
var ansi_styles_default = ansiStyles;
|
|
303
303
|
|
|
304
|
-
// node_modules/.pnpm/chalk@5.
|
|
304
|
+
// node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/supports-color/index.js
|
|
305
305
|
var import_node_process = __toESM(require("process"), 1);
|
|
306
306
|
var import_node_os = __toESM(require("os"), 1);
|
|
307
307
|
var import_node_tty = __toESM(require("tty"), 1);
|
|
@@ -375,7 +375,7 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
|
375
375
|
return 1;
|
|
376
376
|
}
|
|
377
377
|
if ("CI" in env) {
|
|
378
|
-
if ("GITHUB_ACTIONS" in env) {
|
|
378
|
+
if ("GITHUB_ACTIONS" in env || "GITEA_ACTIONS" in env) {
|
|
379
379
|
return 3;
|
|
380
380
|
}
|
|
381
381
|
if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
|
|
@@ -426,7 +426,7 @@ var supportsColor = {
|
|
|
426
426
|
};
|
|
427
427
|
var supports_color_default = supportsColor;
|
|
428
428
|
|
|
429
|
-
// node_modules/.pnpm/chalk@5.
|
|
429
|
+
// node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/utilities.js
|
|
430
430
|
function stringReplaceAll(string, substring, replacer) {
|
|
431
431
|
let index = string.indexOf(substring);
|
|
432
432
|
if (index === -1) {
|
|
@@ -456,7 +456,7 @@ function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
|
|
|
456
456
|
return returnValue;
|
|
457
457
|
}
|
|
458
458
|
|
|
459
|
-
// node_modules/.pnpm/chalk@5.
|
|
459
|
+
// node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/index.js
|
|
460
460
|
var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
|
|
461
461
|
var GENERATOR = Symbol("GENERATOR");
|
|
462
462
|
var STYLER = Symbol("STYLER");
|
|
@@ -611,7 +611,7 @@ function isUnicodeSupported() {
|
|
|
611
611
|
return Boolean(import_node_process2.default.env.CI) || Boolean(import_node_process2.default.env.WT_SESSION) || Boolean(import_node_process2.default.env.TERMINUS_SUBLIME) || import_node_process2.default.env.ConEmuTask === "{cmd::Cmder}" || import_node_process2.default.env.TERM_PROGRAM === "Terminus-Sublime" || import_node_process2.default.env.TERM_PROGRAM === "vscode" || import_node_process2.default.env.TERM === "xterm-256color" || import_node_process2.default.env.TERM === "alacritty" || import_node_process2.default.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
612
612
|
}
|
|
613
613
|
|
|
614
|
-
// node_modules/.pnpm/log-symbols@
|
|
614
|
+
// node_modules/.pnpm/log-symbols@6.0.0/node_modules/log-symbols/index.js
|
|
615
615
|
var main = {
|
|
616
616
|
info: source_default.blue("\u2139"),
|
|
617
617
|
success: source_default.green("\u2714"),
|
|
@@ -628,7 +628,7 @@ var logSymbols = isUnicodeSupported() ? main : fallback;
|
|
|
628
628
|
var log_symbols_default = logSymbols;
|
|
629
629
|
|
|
630
630
|
// package.json
|
|
631
|
-
var version = "9.
|
|
631
|
+
var version = "9.3.0";
|
|
632
632
|
|
|
633
633
|
// src/version-bump.ts
|
|
634
634
|
var import_node_process5 = __toESM(require("process"));
|
|
@@ -640,10 +640,9 @@ var import_prompts2 = __toESM(require("prompts"));
|
|
|
640
640
|
var import_node_process3 = __toESM(require("process"));
|
|
641
641
|
var import_picocolors = __toESM(require_picocolors());
|
|
642
642
|
var import_prompts = __toESM(require("prompts"));
|
|
643
|
-
var
|
|
643
|
+
var import_semver = __toESM(require("semver"));
|
|
644
644
|
|
|
645
645
|
// src/release-type.ts
|
|
646
|
-
var import_semver = require("semver");
|
|
647
646
|
var prereleaseTypes = ["premajor", "preminor", "prepatch", "prerelease"];
|
|
648
647
|
var releaseTypes = prereleaseTypes.concat(["major", "minor", "patch"]);
|
|
649
648
|
function isPrerelease(value) {
|
|
@@ -662,7 +661,7 @@ async function getNewVersion(operation) {
|
|
|
662
661
|
return promptForNewVersion(operation);
|
|
663
662
|
case "version":
|
|
664
663
|
return operation.update({
|
|
665
|
-
newVersion: new
|
|
664
|
+
newVersion: new import_semver.SemVer(release.version, true).version
|
|
666
665
|
});
|
|
667
666
|
default:
|
|
668
667
|
return operation.update({
|
|
@@ -672,7 +671,7 @@ async function getNewVersion(operation) {
|
|
|
672
671
|
}
|
|
673
672
|
}
|
|
674
673
|
function getNextVersion(oldVersion, bump) {
|
|
675
|
-
const oldSemVer = new
|
|
674
|
+
const oldSemVer = new import_semver.SemVer(oldVersion);
|
|
676
675
|
const newSemVer = oldSemVer.inc(bump.type, bump.preid);
|
|
677
676
|
if (isPrerelease(bump.type) && newSemVer.prerelease.length === 2 && newSemVer.prerelease[0] === bump.preid && String(newSemVer.prerelease[1]) === "0") {
|
|
678
677
|
newSemVer.prerelease[1] = "1";
|
|
@@ -683,30 +682,35 @@ function getNextVersion(oldVersion, bump) {
|
|
|
683
682
|
function getNextVersions(oldVersion, preid) {
|
|
684
683
|
var _a;
|
|
685
684
|
const next = {};
|
|
686
|
-
const parse =
|
|
685
|
+
const parse = import_semver.default.parse(oldVersion);
|
|
687
686
|
if (typeof (parse == null ? void 0 : parse.prerelease[0]) === "string")
|
|
688
687
|
preid = (parse == null ? void 0 : parse.prerelease[0]) || "preid";
|
|
689
688
|
for (const type of releaseTypes)
|
|
690
|
-
next[type] =
|
|
691
|
-
next.next = ((_a = parse == null ? void 0 : parse.prerelease) == null ? void 0 : _a.length) ?
|
|
689
|
+
next[type] = import_semver.default.inc(oldVersion, type, preid);
|
|
690
|
+
next.next = ((_a = parse == null ? void 0 : parse.prerelease) == null ? void 0 : _a.length) ? import_semver.default.inc(oldVersion, "prerelease", preid) : import_semver.default.inc(oldVersion, "patch");
|
|
692
691
|
return next;
|
|
693
692
|
}
|
|
694
693
|
async function promptForNewVersion(operation) {
|
|
694
|
+
var _a, _b;
|
|
695
695
|
const { oldVersion } = operation.state;
|
|
696
696
|
const release = operation.options.release;
|
|
697
697
|
const next = getNextVersions(oldVersion, release.preid);
|
|
698
|
+
const configCustomVersion = await ((_b = (_a = operation.options).customVersion) == null ? void 0 : _b.call(_a, oldVersion, import_semver.default));
|
|
698
699
|
const PADDING = 13;
|
|
699
700
|
const answers = await (0, import_prompts.default)([
|
|
700
701
|
{
|
|
701
702
|
type: "autocomplete",
|
|
702
703
|
name: "release",
|
|
703
704
|
message: `Current version ${import_picocolors.default.green(oldVersion)}`,
|
|
704
|
-
initial: "next",
|
|
705
|
+
initial: configCustomVersion ? "config" : "next",
|
|
705
706
|
choices: [
|
|
706
707
|
{ value: "major", title: `${"major".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.major)}` },
|
|
707
708
|
{ value: "minor", title: `${"minor".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.minor)}` },
|
|
708
709
|
{ value: "patch", title: `${"patch".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.patch)}` },
|
|
709
710
|
{ value: "next", title: `${"next".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.next)}` },
|
|
711
|
+
...configCustomVersion ? [
|
|
712
|
+
{ value: "config", title: `${"from config".padStart(PADDING, " ")} ${import_picocolors.default.bold(configCustomVersion)}` }
|
|
713
|
+
] : [],
|
|
710
714
|
{ value: "prepatch", title: `${"pre-patch".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.prepatch)}` },
|
|
711
715
|
{ value: "preminor", title: `${"pre-minor".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.preminor)}` },
|
|
712
716
|
{ value: "premajor", title: `${"pre-major".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.premajor)}` },
|
|
@@ -720,15 +724,16 @@ async function promptForNewVersion(operation) {
|
|
|
720
724
|
message: "Enter the new version number:",
|
|
721
725
|
initial: oldVersion,
|
|
722
726
|
validate: (custom) => {
|
|
723
|
-
return (0,
|
|
727
|
+
return (0, import_semver.valid)(custom) ? true : "That's not a valid version number";
|
|
724
728
|
}
|
|
725
729
|
}
|
|
726
730
|
]);
|
|
727
|
-
const newVersion = answers.release === "none" ? oldVersion : answers.release === "custom" ? (0,
|
|
731
|
+
const newVersion = answers.release === "none" ? oldVersion : answers.release === "custom" ? (0, import_semver.clean)(answers.custom) : answers.release === "config" ? (0, import_semver.clean)(configCustomVersion) : next[answers.release];
|
|
728
732
|
if (!newVersion)
|
|
729
733
|
import_node_process3.default.exit(1);
|
|
730
734
|
switch (answers.release) {
|
|
731
735
|
case "custom":
|
|
736
|
+
case "config":
|
|
732
737
|
case "next":
|
|
733
738
|
case "none":
|
|
734
739
|
return operation.update({ newVersion });
|
|
@@ -738,7 +743,7 @@ async function promptForNewVersion(operation) {
|
|
|
738
743
|
}
|
|
739
744
|
|
|
740
745
|
// src/get-old-version.ts
|
|
741
|
-
var
|
|
746
|
+
var import_semver2 = require("semver");
|
|
742
747
|
|
|
743
748
|
// src/fs.ts
|
|
744
749
|
var import_node_fs = __toESM(require("fs"));
|
|
@@ -844,7 +849,7 @@ function detectIndent(string) {
|
|
|
844
849
|
};
|
|
845
850
|
}
|
|
846
851
|
|
|
847
|
-
// node_modules/.pnpm/detect-newline@4.0.
|
|
852
|
+
// node_modules/.pnpm/detect-newline@4.0.1/node_modules/detect-newline/index.js
|
|
848
853
|
function detectNewline(string) {
|
|
849
854
|
if (typeof string !== "string") {
|
|
850
855
|
throw new TypeError("Expected a string");
|
|
@@ -930,7 +935,7 @@ async function readVersion(file, cwd) {
|
|
|
930
935
|
try {
|
|
931
936
|
const { data: manifest } = await readJsonFile(file, cwd);
|
|
932
937
|
if (isManifest(manifest)) {
|
|
933
|
-
if ((0,
|
|
938
|
+
if ((0, import_semver2.valid)(manifest.version))
|
|
934
939
|
return manifest.version;
|
|
935
940
|
}
|
|
936
941
|
} catch (error) {
|
|
@@ -945,7 +950,7 @@ async function gitCommit(operation) {
|
|
|
945
950
|
return operation;
|
|
946
951
|
const { all, noVerify, message } = operation.options.commit;
|
|
947
952
|
const { updatedFiles, newVersion } = operation.state;
|
|
948
|
-
let args = [];
|
|
953
|
+
let args = ["--allow-empty"];
|
|
949
954
|
if (all) {
|
|
950
955
|
args.push("--all");
|
|
951
956
|
}
|
|
@@ -1047,7 +1052,18 @@ async function normalizeOptions(raw) {
|
|
|
1047
1052
|
}
|
|
1048
1053
|
if (release.type === "prompt" && !(ui.input && ui.output))
|
|
1049
1054
|
throw new Error("Cannot prompt for the version number because input or output has been disabled.");
|
|
1050
|
-
return {
|
|
1055
|
+
return {
|
|
1056
|
+
release,
|
|
1057
|
+
commit,
|
|
1058
|
+
tag,
|
|
1059
|
+
push,
|
|
1060
|
+
files,
|
|
1061
|
+
cwd,
|
|
1062
|
+
interface: ui,
|
|
1063
|
+
ignoreScripts,
|
|
1064
|
+
execute,
|
|
1065
|
+
customVersion: raw.customVersion
|
|
1066
|
+
};
|
|
1051
1067
|
}
|
|
1052
1068
|
|
|
1053
1069
|
// src/operation.ts
|
|
@@ -1237,9 +1253,12 @@ function printSummary(operation) {
|
|
|
1237
1253
|
|
|
1238
1254
|
// src/cli/parse-args.ts
|
|
1239
1255
|
var import_node_process7 = __toESM(require("process"));
|
|
1240
|
-
var
|
|
1256
|
+
var import_promises = __toESM(require("fs/promises"));
|
|
1257
|
+
var import_node_fs2 = __toESM(require("fs"));
|
|
1258
|
+
var import_semver3 = require("semver");
|
|
1241
1259
|
var import_cac = __toESM(require("cac"));
|
|
1242
1260
|
var import_picocolors3 = __toESM(require_picocolors());
|
|
1261
|
+
var import_js_yaml = __toESM(require("js-yaml"));
|
|
1243
1262
|
|
|
1244
1263
|
// src/config.ts
|
|
1245
1264
|
var import_node_process6 = __toESM(require("process"));
|
|
@@ -1270,7 +1289,7 @@ async function parseArgs() {
|
|
|
1270
1289
|
var _a;
|
|
1271
1290
|
try {
|
|
1272
1291
|
const cli = (0, import_cac.default)("bumpp");
|
|
1273
|
-
cli.version(version).usage("[...files]").option("--preid <preid>", "ID for prerelease").option("--all", `Include all files (default: ${bumpConfigDefaults.all})`).option("-c, --commit [msg]", `Commit message (default: ${bumpConfigDefaults.commit})`).option("--no-commit", "Skip commit").option("-t, --tag [tag]", `Tag name (default: ${bumpConfigDefaults.tag})`).option("--no-tag", "Skip tag").option("-p, --push", `Push to remote (default: ${bumpConfigDefaults.push})`).option("-y, --yes", `Skip confirmation (default: ${!bumpConfigDefaults.confirm})`).option("-r, --recursive", `Bump package.json files recursively (default: ${bumpConfigDefaults.recursive})`).option("--no-verify", "Skip git verification").option("--ignore-scripts", `Ignore scripts (default: ${bumpConfigDefaults.ignoreScripts})`).option("-q, --quiet", "Quiet mode").option("-v, --version <version>", "
|
|
1292
|
+
cli.version(version).usage("[...files]").option("--preid <preid>", "ID for prerelease").option("--all", `Include all files (default: ${bumpConfigDefaults.all})`).option("-c, --commit [msg]", `Commit message (default: ${bumpConfigDefaults.commit})`).option("--no-commit", "Skip commit").option("-t, --tag [tag]", `Tag name (default: ${bumpConfigDefaults.tag})`).option("--no-tag", "Skip tag").option("-p, --push", `Push to remote (default: ${bumpConfigDefaults.push})`).option("-y, --yes", `Skip confirmation (default: ${!bumpConfigDefaults.confirm})`).option("-r, --recursive", `Bump package.json files recursively (default: ${bumpConfigDefaults.recursive})`).option("--no-verify", "Skip git verification").option("--ignore-scripts", `Ignore scripts (default: ${bumpConfigDefaults.ignoreScripts})`).option("-q, --quiet", "Quiet mode").option("-v, --version <version>", "Target version").option("-x, --execute <command>", "Commands to execute after version bumps").help();
|
|
1274
1293
|
const result = cli.parse();
|
|
1275
1294
|
const args = result.options;
|
|
1276
1295
|
const parsedArgs = {
|
|
@@ -1293,16 +1312,27 @@ async function parseArgs() {
|
|
|
1293
1312
|
};
|
|
1294
1313
|
if (parsedArgs.options.files && parsedArgs.options.files.length > 0) {
|
|
1295
1314
|
const firstArg = parsedArgs.options.files[0];
|
|
1296
|
-
if (firstArg === "prompt" || isReleaseType(firstArg) || (0,
|
|
1315
|
+
if (firstArg === "prompt" || isReleaseType(firstArg) || (0, import_semver3.valid)(firstArg)) {
|
|
1297
1316
|
parsedArgs.options.release = firstArg;
|
|
1298
1317
|
parsedArgs.options.files.shift();
|
|
1299
1318
|
}
|
|
1300
1319
|
}
|
|
1301
1320
|
if (parsedArgs.options.recursive) {
|
|
1302
|
-
if ((_a = parsedArgs.options.files) == null ? void 0 : _a.length)
|
|
1321
|
+
if ((_a = parsedArgs.options.files) == null ? void 0 : _a.length) {
|
|
1303
1322
|
console.log(import_picocolors3.default.yellow("The --recursive option is ignored when files are specified"));
|
|
1304
|
-
else
|
|
1323
|
+
} else {
|
|
1305
1324
|
parsedArgs.options.files = ["package.json", "package-lock.json", "packages/**/package.json"];
|
|
1325
|
+
if (import_node_fs2.default.existsSync("pnpm-workspace.yaml")) {
|
|
1326
|
+
const pnpmWorkspace = await import_promises.default.readFile("pnpm-workspace.yaml", "utf8");
|
|
1327
|
+
const workspaces = import_js_yaml.default.load(pnpmWorkspace);
|
|
1328
|
+
const workspacesWithPackageJson = workspaces.packages.map((workspace) => `${workspace}/package.json`);
|
|
1329
|
+
const withoutExcludedWorkspaces = workspacesWithPackageJson.filter((workspace) => {
|
|
1330
|
+
var _a2;
|
|
1331
|
+
return !workspace.startsWith("!") && !((_a2 = parsedArgs.options.files) == null ? void 0 : _a2.includes(workspace));
|
|
1332
|
+
});
|
|
1333
|
+
parsedArgs.options.files = parsedArgs.options.files.concat(withoutExcludedWorkspaces);
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1306
1336
|
}
|
|
1307
1337
|
return parsedArgs;
|
|
1308
1338
|
} catch (error) {
|
package/dist/cli/index.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {createRequire as __createRequire} from 'module';var require=__createRequire(import.meta.url);
|
|
1
2
|
import {
|
|
2
3
|
__toESM,
|
|
3
4
|
bumpConfigDefaults,
|
|
@@ -6,24 +7,27 @@ import {
|
|
|
6
7
|
log_symbols_default,
|
|
7
8
|
require_picocolors,
|
|
8
9
|
versionBump
|
|
9
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-ZY4OVS4D.mjs";
|
|
10
11
|
|
|
11
12
|
// src/cli/index.ts
|
|
12
13
|
import process2 from "process";
|
|
13
14
|
|
|
14
15
|
// package.json
|
|
15
|
-
var version = "9.
|
|
16
|
+
var version = "9.3.0";
|
|
16
17
|
|
|
17
18
|
// src/cli/parse-args.ts
|
|
18
19
|
var import_picocolors = __toESM(require_picocolors());
|
|
19
20
|
import process from "process";
|
|
21
|
+
import fs from "fs/promises";
|
|
22
|
+
import fsSync from "fs";
|
|
20
23
|
import { valid as isValidVersion } from "semver";
|
|
21
24
|
import cac from "cac";
|
|
25
|
+
import yaml from "js-yaml";
|
|
22
26
|
async function parseArgs() {
|
|
23
27
|
var _a;
|
|
24
28
|
try {
|
|
25
29
|
const cli = cac("bumpp");
|
|
26
|
-
cli.version(version).usage("[...files]").option("--preid <preid>", "ID for prerelease").option("--all", `Include all files (default: ${bumpConfigDefaults.all})`).option("-c, --commit [msg]", `Commit message (default: ${bumpConfigDefaults.commit})`).option("--no-commit", "Skip commit").option("-t, --tag [tag]", `Tag name (default: ${bumpConfigDefaults.tag})`).option("--no-tag", "Skip tag").option("-p, --push", `Push to remote (default: ${bumpConfigDefaults.push})`).option("-y, --yes", `Skip confirmation (default: ${!bumpConfigDefaults.confirm})`).option("-r, --recursive", `Bump package.json files recursively (default: ${bumpConfigDefaults.recursive})`).option("--no-verify", "Skip git verification").option("--ignore-scripts", `Ignore scripts (default: ${bumpConfigDefaults.ignoreScripts})`).option("-q, --quiet", "Quiet mode").option("-v, --version <version>", "
|
|
30
|
+
cli.version(version).usage("[...files]").option("--preid <preid>", "ID for prerelease").option("--all", `Include all files (default: ${bumpConfigDefaults.all})`).option("-c, --commit [msg]", `Commit message (default: ${bumpConfigDefaults.commit})`).option("--no-commit", "Skip commit").option("-t, --tag [tag]", `Tag name (default: ${bumpConfigDefaults.tag})`).option("--no-tag", "Skip tag").option("-p, --push", `Push to remote (default: ${bumpConfigDefaults.push})`).option("-y, --yes", `Skip confirmation (default: ${!bumpConfigDefaults.confirm})`).option("-r, --recursive", `Bump package.json files recursively (default: ${bumpConfigDefaults.recursive})`).option("--no-verify", "Skip git verification").option("--ignore-scripts", `Ignore scripts (default: ${bumpConfigDefaults.ignoreScripts})`).option("-q, --quiet", "Quiet mode").option("-v, --version <version>", "Target version").option("-x, --execute <command>", "Commands to execute after version bumps").help();
|
|
27
31
|
const result = cli.parse();
|
|
28
32
|
const args = result.options;
|
|
29
33
|
const parsedArgs = {
|
|
@@ -52,10 +56,21 @@ async function parseArgs() {
|
|
|
52
56
|
}
|
|
53
57
|
}
|
|
54
58
|
if (parsedArgs.options.recursive) {
|
|
55
|
-
if ((_a = parsedArgs.options.files) == null ? void 0 : _a.length)
|
|
59
|
+
if ((_a = parsedArgs.options.files) == null ? void 0 : _a.length) {
|
|
56
60
|
console.log(import_picocolors.default.yellow("The --recursive option is ignored when files are specified"));
|
|
57
|
-
else
|
|
61
|
+
} else {
|
|
58
62
|
parsedArgs.options.files = ["package.json", "package-lock.json", "packages/**/package.json"];
|
|
63
|
+
if (fsSync.existsSync("pnpm-workspace.yaml")) {
|
|
64
|
+
const pnpmWorkspace = await fs.readFile("pnpm-workspace.yaml", "utf8");
|
|
65
|
+
const workspaces = yaml.load(pnpmWorkspace);
|
|
66
|
+
const workspacesWithPackageJson = workspaces.packages.map((workspace) => `${workspace}/package.json`);
|
|
67
|
+
const withoutExcludedWorkspaces = workspacesWithPackageJson.filter((workspace) => {
|
|
68
|
+
var _a2;
|
|
69
|
+
return !workspace.startsWith("!") && !((_a2 = parsedArgs.options.files) == null ? void 0 : _a2.includes(workspace));
|
|
70
|
+
});
|
|
71
|
+
parsedArgs.options.files = parsedArgs.options.files.concat(withoutExcludedWorkspaces);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
59
74
|
}
|
|
60
75
|
return parsedArgs;
|
|
61
76
|
} catch (error) {
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReleaseType } from 'semver';
|
|
1
|
+
import _semver, { ReleaseType } from 'semver';
|
|
2
2
|
export { ReleaseType } from 'semver';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -176,6 +176,10 @@ interface VersionBumpOptions {
|
|
|
176
176
|
* @default false
|
|
177
177
|
*/
|
|
178
178
|
recursive?: boolean;
|
|
179
|
+
/**
|
|
180
|
+
* Custom function to provide the version number
|
|
181
|
+
*/
|
|
182
|
+
customVersion?: (currentVersion: string, semver: typeof _semver) => Promise<string | void> | string | void;
|
|
179
183
|
}
|
|
180
184
|
/**
|
|
181
185
|
* Options for the command-line interface.
|
|
@@ -258,6 +262,7 @@ interface NormalizedOptions {
|
|
|
258
262
|
interface: Interface;
|
|
259
263
|
ignoreScripts: boolean;
|
|
260
264
|
execute?: string;
|
|
265
|
+
customVersion?: VersionBumpOptions['customVersion'];
|
|
261
266
|
}
|
|
262
267
|
|
|
263
268
|
interface OperationState {
|
|
@@ -339,4 +344,4 @@ declare const bumpConfigDefaults: VersionBumpOptions;
|
|
|
339
344
|
declare function loadBumpConfig(overrides?: Partial<VersionBumpOptions>, cwd?: string): Promise<VersionBumpOptions>;
|
|
340
345
|
declare function defineConfig(config: Partial<VersionBumpOptions>): Partial<VersionBumpOptions>;
|
|
341
346
|
|
|
342
|
-
export { InterfaceOptions, NpmScript, ProgressEvent, VersionBumpOptions, VersionBumpProgress, VersionBumpResults, bumpConfigDefaults, versionBump as default, defineConfig, loadBumpConfig, versionBump, versionBumpInfo };
|
|
347
|
+
export { type InterfaceOptions, NpmScript, ProgressEvent, type VersionBumpOptions, type VersionBumpProgress, type VersionBumpResults, bumpConfigDefaults, versionBump as default, defineConfig, loadBumpConfig, versionBump, versionBumpInfo };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReleaseType } from 'semver';
|
|
1
|
+
import _semver, { ReleaseType } from 'semver';
|
|
2
2
|
export { ReleaseType } from 'semver';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -176,6 +176,10 @@ interface VersionBumpOptions {
|
|
|
176
176
|
* @default false
|
|
177
177
|
*/
|
|
178
178
|
recursive?: boolean;
|
|
179
|
+
/**
|
|
180
|
+
* Custom function to provide the version number
|
|
181
|
+
*/
|
|
182
|
+
customVersion?: (currentVersion: string, semver: typeof _semver) => Promise<string | void> | string | void;
|
|
179
183
|
}
|
|
180
184
|
/**
|
|
181
185
|
* Options for the command-line interface.
|
|
@@ -258,6 +262,7 @@ interface NormalizedOptions {
|
|
|
258
262
|
interface: Interface;
|
|
259
263
|
ignoreScripts: boolean;
|
|
260
264
|
execute?: string;
|
|
265
|
+
customVersion?: VersionBumpOptions['customVersion'];
|
|
261
266
|
}
|
|
262
267
|
|
|
263
268
|
interface OperationState {
|
|
@@ -339,4 +344,4 @@ declare const bumpConfigDefaults: VersionBumpOptions;
|
|
|
339
344
|
declare function loadBumpConfig(overrides?: Partial<VersionBumpOptions>, cwd?: string): Promise<VersionBumpOptions>;
|
|
340
345
|
declare function defineConfig(config: Partial<VersionBumpOptions>): Partial<VersionBumpOptions>;
|
|
341
346
|
|
|
342
|
-
export { InterfaceOptions, NpmScript, ProgressEvent, VersionBumpOptions, VersionBumpProgress, VersionBumpResults, bumpConfigDefaults, versionBump as default, defineConfig, loadBumpConfig, versionBump, versionBumpInfo };
|
|
347
|
+
export { type InterfaceOptions, NpmScript, ProgressEvent, type VersionBumpOptions, type VersionBumpProgress, type VersionBumpResults, bumpConfigDefaults, versionBump as default, defineConfig, loadBumpConfig, versionBump, versionBumpInfo };
|
package/dist/index.js
CHANGED
|
@@ -112,7 +112,6 @@ var src_exports = {};
|
|
|
112
112
|
__export(src_exports, {
|
|
113
113
|
NpmScript: () => NpmScript,
|
|
114
114
|
ProgressEvent: () => ProgressEvent,
|
|
115
|
-
ReleaseType: () => import_semver.ReleaseType,
|
|
116
115
|
bumpConfigDefaults: () => bumpConfigDefaults,
|
|
117
116
|
default: () => src_default,
|
|
118
117
|
defineConfig: () => defineConfig,
|
|
@@ -127,7 +126,7 @@ var import_node_process5 = __toESM(require("process"));
|
|
|
127
126
|
var ezSpawn3 = __toESM(require("@jsdevtools/ez-spawn"));
|
|
128
127
|
var import_picocolors2 = __toESM(require_picocolors());
|
|
129
128
|
|
|
130
|
-
// node_modules/.pnpm/chalk@5.
|
|
129
|
+
// node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
131
130
|
var ANSI_BACKGROUND_OFFSET = 10;
|
|
132
131
|
var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
|
133
132
|
var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
|
|
@@ -313,7 +312,7 @@ function assembleStyles() {
|
|
|
313
312
|
var ansiStyles = assembleStyles();
|
|
314
313
|
var ansi_styles_default = ansiStyles;
|
|
315
314
|
|
|
316
|
-
// node_modules/.pnpm/chalk@5.
|
|
315
|
+
// node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/supports-color/index.js
|
|
317
316
|
var import_node_process = __toESM(require("process"), 1);
|
|
318
317
|
var import_node_os = __toESM(require("os"), 1);
|
|
319
318
|
var import_node_tty = __toESM(require("tty"), 1);
|
|
@@ -387,7 +386,7 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
|
387
386
|
return 1;
|
|
388
387
|
}
|
|
389
388
|
if ("CI" in env) {
|
|
390
|
-
if ("GITHUB_ACTIONS" in env) {
|
|
389
|
+
if ("GITHUB_ACTIONS" in env || "GITEA_ACTIONS" in env) {
|
|
391
390
|
return 3;
|
|
392
391
|
}
|
|
393
392
|
if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
|
|
@@ -438,7 +437,7 @@ var supportsColor = {
|
|
|
438
437
|
};
|
|
439
438
|
var supports_color_default = supportsColor;
|
|
440
439
|
|
|
441
|
-
// node_modules/.pnpm/chalk@5.
|
|
440
|
+
// node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/utilities.js
|
|
442
441
|
function stringReplaceAll(string, substring, replacer) {
|
|
443
442
|
let index = string.indexOf(substring);
|
|
444
443
|
if (index === -1) {
|
|
@@ -468,7 +467,7 @@ function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
|
|
|
468
467
|
return returnValue;
|
|
469
468
|
}
|
|
470
469
|
|
|
471
|
-
// node_modules/.pnpm/chalk@5.
|
|
470
|
+
// node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/index.js
|
|
472
471
|
var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
|
|
473
472
|
var GENERATOR = Symbol("GENERATOR");
|
|
474
473
|
var STYLER = Symbol("STYLER");
|
|
@@ -623,7 +622,7 @@ function isUnicodeSupported() {
|
|
|
623
622
|
return Boolean(import_node_process2.default.env.CI) || Boolean(import_node_process2.default.env.WT_SESSION) || Boolean(import_node_process2.default.env.TERMINUS_SUBLIME) || import_node_process2.default.env.ConEmuTask === "{cmd::Cmder}" || import_node_process2.default.env.TERM_PROGRAM === "Terminus-Sublime" || import_node_process2.default.env.TERM_PROGRAM === "vscode" || import_node_process2.default.env.TERM === "xterm-256color" || import_node_process2.default.env.TERM === "alacritty" || import_node_process2.default.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
624
623
|
}
|
|
625
624
|
|
|
626
|
-
// node_modules/.pnpm/log-symbols@
|
|
625
|
+
// node_modules/.pnpm/log-symbols@6.0.0/node_modules/log-symbols/index.js
|
|
627
626
|
var main = {
|
|
628
627
|
info: source_default.blue("\u2139"),
|
|
629
628
|
success: source_default.green("\u2714"),
|
|
@@ -646,10 +645,9 @@ var import_prompts2 = __toESM(require("prompts"));
|
|
|
646
645
|
var import_node_process3 = __toESM(require("process"));
|
|
647
646
|
var import_picocolors = __toESM(require_picocolors());
|
|
648
647
|
var import_prompts = __toESM(require("prompts"));
|
|
649
|
-
var
|
|
648
|
+
var import_semver = __toESM(require("semver"));
|
|
650
649
|
|
|
651
650
|
// src/release-type.ts
|
|
652
|
-
var import_semver = require("semver");
|
|
653
651
|
var prereleaseTypes = ["premajor", "preminor", "prepatch", "prerelease"];
|
|
654
652
|
var releaseTypes = prereleaseTypes.concat(["major", "minor", "patch"]);
|
|
655
653
|
function isPrerelease(value) {
|
|
@@ -668,7 +666,7 @@ async function getNewVersion(operation) {
|
|
|
668
666
|
return promptForNewVersion(operation);
|
|
669
667
|
case "version":
|
|
670
668
|
return operation.update({
|
|
671
|
-
newVersion: new
|
|
669
|
+
newVersion: new import_semver.SemVer(release.version, true).version
|
|
672
670
|
});
|
|
673
671
|
default:
|
|
674
672
|
return operation.update({
|
|
@@ -678,7 +676,7 @@ async function getNewVersion(operation) {
|
|
|
678
676
|
}
|
|
679
677
|
}
|
|
680
678
|
function getNextVersion(oldVersion, bump) {
|
|
681
|
-
const oldSemVer = new
|
|
679
|
+
const oldSemVer = new import_semver.SemVer(oldVersion);
|
|
682
680
|
const newSemVer = oldSemVer.inc(bump.type, bump.preid);
|
|
683
681
|
if (isPrerelease(bump.type) && newSemVer.prerelease.length === 2 && newSemVer.prerelease[0] === bump.preid && String(newSemVer.prerelease[1]) === "0") {
|
|
684
682
|
newSemVer.prerelease[1] = "1";
|
|
@@ -689,30 +687,35 @@ function getNextVersion(oldVersion, bump) {
|
|
|
689
687
|
function getNextVersions(oldVersion, preid) {
|
|
690
688
|
var _a;
|
|
691
689
|
const next = {};
|
|
692
|
-
const parse =
|
|
690
|
+
const parse = import_semver.default.parse(oldVersion);
|
|
693
691
|
if (typeof (parse == null ? void 0 : parse.prerelease[0]) === "string")
|
|
694
692
|
preid = (parse == null ? void 0 : parse.prerelease[0]) || "preid";
|
|
695
693
|
for (const type of releaseTypes)
|
|
696
|
-
next[type] =
|
|
697
|
-
next.next = ((_a = parse == null ? void 0 : parse.prerelease) == null ? void 0 : _a.length) ?
|
|
694
|
+
next[type] = import_semver.default.inc(oldVersion, type, preid);
|
|
695
|
+
next.next = ((_a = parse == null ? void 0 : parse.prerelease) == null ? void 0 : _a.length) ? import_semver.default.inc(oldVersion, "prerelease", preid) : import_semver.default.inc(oldVersion, "patch");
|
|
698
696
|
return next;
|
|
699
697
|
}
|
|
700
698
|
async function promptForNewVersion(operation) {
|
|
699
|
+
var _a, _b;
|
|
701
700
|
const { oldVersion } = operation.state;
|
|
702
701
|
const release = operation.options.release;
|
|
703
702
|
const next = getNextVersions(oldVersion, release.preid);
|
|
703
|
+
const configCustomVersion = await ((_b = (_a = operation.options).customVersion) == null ? void 0 : _b.call(_a, oldVersion, import_semver.default));
|
|
704
704
|
const PADDING = 13;
|
|
705
705
|
const answers = await (0, import_prompts.default)([
|
|
706
706
|
{
|
|
707
707
|
type: "autocomplete",
|
|
708
708
|
name: "release",
|
|
709
709
|
message: `Current version ${import_picocolors.default.green(oldVersion)}`,
|
|
710
|
-
initial: "next",
|
|
710
|
+
initial: configCustomVersion ? "config" : "next",
|
|
711
711
|
choices: [
|
|
712
712
|
{ value: "major", title: `${"major".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.major)}` },
|
|
713
713
|
{ value: "minor", title: `${"minor".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.minor)}` },
|
|
714
714
|
{ value: "patch", title: `${"patch".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.patch)}` },
|
|
715
715
|
{ value: "next", title: `${"next".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.next)}` },
|
|
716
|
+
...configCustomVersion ? [
|
|
717
|
+
{ value: "config", title: `${"from config".padStart(PADDING, " ")} ${import_picocolors.default.bold(configCustomVersion)}` }
|
|
718
|
+
] : [],
|
|
716
719
|
{ value: "prepatch", title: `${"pre-patch".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.prepatch)}` },
|
|
717
720
|
{ value: "preminor", title: `${"pre-minor".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.preminor)}` },
|
|
718
721
|
{ value: "premajor", title: `${"pre-major".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.premajor)}` },
|
|
@@ -726,15 +729,16 @@ async function promptForNewVersion(operation) {
|
|
|
726
729
|
message: "Enter the new version number:",
|
|
727
730
|
initial: oldVersion,
|
|
728
731
|
validate: (custom) => {
|
|
729
|
-
return (0,
|
|
732
|
+
return (0, import_semver.valid)(custom) ? true : "That's not a valid version number";
|
|
730
733
|
}
|
|
731
734
|
}
|
|
732
735
|
]);
|
|
733
|
-
const newVersion = answers.release === "none" ? oldVersion : answers.release === "custom" ? (0,
|
|
736
|
+
const newVersion = answers.release === "none" ? oldVersion : answers.release === "custom" ? (0, import_semver.clean)(answers.custom) : answers.release === "config" ? (0, import_semver.clean)(configCustomVersion) : next[answers.release];
|
|
734
737
|
if (!newVersion)
|
|
735
738
|
import_node_process3.default.exit(1);
|
|
736
739
|
switch (answers.release) {
|
|
737
740
|
case "custom":
|
|
741
|
+
case "config":
|
|
738
742
|
case "next":
|
|
739
743
|
case "none":
|
|
740
744
|
return operation.update({ newVersion });
|
|
@@ -744,7 +748,7 @@ async function promptForNewVersion(operation) {
|
|
|
744
748
|
}
|
|
745
749
|
|
|
746
750
|
// src/get-old-version.ts
|
|
747
|
-
var
|
|
751
|
+
var import_semver2 = require("semver");
|
|
748
752
|
|
|
749
753
|
// src/fs.ts
|
|
750
754
|
var import_node_fs = __toESM(require("fs"));
|
|
@@ -850,7 +854,7 @@ function detectIndent(string) {
|
|
|
850
854
|
};
|
|
851
855
|
}
|
|
852
856
|
|
|
853
|
-
// node_modules/.pnpm/detect-newline@4.0.
|
|
857
|
+
// node_modules/.pnpm/detect-newline@4.0.1/node_modules/detect-newline/index.js
|
|
854
858
|
function detectNewline(string) {
|
|
855
859
|
if (typeof string !== "string") {
|
|
856
860
|
throw new TypeError("Expected a string");
|
|
@@ -936,7 +940,7 @@ async function readVersion(file, cwd) {
|
|
|
936
940
|
try {
|
|
937
941
|
const { data: manifest } = await readJsonFile(file, cwd);
|
|
938
942
|
if (isManifest(manifest)) {
|
|
939
|
-
if ((0,
|
|
943
|
+
if ((0, import_semver2.valid)(manifest.version))
|
|
940
944
|
return manifest.version;
|
|
941
945
|
}
|
|
942
946
|
} catch (error) {
|
|
@@ -970,7 +974,7 @@ async function gitCommit(operation) {
|
|
|
970
974
|
return operation;
|
|
971
975
|
const { all, noVerify, message } = operation.options.commit;
|
|
972
976
|
const { updatedFiles, newVersion } = operation.state;
|
|
973
|
-
let args = [];
|
|
977
|
+
let args = ["--allow-empty"];
|
|
974
978
|
if (all) {
|
|
975
979
|
args.push("--all");
|
|
976
980
|
}
|
|
@@ -1072,7 +1076,18 @@ async function normalizeOptions(raw) {
|
|
|
1072
1076
|
}
|
|
1073
1077
|
if (release.type === "prompt" && !(ui.input && ui.output))
|
|
1074
1078
|
throw new Error("Cannot prompt for the version number because input or output has been disabled.");
|
|
1075
|
-
return {
|
|
1079
|
+
return {
|
|
1080
|
+
release,
|
|
1081
|
+
commit,
|
|
1082
|
+
tag,
|
|
1083
|
+
push,
|
|
1084
|
+
files,
|
|
1085
|
+
cwd,
|
|
1086
|
+
interface: ui,
|
|
1087
|
+
ignoreScripts,
|
|
1088
|
+
execute,
|
|
1089
|
+
customVersion: raw.customVersion
|
|
1090
|
+
};
|
|
1076
1091
|
}
|
|
1077
1092
|
|
|
1078
1093
|
// src/operation.ts
|
|
@@ -1301,7 +1316,6 @@ var src_default = versionBump;
|
|
|
1301
1316
|
0 && (module.exports = {
|
|
1302
1317
|
NpmScript,
|
|
1303
1318
|
ProgressEvent,
|
|
1304
|
-
ReleaseType,
|
|
1305
1319
|
bumpConfigDefaults,
|
|
1306
1320
|
defineConfig,
|
|
1307
1321
|
loadBumpConfig,
|
package/dist/index.mjs
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
|
+
import {createRequire as __createRequire} from 'module';var require=__createRequire(import.meta.url);
|
|
1
2
|
import {
|
|
2
3
|
NpmScript,
|
|
3
4
|
ProgressEvent,
|
|
4
|
-
ReleaseType,
|
|
5
5
|
bumpConfigDefaults,
|
|
6
6
|
defineConfig,
|
|
7
7
|
loadBumpConfig,
|
|
8
8
|
versionBump,
|
|
9
9
|
versionBumpInfo
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-ZY4OVS4D.mjs";
|
|
11
11
|
|
|
12
12
|
// src/index.ts
|
|
13
13
|
var src_default = versionBump;
|
|
14
14
|
export {
|
|
15
15
|
NpmScript,
|
|
16
16
|
ProgressEvent,
|
|
17
|
-
ReleaseType,
|
|
18
17
|
bumpConfigDefaults,
|
|
19
18
|
src_default as default,
|
|
20
19
|
defineConfig,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bumpp",
|
|
3
|
-
"version": "9.
|
|
4
|
-
"packageManager": "pnpm@8.
|
|
3
|
+
"version": "9.3.0",
|
|
4
|
+
"packageManager": "pnpm@8.14.1",
|
|
5
5
|
"description": "Bump version, commit changes, tag, and push to Git",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "James Messinger",
|
|
@@ -58,26 +58,28 @@
|
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"@jsdevtools/ez-spawn": "^3.0.4",
|
|
61
|
-
"c12": "^1.
|
|
61
|
+
"c12": "^1.6.1",
|
|
62
62
|
"cac": "^6.7.14",
|
|
63
|
-
"fast-glob": "^3.3.
|
|
63
|
+
"fast-glob": "^3.3.2",
|
|
64
|
+
"js-yaml": "^4.1.0",
|
|
64
65
|
"prompts": "^2.4.2",
|
|
65
66
|
"semver": "^7.5.4"
|
|
66
67
|
},
|
|
67
68
|
"devDependencies": {
|
|
68
|
-
"@antfu/eslint-config": "^
|
|
69
|
-
"@types/
|
|
70
|
-
"@types/
|
|
71
|
-
"@types/
|
|
69
|
+
"@antfu/eslint-config": "^2.6.2",
|
|
70
|
+
"@types/js-yaml": "^4.0.9",
|
|
71
|
+
"@types/node": "^20.11.5",
|
|
72
|
+
"@types/prompts": "^2.4.9",
|
|
73
|
+
"@types/semver": "^7.5.6",
|
|
72
74
|
"detect-indent": "^7.0.1",
|
|
73
|
-
"detect-newline": "^4.0.
|
|
74
|
-
"eslint": "^8.
|
|
75
|
-
"esno": "^0.
|
|
76
|
-
"log-symbols": "^
|
|
75
|
+
"detect-newline": "^4.0.1",
|
|
76
|
+
"eslint": "^8.56.0",
|
|
77
|
+
"esno": "^4.0.0",
|
|
78
|
+
"log-symbols": "^6.0.0",
|
|
77
79
|
"npm-check": "^6.0.1",
|
|
78
80
|
"picocolors": "^1.0.0",
|
|
79
|
-
"rimraf": "^5.0.
|
|
80
|
-
"tsup": "^
|
|
81
|
-
"typescript": "^5.
|
|
81
|
+
"rimraf": "^5.0.5",
|
|
82
|
+
"tsup": "^8.0.1",
|
|
83
|
+
"typescript": "^5.3.3"
|
|
82
84
|
}
|
|
83
85
|
}
|