bumpp 9.5.2 → 9.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-XWLO3OHD.mjs → chunk-TBB4VMXP.mjs} +257 -121
- package/dist/cli/index.js +272 -138
- package/dist/cli/index.mjs +5 -5
- package/dist/index.d.mts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +266 -132
- package/dist/index.mjs +1 -1
- package/package.json +11 -11
package/dist/index.js
CHANGED
|
@@ -58,9 +58,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
58
58
|
));
|
|
59
59
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
60
60
|
|
|
61
|
-
// node_modules/.pnpm/picocolors@1.0
|
|
61
|
+
// node_modules/.pnpm/picocolors@1.1.0/node_modules/picocolors/picocolors.js
|
|
62
62
|
var require_picocolors = __commonJS({
|
|
63
|
-
"node_modules/.pnpm/picocolors@1.0
|
|
63
|
+
"node_modules/.pnpm/picocolors@1.1.0/node_modules/picocolors/picocolors.js"(exports2, module2) {
|
|
64
64
|
var argv = process.argv || [];
|
|
65
65
|
var env2 = process.env;
|
|
66
66
|
var isColorSupported = !("NO_COLOR" in env2 || argv.includes("--no-color")) && ("FORCE_COLOR" in env2 || argv.includes("--color") || process.platform === "win32" || require != null && require("tty").isatty(1) && env2.TERM !== "dumb" || "CI" in env2);
|
|
@@ -107,7 +107,23 @@ var require_picocolors = __commonJS({
|
|
|
107
107
|
bgBlue: init("\x1B[44m", "\x1B[49m"),
|
|
108
108
|
bgMagenta: init("\x1B[45m", "\x1B[49m"),
|
|
109
109
|
bgCyan: init("\x1B[46m", "\x1B[49m"),
|
|
110
|
-
bgWhite: init("\x1B[47m", "\x1B[49m")
|
|
110
|
+
bgWhite: init("\x1B[47m", "\x1B[49m"),
|
|
111
|
+
blackBright: init("\x1B[90m", "\x1B[39m"),
|
|
112
|
+
redBright: init("\x1B[91m", "\x1B[39m"),
|
|
113
|
+
greenBright: init("\x1B[92m", "\x1B[39m"),
|
|
114
|
+
yellowBright: init("\x1B[93m", "\x1B[39m"),
|
|
115
|
+
blueBright: init("\x1B[94m", "\x1B[39m"),
|
|
116
|
+
magentaBright: init("\x1B[95m", "\x1B[39m"),
|
|
117
|
+
cyanBright: init("\x1B[96m", "\x1B[39m"),
|
|
118
|
+
whiteBright: init("\x1B[97m", "\x1B[39m"),
|
|
119
|
+
bgBlackBright: init("\x1B[100m", "\x1B[49m"),
|
|
120
|
+
bgRedBright: init("\x1B[101m", "\x1B[49m"),
|
|
121
|
+
bgGreenBright: init("\x1B[102m", "\x1B[49m"),
|
|
122
|
+
bgYellowBright: init("\x1B[103m", "\x1B[49m"),
|
|
123
|
+
bgBlueBright: init("\x1B[104m", "\x1B[49m"),
|
|
124
|
+
bgMagentaBright: init("\x1B[105m", "\x1B[49m"),
|
|
125
|
+
bgCyanBright: init("\x1B[106m", "\x1B[49m"),
|
|
126
|
+
bgWhiteBright: init("\x1B[107m", "\x1B[49m")
|
|
111
127
|
};
|
|
112
128
|
};
|
|
113
129
|
module2.exports = createColors();
|
|
@@ -131,8 +147,7 @@ module.exports = __toCommonJS(src_exports);
|
|
|
131
147
|
|
|
132
148
|
// src/version-bump.ts
|
|
133
149
|
var import_node_process5 = __toESM(require("process"));
|
|
134
|
-
var
|
|
135
|
-
var import_picocolors2 = __toESM(require_picocolors());
|
|
150
|
+
var ezSpawn4 = __toESM(require("@jsdevtools/ez-spawn"));
|
|
136
151
|
|
|
137
152
|
// node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
138
153
|
var ANSI_BACKGROUND_OFFSET = 10;
|
|
@@ -647,115 +662,11 @@ var logSymbols = isUnicodeSupported() ? main : fallback;
|
|
|
647
662
|
var log_symbols_default = logSymbols;
|
|
648
663
|
|
|
649
664
|
// src/version-bump.ts
|
|
665
|
+
var import_picocolors3 = __toESM(require_picocolors());
|
|
650
666
|
var import_prompts2 = __toESM(require("prompts"));
|
|
651
667
|
|
|
652
|
-
// src/get-new-version.ts
|
|
653
|
-
var import_node_process3 = __toESM(require("process"));
|
|
654
|
-
var import_picocolors = __toESM(require_picocolors());
|
|
655
|
-
var import_prompts = __toESM(require("prompts"));
|
|
656
|
-
var import_semver = __toESM(require("semver"));
|
|
657
|
-
|
|
658
|
-
// src/release-type.ts
|
|
659
|
-
var prereleaseTypes = ["premajor", "preminor", "prepatch", "prerelease"];
|
|
660
|
-
var releaseTypes = prereleaseTypes.concat(["major", "minor", "patch", "next"]);
|
|
661
|
-
function isPrerelease(value) {
|
|
662
|
-
return prereleaseTypes.includes(value);
|
|
663
|
-
}
|
|
664
|
-
function isReleaseType(value) {
|
|
665
|
-
return releaseTypes.includes(value);
|
|
666
|
-
}
|
|
667
|
-
|
|
668
|
-
// src/get-new-version.ts
|
|
669
|
-
async function getNewVersion(operation) {
|
|
670
|
-
const { release } = operation.options;
|
|
671
|
-
const { currentVersion } = operation.state;
|
|
672
|
-
switch (release.type) {
|
|
673
|
-
case "prompt":
|
|
674
|
-
return promptForNewVersion(operation);
|
|
675
|
-
case "version":
|
|
676
|
-
return operation.update({
|
|
677
|
-
newVersion: new import_semver.SemVer(release.version, true).version
|
|
678
|
-
});
|
|
679
|
-
default:
|
|
680
|
-
return operation.update({
|
|
681
|
-
release: release.type,
|
|
682
|
-
newVersion: getNextVersion(currentVersion, release)
|
|
683
|
-
});
|
|
684
|
-
}
|
|
685
|
-
}
|
|
686
|
-
function getNextVersion(currentVersion, bump) {
|
|
687
|
-
const oldSemVer = new import_semver.SemVer(currentVersion);
|
|
688
|
-
const type = bump.type === "next" ? oldSemVer.prerelease.length ? "prerelease" : "patch" : bump.type;
|
|
689
|
-
const newSemVer = oldSemVer.inc(type, bump.preid);
|
|
690
|
-
if (isPrerelease(bump.type) && newSemVer.prerelease.length === 2 && newSemVer.prerelease[0] === bump.preid && String(newSemVer.prerelease[1]) === "0") {
|
|
691
|
-
newSemVer.prerelease[1] = "1";
|
|
692
|
-
newSemVer.format();
|
|
693
|
-
}
|
|
694
|
-
return newSemVer.version;
|
|
695
|
-
}
|
|
696
|
-
function getNextVersions(currentVersion, preid) {
|
|
697
|
-
const next = {};
|
|
698
|
-
const parse2 = import_semver.default.parse(currentVersion);
|
|
699
|
-
if (typeof (parse2 == null ? void 0 : parse2.prerelease[0]) === "string")
|
|
700
|
-
preid = (parse2 == null ? void 0 : parse2.prerelease[0]) || "preid";
|
|
701
|
-
for (const type of releaseTypes)
|
|
702
|
-
next[type] = getNextVersion(currentVersion, { type, preid });
|
|
703
|
-
return next;
|
|
704
|
-
}
|
|
705
|
-
async function promptForNewVersion(operation) {
|
|
706
|
-
var _a, _b;
|
|
707
|
-
const { currentVersion } = operation.state;
|
|
708
|
-
const release = operation.options.release;
|
|
709
|
-
const next = getNextVersions(currentVersion, release.preid);
|
|
710
|
-
const configCustomVersion = await ((_b = (_a = operation.options).customVersion) == null ? void 0 : _b.call(_a, currentVersion, import_semver.default));
|
|
711
|
-
const PADDING = 13;
|
|
712
|
-
const answers = await (0, import_prompts.default)([
|
|
713
|
-
{
|
|
714
|
-
type: "autocomplete",
|
|
715
|
-
name: "release",
|
|
716
|
-
message: `Current version ${import_picocolors.default.green(currentVersion)}`,
|
|
717
|
-
initial: configCustomVersion ? "config" : "next",
|
|
718
|
-
choices: [
|
|
719
|
-
{ value: "major", title: `${"major".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.major)}` },
|
|
720
|
-
{ value: "minor", title: `${"minor".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.minor)}` },
|
|
721
|
-
{ value: "patch", title: `${"patch".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.patch)}` },
|
|
722
|
-
{ value: "next", title: `${"next".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.next)}` },
|
|
723
|
-
...configCustomVersion ? [
|
|
724
|
-
{ value: "config", title: `${"from config".padStart(PADDING, " ")} ${import_picocolors.default.bold(configCustomVersion)}` }
|
|
725
|
-
] : [],
|
|
726
|
-
{ value: "prepatch", title: `${"pre-patch".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.prepatch)}` },
|
|
727
|
-
{ value: "preminor", title: `${"pre-minor".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.preminor)}` },
|
|
728
|
-
{ value: "premajor", title: `${"pre-major".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.premajor)}` },
|
|
729
|
-
{ value: "none", title: `${"as-is".padStart(PADDING, " ")} ${import_picocolors.default.bold(currentVersion)}` },
|
|
730
|
-
{ value: "custom", title: "custom ...".padStart(PADDING + 4, " ") }
|
|
731
|
-
]
|
|
732
|
-
},
|
|
733
|
-
{
|
|
734
|
-
type: (prev) => prev === "custom" ? "text" : null,
|
|
735
|
-
name: "custom",
|
|
736
|
-
message: "Enter the new version number:",
|
|
737
|
-
initial: currentVersion,
|
|
738
|
-
validate: (custom) => {
|
|
739
|
-
return (0, import_semver.valid)(custom) ? true : "That's not a valid version number";
|
|
740
|
-
}
|
|
741
|
-
}
|
|
742
|
-
]);
|
|
743
|
-
const newVersion = answers.release === "none" ? currentVersion : answers.release === "custom" ? (0, import_semver.clean)(answers.custom) : answers.release === "config" ? (0, import_semver.clean)(configCustomVersion) : next[answers.release];
|
|
744
|
-
if (!newVersion)
|
|
745
|
-
import_node_process3.default.exit(1);
|
|
746
|
-
switch (answers.release) {
|
|
747
|
-
case "custom":
|
|
748
|
-
case "config":
|
|
749
|
-
case "next":
|
|
750
|
-
case "none":
|
|
751
|
-
return operation.update({ newVersion });
|
|
752
|
-
default:
|
|
753
|
-
return operation.update({ release: answers.release, newVersion });
|
|
754
|
-
}
|
|
755
|
-
}
|
|
756
|
-
|
|
757
668
|
// src/get-current-version.ts
|
|
758
|
-
var
|
|
669
|
+
var import_semver = require("semver");
|
|
759
670
|
|
|
760
671
|
// src/fs.ts
|
|
761
672
|
var import_node_fs = __toESM(require("fs"));
|
|
@@ -843,7 +754,7 @@ async function readVersion(file, cwd) {
|
|
|
843
754
|
try {
|
|
844
755
|
const { data: manifest } = await readJsoncFile(file, cwd);
|
|
845
756
|
if (isManifest(manifest)) {
|
|
846
|
-
if ((0,
|
|
757
|
+
if ((0, import_semver.valid)(manifest.version))
|
|
847
758
|
return manifest.version;
|
|
848
759
|
}
|
|
849
760
|
} catch (e) {
|
|
@@ -851,8 +762,230 @@ async function readVersion(file, cwd) {
|
|
|
851
762
|
}
|
|
852
763
|
}
|
|
853
764
|
|
|
854
|
-
// src/
|
|
765
|
+
// src/get-new-version.ts
|
|
766
|
+
var import_node_process3 = __toESM(require("process"));
|
|
767
|
+
var import_picocolors2 = __toESM(require_picocolors());
|
|
768
|
+
var import_prompts = __toESM(require("prompts"));
|
|
769
|
+
var import_semver2 = __toESM(require("semver"));
|
|
770
|
+
|
|
771
|
+
// src/print-commits.ts
|
|
855
772
|
var ezSpawn = __toESM(require("@jsdevtools/ez-spawn"));
|
|
773
|
+
var import_picocolors = __toESM(require_picocolors());
|
|
774
|
+
var messageColorMap = {
|
|
775
|
+
chore: import_picocolors.default.gray,
|
|
776
|
+
fix: import_picocolors.default.yellow,
|
|
777
|
+
feat: import_picocolors.default.green,
|
|
778
|
+
refactor: import_picocolors.default.cyan,
|
|
779
|
+
docs: import_picocolors.default.blue,
|
|
780
|
+
doc: import_picocolors.default.blue,
|
|
781
|
+
ci: import_picocolors.default.gray,
|
|
782
|
+
build: import_picocolors.default.gray
|
|
783
|
+
};
|
|
784
|
+
function parseCommits(raw) {
|
|
785
|
+
const lines = raw.toString().trim().split(/\n/g);
|
|
786
|
+
if (!lines.length) {
|
|
787
|
+
return [];
|
|
788
|
+
}
|
|
789
|
+
return lines.map((line) => {
|
|
790
|
+
const [hash, ...parts] = line.split(" ");
|
|
791
|
+
const message = parts.join(" ");
|
|
792
|
+
const match = message.match(/^(\w+)(!)?(\([^)]+\))?:(.*)$/);
|
|
793
|
+
if (match) {
|
|
794
|
+
let color = messageColorMap[match[1].toLowerCase()] || ((c4) => c4);
|
|
795
|
+
if (match[2] === "!") {
|
|
796
|
+
color = (s) => import_picocolors.default.inverse(import_picocolors.default.red(s));
|
|
797
|
+
}
|
|
798
|
+
const tag = [match[1], match[2]].filter(Boolean).join("");
|
|
799
|
+
const scope = match[3] || "";
|
|
800
|
+
return {
|
|
801
|
+
hash,
|
|
802
|
+
tag,
|
|
803
|
+
message: match[4].trim(),
|
|
804
|
+
scope,
|
|
805
|
+
breaking: match[2] === "!",
|
|
806
|
+
color
|
|
807
|
+
};
|
|
808
|
+
}
|
|
809
|
+
return {
|
|
810
|
+
hash,
|
|
811
|
+
tag: "",
|
|
812
|
+
message,
|
|
813
|
+
scope: "",
|
|
814
|
+
color: (c4) => c4
|
|
815
|
+
};
|
|
816
|
+
}).reverse();
|
|
817
|
+
}
|
|
818
|
+
function formatParsedCommits(commits) {
|
|
819
|
+
const tagLength = commits.map(({ tag }) => tag.length).reduce((a, b) => Math.max(a, b), 0);
|
|
820
|
+
let scopeLength = commits.map(({ scope }) => scope.length).reduce((a, b) => Math.max(a, b), 0);
|
|
821
|
+
if (scopeLength)
|
|
822
|
+
scopeLength += 2;
|
|
823
|
+
return commits.map(({ hash, tag, message, scope, color }) => {
|
|
824
|
+
const paddedTag = tag.padStart(tagLength + 1, " ");
|
|
825
|
+
const paddedScope = !scope ? " ".repeat(scopeLength) : import_picocolors.default.dim("(") + scope.slice(1, -1) + import_picocolors.default.dim(")") + " ".repeat(scopeLength - scope.length);
|
|
826
|
+
return [
|
|
827
|
+
import_picocolors.default.dim(hash),
|
|
828
|
+
" ",
|
|
829
|
+
color === import_picocolors.default.gray ? color(paddedTag) : import_picocolors.default.bold(color(paddedTag)),
|
|
830
|
+
" ",
|
|
831
|
+
paddedScope,
|
|
832
|
+
import_picocolors.default.dim(":"),
|
|
833
|
+
" ",
|
|
834
|
+
color === import_picocolors.default.gray ? color(message) : message
|
|
835
|
+
].join("");
|
|
836
|
+
});
|
|
837
|
+
}
|
|
838
|
+
async function printRecentCommits(operation) {
|
|
839
|
+
let sha;
|
|
840
|
+
sha || (sha = await ezSpawn.async(
|
|
841
|
+
"git",
|
|
842
|
+
["rev-list", "-n", "1", `v${operation.state.currentVersion}`],
|
|
843
|
+
{ stdio: "pipe" }
|
|
844
|
+
).then((res) => res.stdout.trim()).catch(() => void 0));
|
|
845
|
+
sha || (sha = await ezSpawn.async(
|
|
846
|
+
"git",
|
|
847
|
+
["rev-list", "-n", "1", operation.state.currentVersion],
|
|
848
|
+
{ stdio: "pipe" }
|
|
849
|
+
).then((res) => res.stdout.trim()).catch(() => void 0));
|
|
850
|
+
if (!sha) {
|
|
851
|
+
console.log(
|
|
852
|
+
import_picocolors.default.blue(`i`) + import_picocolors.default.gray(` Failed to locate the previous tag ${import_picocolors.default.yellow(`v${operation.state.currentVersion}`)}`)
|
|
853
|
+
);
|
|
854
|
+
return;
|
|
855
|
+
}
|
|
856
|
+
const { stdout } = await ezSpawn.async(
|
|
857
|
+
"git",
|
|
858
|
+
[
|
|
859
|
+
"--no-pager",
|
|
860
|
+
"log",
|
|
861
|
+
`${sha}..HEAD`,
|
|
862
|
+
"--oneline"
|
|
863
|
+
],
|
|
864
|
+
{ stdio: "pipe" }
|
|
865
|
+
);
|
|
866
|
+
const parsed = parseCommits(stdout.toString().trim());
|
|
867
|
+
const prettified = formatParsedCommits(parsed);
|
|
868
|
+
if (!parsed.length) {
|
|
869
|
+
console.log();
|
|
870
|
+
console.log(import_picocolors.default.blue(`i`) + import_picocolors.default.gray(` No commits since ${operation.state.currentVersion}`));
|
|
871
|
+
console.log();
|
|
872
|
+
return;
|
|
873
|
+
}
|
|
874
|
+
console.log();
|
|
875
|
+
console.log(
|
|
876
|
+
import_picocolors.default.bold(
|
|
877
|
+
`${import_picocolors.default.green(parsed.length)} Commits since ${import_picocolors.default.gray(sha.slice(0, 7))}:`
|
|
878
|
+
)
|
|
879
|
+
);
|
|
880
|
+
console.log();
|
|
881
|
+
console.log(prettified.join("\n"));
|
|
882
|
+
console.log();
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
// src/release-type.ts
|
|
886
|
+
var prereleaseTypes = ["premajor", "preminor", "prepatch", "prerelease"];
|
|
887
|
+
var releaseTypes = prereleaseTypes.concat(["major", "minor", "patch", "next"]);
|
|
888
|
+
function isPrerelease(value) {
|
|
889
|
+
return prereleaseTypes.includes(value);
|
|
890
|
+
}
|
|
891
|
+
function isReleaseType(value) {
|
|
892
|
+
return releaseTypes.includes(value);
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
// src/get-new-version.ts
|
|
896
|
+
async function getNewVersion(operation) {
|
|
897
|
+
const { release } = operation.options;
|
|
898
|
+
const { currentVersion } = operation.state;
|
|
899
|
+
switch (release.type) {
|
|
900
|
+
case "prompt":
|
|
901
|
+
return promptForNewVersion(operation);
|
|
902
|
+
case "version":
|
|
903
|
+
return operation.update({
|
|
904
|
+
newVersion: new import_semver2.SemVer(release.version, true).version
|
|
905
|
+
});
|
|
906
|
+
default:
|
|
907
|
+
return operation.update({
|
|
908
|
+
release: release.type,
|
|
909
|
+
newVersion: getNextVersion(currentVersion, release)
|
|
910
|
+
});
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
function getNextVersion(currentVersion, bump) {
|
|
914
|
+
const oldSemVer = new import_semver2.SemVer(currentVersion);
|
|
915
|
+
const type = bump.type === "next" ? oldSemVer.prerelease.length ? "prerelease" : "patch" : bump.type;
|
|
916
|
+
const newSemVer = oldSemVer.inc(type, bump.preid);
|
|
917
|
+
if (isPrerelease(bump.type) && newSemVer.prerelease.length === 2 && newSemVer.prerelease[0] === bump.preid && String(newSemVer.prerelease[1]) === "0") {
|
|
918
|
+
newSemVer.prerelease[1] = "1";
|
|
919
|
+
newSemVer.format();
|
|
920
|
+
}
|
|
921
|
+
return newSemVer.version;
|
|
922
|
+
}
|
|
923
|
+
function getNextVersions(currentVersion, preid) {
|
|
924
|
+
const next = {};
|
|
925
|
+
const parse2 = import_semver2.default.parse(currentVersion);
|
|
926
|
+
if (typeof (parse2 == null ? void 0 : parse2.prerelease[0]) === "string")
|
|
927
|
+
preid = (parse2 == null ? void 0 : parse2.prerelease[0]) || "preid";
|
|
928
|
+
for (const type of releaseTypes)
|
|
929
|
+
next[type] = getNextVersion(currentVersion, { type, preid });
|
|
930
|
+
return next;
|
|
931
|
+
}
|
|
932
|
+
async function promptForNewVersion(operation) {
|
|
933
|
+
var _a, _b;
|
|
934
|
+
const { currentVersion } = operation.state;
|
|
935
|
+
const release = operation.options.release;
|
|
936
|
+
const next = getNextVersions(currentVersion, release.preid);
|
|
937
|
+
const configCustomVersion = await ((_b = (_a = operation.options).customVersion) == null ? void 0 : _b.call(_a, currentVersion, import_semver2.default));
|
|
938
|
+
if (operation.options.printCommits) {
|
|
939
|
+
await printRecentCommits(operation);
|
|
940
|
+
}
|
|
941
|
+
const PADDING = 13;
|
|
942
|
+
const answers = await (0, import_prompts.default)([
|
|
943
|
+
{
|
|
944
|
+
type: "autocomplete",
|
|
945
|
+
name: "release",
|
|
946
|
+
message: `Current version ${import_picocolors2.default.green(currentVersion)}`,
|
|
947
|
+
initial: configCustomVersion ? "config" : "next",
|
|
948
|
+
choices: [
|
|
949
|
+
{ value: "major", title: `${"major".padStart(PADDING, " ")} ${import_picocolors2.default.bold(next.major)}` },
|
|
950
|
+
{ value: "minor", title: `${"minor".padStart(PADDING, " ")} ${import_picocolors2.default.bold(next.minor)}` },
|
|
951
|
+
{ value: "patch", title: `${"patch".padStart(PADDING, " ")} ${import_picocolors2.default.bold(next.patch)}` },
|
|
952
|
+
{ value: "next", title: `${"next".padStart(PADDING, " ")} ${import_picocolors2.default.bold(next.next)}` },
|
|
953
|
+
...configCustomVersion ? [
|
|
954
|
+
{ value: "config", title: `${"from config".padStart(PADDING, " ")} ${import_picocolors2.default.bold(configCustomVersion)}` }
|
|
955
|
+
] : [],
|
|
956
|
+
{ value: "prepatch", title: `${"pre-patch".padStart(PADDING, " ")} ${import_picocolors2.default.bold(next.prepatch)}` },
|
|
957
|
+
{ value: "preminor", title: `${"pre-minor".padStart(PADDING, " ")} ${import_picocolors2.default.bold(next.preminor)}` },
|
|
958
|
+
{ value: "premajor", title: `${"pre-major".padStart(PADDING, " ")} ${import_picocolors2.default.bold(next.premajor)}` },
|
|
959
|
+
{ value: "none", title: `${"as-is".padStart(PADDING, " ")} ${import_picocolors2.default.bold(currentVersion)}` },
|
|
960
|
+
{ value: "custom", title: "custom ...".padStart(PADDING + 4, " ") }
|
|
961
|
+
]
|
|
962
|
+
},
|
|
963
|
+
{
|
|
964
|
+
type: (prev) => prev === "custom" ? "text" : null,
|
|
965
|
+
name: "custom",
|
|
966
|
+
message: "Enter the new version number:",
|
|
967
|
+
initial: currentVersion,
|
|
968
|
+
validate: (custom) => {
|
|
969
|
+
return (0, import_semver2.valid)(custom) ? true : "That's not a valid version number";
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
]);
|
|
973
|
+
const newVersion = answers.release === "none" ? currentVersion : answers.release === "custom" ? (0, import_semver2.clean)(answers.custom) : answers.release === "config" ? (0, import_semver2.clean)(configCustomVersion) : next[answers.release];
|
|
974
|
+
if (!newVersion)
|
|
975
|
+
import_node_process3.default.exit(1);
|
|
976
|
+
switch (answers.release) {
|
|
977
|
+
case "custom":
|
|
978
|
+
case "config":
|
|
979
|
+
case "next":
|
|
980
|
+
case "none":
|
|
981
|
+
return operation.update({ newVersion });
|
|
982
|
+
default:
|
|
983
|
+
return operation.update({ release: answers.release, newVersion });
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
// src/git.ts
|
|
988
|
+
var ezSpawn2 = __toESM(require("@jsdevtools/ez-spawn"));
|
|
856
989
|
|
|
857
990
|
// src/types/version-bump-progress.ts
|
|
858
991
|
var ProgressEvent = /* @__PURE__ */ ((ProgressEvent2) => {
|
|
@@ -888,7 +1021,7 @@ async function gitCommit(operation) {
|
|
|
888
1021
|
args.push("--message", commitMessage);
|
|
889
1022
|
if (!all)
|
|
890
1023
|
args = args.concat(updatedFiles);
|
|
891
|
-
await
|
|
1024
|
+
await ezSpawn2.async("git", ["commit", ...args]);
|
|
892
1025
|
return operation.update({ event: "git commit" /* GitCommit */, commitMessage });
|
|
893
1026
|
}
|
|
894
1027
|
async function gitTag(operation) {
|
|
@@ -906,15 +1039,15 @@ async function gitTag(operation) {
|
|
|
906
1039
|
];
|
|
907
1040
|
const tagName = formatVersionString(tag.name, newVersion);
|
|
908
1041
|
args.push(tagName);
|
|
909
|
-
await
|
|
1042
|
+
await ezSpawn2.async("git", ["tag", ...args]);
|
|
910
1043
|
return operation.update({ event: "git tag" /* GitTag */, tagName });
|
|
911
1044
|
}
|
|
912
1045
|
async function gitPush(operation) {
|
|
913
1046
|
if (!operation.options.push)
|
|
914
1047
|
return operation;
|
|
915
|
-
await
|
|
1048
|
+
await ezSpawn2.async("git", "push");
|
|
916
1049
|
if (operation.options.tag) {
|
|
917
|
-
await
|
|
1050
|
+
await ezSpawn2.async("git", ["push", "--tags"]);
|
|
918
1051
|
}
|
|
919
1052
|
return operation.update({ event: "git push" /* GitPush */ });
|
|
920
1053
|
}
|
|
@@ -926,13 +1059,13 @@ function formatVersionString(template, newVersion) {
|
|
|
926
1059
|
}
|
|
927
1060
|
|
|
928
1061
|
// src/normalize-options.ts
|
|
929
|
-
var import_node_process4 = __toESM(require("process"));
|
|
930
|
-
var import_promises = __toESM(require("fs/promises"));
|
|
931
1062
|
var import_node_fs2 = __toESM(require("fs"));
|
|
1063
|
+
var import_promises = __toESM(require("fs/promises"));
|
|
1064
|
+
var import_node_process4 = __toESM(require("process"));
|
|
932
1065
|
var import_fast_glob = __toESM(require("fast-glob"));
|
|
933
1066
|
var import_js_yaml = __toESM(require("js-yaml"));
|
|
934
1067
|
async function normalizeOptions(raw) {
|
|
935
|
-
var _a, _b;
|
|
1068
|
+
var _a, _b, _d;
|
|
936
1069
|
const preid = typeof raw.preid === "string" ? raw.preid : "beta";
|
|
937
1070
|
const push = Boolean(raw.push);
|
|
938
1071
|
const all = Boolean(raw.all);
|
|
@@ -1016,6 +1149,7 @@ async function normalizeOptions(raw) {
|
|
|
1016
1149
|
interface: ui,
|
|
1017
1150
|
ignoreScripts,
|
|
1018
1151
|
execute,
|
|
1152
|
+
printCommits: (_d = raw.printCommits) != null ? _d : true,
|
|
1019
1153
|
customVersion: raw.customVersion,
|
|
1020
1154
|
currentVersion: raw.currentVersion
|
|
1021
1155
|
};
|
|
@@ -1086,13 +1220,13 @@ var Operation = class _Operation {
|
|
|
1086
1220
|
};
|
|
1087
1221
|
|
|
1088
1222
|
// src/run-npm-script.ts
|
|
1089
|
-
var
|
|
1223
|
+
var ezSpawn3 = __toESM(require("@jsdevtools/ez-spawn"));
|
|
1090
1224
|
async function runNpmScript(script, operation) {
|
|
1091
1225
|
const { cwd, ignoreScripts } = operation.options;
|
|
1092
1226
|
if (!ignoreScripts) {
|
|
1093
1227
|
const { data: manifest } = await readJsoncFile("package.json", cwd);
|
|
1094
1228
|
if (isManifest(manifest) && hasScript(manifest, script)) {
|
|
1095
|
-
await
|
|
1229
|
+
await ezSpawn3.async("npm", ["run", script, "--silent"], { stdio: "inherit" });
|
|
1096
1230
|
operation.update({ event: "npm script" /* NpmScript */, script });
|
|
1097
1231
|
}
|
|
1098
1232
|
}
|
|
@@ -1106,8 +1240,8 @@ function hasScript(manifest, script) {
|
|
|
1106
1240
|
}
|
|
1107
1241
|
|
|
1108
1242
|
// src/update-files.ts
|
|
1109
|
-
var path2 = __toESM(require("path"));
|
|
1110
1243
|
var import_node_fs3 = require("fs");
|
|
1244
|
+
var path2 = __toESM(require("path"));
|
|
1111
1245
|
async function updateFiles(operation) {
|
|
1112
1246
|
const { files } = operation.options;
|
|
1113
1247
|
for (const relPath of files) {
|
|
@@ -1196,7 +1330,7 @@ async function versionBump(arg = {}) {
|
|
|
1196
1330
|
await updateFiles(operation);
|
|
1197
1331
|
if (operation.options.execute) {
|
|
1198
1332
|
console.log(log_symbols_default.info, "Executing script", operation.options.execute);
|
|
1199
|
-
await
|
|
1333
|
+
await ezSpawn4.async(operation.options.execute, { stdio: "inherit" });
|
|
1200
1334
|
console.log(log_symbols_default.success, "Script finished");
|
|
1201
1335
|
}
|
|
1202
1336
|
await runNpmScript("version" /* Version */, operation);
|
|
@@ -1208,18 +1342,18 @@ async function versionBump(arg = {}) {
|
|
|
1208
1342
|
}
|
|
1209
1343
|
function printSummary(operation) {
|
|
1210
1344
|
console.log();
|
|
1211
|
-
console.log(` files ${operation.options.files.map((i) =>
|
|
1345
|
+
console.log(` files ${operation.options.files.map((i) => import_picocolors3.default.bold(i)).join("\n ")}`);
|
|
1212
1346
|
if (operation.options.commit)
|
|
1213
|
-
console.log(` commit ${
|
|
1347
|
+
console.log(` commit ${import_picocolors3.default.bold(formatVersionString(operation.options.commit.message, operation.state.newVersion))}`);
|
|
1214
1348
|
if (operation.options.tag)
|
|
1215
|
-
console.log(` tag ${
|
|
1349
|
+
console.log(` tag ${import_picocolors3.default.bold(formatVersionString(operation.options.tag.name, operation.state.newVersion))}`);
|
|
1216
1350
|
if (operation.options.execute)
|
|
1217
|
-
console.log(` execute ${
|
|
1351
|
+
console.log(` execute ${import_picocolors3.default.bold(operation.options.execute)}`);
|
|
1218
1352
|
if (operation.options.push)
|
|
1219
|
-
console.log(` push ${
|
|
1353
|
+
console.log(` push ${import_picocolors3.default.cyan(import_picocolors3.default.bold("yes"))}`);
|
|
1220
1354
|
console.log();
|
|
1221
|
-
console.log(` from ${
|
|
1222
|
-
console.log(` to ${
|
|
1355
|
+
console.log(` from ${import_picocolors3.default.bold(operation.state.currentVersion)}`);
|
|
1356
|
+
console.log(` to ${import_picocolors3.default.green(import_picocolors3.default.bold(operation.state.newVersion))}`);
|
|
1223
1357
|
console.log();
|
|
1224
1358
|
}
|
|
1225
1359
|
async function versionBumpInfo(arg = {}) {
|
|
@@ -1232,8 +1366,8 @@ async function versionBumpInfo(arg = {}) {
|
|
|
1232
1366
|
}
|
|
1233
1367
|
|
|
1234
1368
|
// src/config.ts
|
|
1235
|
-
var import_node_process6 = __toESM(require("process"));
|
|
1236
1369
|
var import_node_path2 = require("path");
|
|
1370
|
+
var import_node_process6 = __toESM(require("process"));
|
|
1237
1371
|
var import_c12 = require("c12");
|
|
1238
1372
|
var import_sync = __toESM(require("escalade/sync"));
|
|
1239
1373
|
var bumpConfigDefaults = {
|
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bumpp",
|
|
3
|
-
"version": "9.
|
|
4
|
-
"packageManager": "pnpm@9.
|
|
3
|
+
"version": "9.6.1",
|
|
4
|
+
"packageManager": "pnpm@9.11.0",
|
|
5
5
|
"description": "Bump version, commit changes, tag, and push to Git",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "James Messinger",
|
|
@@ -60,9 +60,9 @@
|
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"@jsdevtools/ez-spawn": "^3.0.4",
|
|
63
|
-
"c12": "^1.11.
|
|
63
|
+
"c12": "^1.11.2",
|
|
64
64
|
"cac": "^6.7.14",
|
|
65
|
-
"escalade": "^3.
|
|
65
|
+
"escalade": "^3.2.0",
|
|
66
66
|
"fast-glob": "^3.3.2",
|
|
67
67
|
"js-yaml": "^4.1.0",
|
|
68
68
|
"jsonc-parser": "^3.3.1",
|
|
@@ -70,19 +70,19 @@
|
|
|
70
70
|
"semver": "^7.6.3"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
|
-
"@antfu/eslint-config": "^
|
|
73
|
+
"@antfu/eslint-config": "^3.7.3",
|
|
74
74
|
"@types/js-yaml": "^4.0.9",
|
|
75
|
-
"@types/node": "^22.
|
|
75
|
+
"@types/node": "^22.7.4",
|
|
76
76
|
"@types/prompts": "^2.4.9",
|
|
77
77
|
"@types/semver": "^7.5.8",
|
|
78
|
-
"eslint": "^9.
|
|
78
|
+
"eslint": "^9.11.1",
|
|
79
79
|
"esno": "^4.7.0",
|
|
80
80
|
"log-symbols": "^6.0.0",
|
|
81
81
|
"npm-check": "^6.0.1",
|
|
82
|
-
"picocolors": "^1.0
|
|
82
|
+
"picocolors": "^1.1.0",
|
|
83
83
|
"rimraf": "^6.0.1",
|
|
84
|
-
"tsup": "^8.
|
|
85
|
-
"typescript": "^5.
|
|
86
|
-
"vitest": "^2.
|
|
84
|
+
"tsup": "^8.3.0",
|
|
85
|
+
"typescript": "^5.6.2",
|
|
86
|
+
"vitest": "^2.1.1"
|
|
87
87
|
}
|
|
88
88
|
}
|