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/cli/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();
|
|
@@ -636,121 +652,16 @@ var logSymbols = isUnicodeSupported() ? main : fallback;
|
|
|
636
652
|
var log_symbols_default = logSymbols;
|
|
637
653
|
|
|
638
654
|
// package.json
|
|
639
|
-
var version = "9.
|
|
655
|
+
var version = "9.6.1";
|
|
640
656
|
|
|
641
657
|
// src/version-bump.ts
|
|
642
658
|
var import_node_process5 = __toESM(require("process"));
|
|
643
|
-
var
|
|
644
|
-
var
|
|
659
|
+
var ezSpawn4 = __toESM(require("@jsdevtools/ez-spawn"));
|
|
660
|
+
var import_picocolors3 = __toESM(require_picocolors());
|
|
645
661
|
var import_prompts2 = __toESM(require("prompts"));
|
|
646
662
|
|
|
647
|
-
// src/get-new-version.ts
|
|
648
|
-
var import_node_process3 = __toESM(require("process"));
|
|
649
|
-
var import_picocolors = __toESM(require_picocolors());
|
|
650
|
-
var import_prompts = __toESM(require("prompts"));
|
|
651
|
-
var import_semver = __toESM(require("semver"));
|
|
652
|
-
|
|
653
|
-
// src/release-type.ts
|
|
654
|
-
var prereleaseTypes = ["premajor", "preminor", "prepatch", "prerelease"];
|
|
655
|
-
var releaseTypes = prereleaseTypes.concat(["major", "minor", "patch", "next"]);
|
|
656
|
-
function isPrerelease(value) {
|
|
657
|
-
return prereleaseTypes.includes(value);
|
|
658
|
-
}
|
|
659
|
-
function isReleaseType(value) {
|
|
660
|
-
return releaseTypes.includes(value);
|
|
661
|
-
}
|
|
662
|
-
|
|
663
|
-
// src/get-new-version.ts
|
|
664
|
-
async function getNewVersion(operation) {
|
|
665
|
-
const { release } = operation.options;
|
|
666
|
-
const { currentVersion } = operation.state;
|
|
667
|
-
switch (release.type) {
|
|
668
|
-
case "prompt":
|
|
669
|
-
return promptForNewVersion(operation);
|
|
670
|
-
case "version":
|
|
671
|
-
return operation.update({
|
|
672
|
-
newVersion: new import_semver.SemVer(release.version, true).version
|
|
673
|
-
});
|
|
674
|
-
default:
|
|
675
|
-
return operation.update({
|
|
676
|
-
release: release.type,
|
|
677
|
-
newVersion: getNextVersion(currentVersion, release)
|
|
678
|
-
});
|
|
679
|
-
}
|
|
680
|
-
}
|
|
681
|
-
function getNextVersion(currentVersion, bump) {
|
|
682
|
-
const oldSemVer = new import_semver.SemVer(currentVersion);
|
|
683
|
-
const type = bump.type === "next" ? oldSemVer.prerelease.length ? "prerelease" : "patch" : bump.type;
|
|
684
|
-
const newSemVer = oldSemVer.inc(type, bump.preid);
|
|
685
|
-
if (isPrerelease(bump.type) && newSemVer.prerelease.length === 2 && newSemVer.prerelease[0] === bump.preid && String(newSemVer.prerelease[1]) === "0") {
|
|
686
|
-
newSemVer.prerelease[1] = "1";
|
|
687
|
-
newSemVer.format();
|
|
688
|
-
}
|
|
689
|
-
return newSemVer.version;
|
|
690
|
-
}
|
|
691
|
-
function getNextVersions(currentVersion, preid) {
|
|
692
|
-
const next = {};
|
|
693
|
-
const parse2 = import_semver.default.parse(currentVersion);
|
|
694
|
-
if (typeof (parse2 == null ? void 0 : parse2.prerelease[0]) === "string")
|
|
695
|
-
preid = (parse2 == null ? void 0 : parse2.prerelease[0]) || "preid";
|
|
696
|
-
for (const type of releaseTypes)
|
|
697
|
-
next[type] = getNextVersion(currentVersion, { type, preid });
|
|
698
|
-
return next;
|
|
699
|
-
}
|
|
700
|
-
async function promptForNewVersion(operation) {
|
|
701
|
-
var _a, _b;
|
|
702
|
-
const { currentVersion } = operation.state;
|
|
703
|
-
const release = operation.options.release;
|
|
704
|
-
const next = getNextVersions(currentVersion, release.preid);
|
|
705
|
-
const configCustomVersion = await ((_b = (_a = operation.options).customVersion) == null ? void 0 : _b.call(_a, currentVersion, import_semver.default));
|
|
706
|
-
const PADDING = 13;
|
|
707
|
-
const answers = await (0, import_prompts.default)([
|
|
708
|
-
{
|
|
709
|
-
type: "autocomplete",
|
|
710
|
-
name: "release",
|
|
711
|
-
message: `Current version ${import_picocolors.default.green(currentVersion)}`,
|
|
712
|
-
initial: configCustomVersion ? "config" : "next",
|
|
713
|
-
choices: [
|
|
714
|
-
{ value: "major", title: `${"major".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.major)}` },
|
|
715
|
-
{ value: "minor", title: `${"minor".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.minor)}` },
|
|
716
|
-
{ value: "patch", title: `${"patch".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.patch)}` },
|
|
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
|
-
] : [],
|
|
721
|
-
{ value: "prepatch", title: `${"pre-patch".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.prepatch)}` },
|
|
722
|
-
{ value: "preminor", title: `${"pre-minor".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.preminor)}` },
|
|
723
|
-
{ value: "premajor", title: `${"pre-major".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.premajor)}` },
|
|
724
|
-
{ value: "none", title: `${"as-is".padStart(PADDING, " ")} ${import_picocolors.default.bold(currentVersion)}` },
|
|
725
|
-
{ value: "custom", title: "custom ...".padStart(PADDING + 4, " ") }
|
|
726
|
-
]
|
|
727
|
-
},
|
|
728
|
-
{
|
|
729
|
-
type: (prev) => prev === "custom" ? "text" : null,
|
|
730
|
-
name: "custom",
|
|
731
|
-
message: "Enter the new version number:",
|
|
732
|
-
initial: currentVersion,
|
|
733
|
-
validate: (custom) => {
|
|
734
|
-
return (0, import_semver.valid)(custom) ? true : "That's not a valid version number";
|
|
735
|
-
}
|
|
736
|
-
}
|
|
737
|
-
]);
|
|
738
|
-
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];
|
|
739
|
-
if (!newVersion)
|
|
740
|
-
import_node_process3.default.exit(1);
|
|
741
|
-
switch (answers.release) {
|
|
742
|
-
case "custom":
|
|
743
|
-
case "config":
|
|
744
|
-
case "next":
|
|
745
|
-
case "none":
|
|
746
|
-
return operation.update({ newVersion });
|
|
747
|
-
default:
|
|
748
|
-
return operation.update({ release: answers.release, newVersion });
|
|
749
|
-
}
|
|
750
|
-
}
|
|
751
|
-
|
|
752
663
|
// src/get-current-version.ts
|
|
753
|
-
var
|
|
664
|
+
var import_semver = require("semver");
|
|
754
665
|
|
|
755
666
|
// src/fs.ts
|
|
756
667
|
var import_node_fs = __toESM(require("fs"));
|
|
@@ -838,7 +749,7 @@ async function readVersion(file, cwd) {
|
|
|
838
749
|
try {
|
|
839
750
|
const { data: manifest } = await readJsoncFile(file, cwd);
|
|
840
751
|
if (isManifest(manifest)) {
|
|
841
|
-
if ((0,
|
|
752
|
+
if ((0, import_semver.valid)(manifest.version))
|
|
842
753
|
return manifest.version;
|
|
843
754
|
}
|
|
844
755
|
} catch (e) {
|
|
@@ -846,8 +757,230 @@ async function readVersion(file, cwd) {
|
|
|
846
757
|
}
|
|
847
758
|
}
|
|
848
759
|
|
|
849
|
-
// src/
|
|
760
|
+
// src/get-new-version.ts
|
|
761
|
+
var import_node_process3 = __toESM(require("process"));
|
|
762
|
+
var import_picocolors2 = __toESM(require_picocolors());
|
|
763
|
+
var import_prompts = __toESM(require("prompts"));
|
|
764
|
+
var import_semver2 = __toESM(require("semver"));
|
|
765
|
+
|
|
766
|
+
// src/print-commits.ts
|
|
850
767
|
var ezSpawn = __toESM(require("@jsdevtools/ez-spawn"));
|
|
768
|
+
var import_picocolors = __toESM(require_picocolors());
|
|
769
|
+
var messageColorMap = {
|
|
770
|
+
chore: import_picocolors.default.gray,
|
|
771
|
+
fix: import_picocolors.default.yellow,
|
|
772
|
+
feat: import_picocolors.default.green,
|
|
773
|
+
refactor: import_picocolors.default.cyan,
|
|
774
|
+
docs: import_picocolors.default.blue,
|
|
775
|
+
doc: import_picocolors.default.blue,
|
|
776
|
+
ci: import_picocolors.default.gray,
|
|
777
|
+
build: import_picocolors.default.gray
|
|
778
|
+
};
|
|
779
|
+
function parseCommits(raw) {
|
|
780
|
+
const lines = raw.toString().trim().split(/\n/g);
|
|
781
|
+
if (!lines.length) {
|
|
782
|
+
return [];
|
|
783
|
+
}
|
|
784
|
+
return lines.map((line) => {
|
|
785
|
+
const [hash, ...parts] = line.split(" ");
|
|
786
|
+
const message = parts.join(" ");
|
|
787
|
+
const match = message.match(/^(\w+)(!)?(\([^)]+\))?:(.*)$/);
|
|
788
|
+
if (match) {
|
|
789
|
+
let color = messageColorMap[match[1].toLowerCase()] || ((c5) => c5);
|
|
790
|
+
if (match[2] === "!") {
|
|
791
|
+
color = (s) => import_picocolors.default.inverse(import_picocolors.default.red(s));
|
|
792
|
+
}
|
|
793
|
+
const tag = [match[1], match[2]].filter(Boolean).join("");
|
|
794
|
+
const scope = match[3] || "";
|
|
795
|
+
return {
|
|
796
|
+
hash,
|
|
797
|
+
tag,
|
|
798
|
+
message: match[4].trim(),
|
|
799
|
+
scope,
|
|
800
|
+
breaking: match[2] === "!",
|
|
801
|
+
color
|
|
802
|
+
};
|
|
803
|
+
}
|
|
804
|
+
return {
|
|
805
|
+
hash,
|
|
806
|
+
tag: "",
|
|
807
|
+
message,
|
|
808
|
+
scope: "",
|
|
809
|
+
color: (c5) => c5
|
|
810
|
+
};
|
|
811
|
+
}).reverse();
|
|
812
|
+
}
|
|
813
|
+
function formatParsedCommits(commits) {
|
|
814
|
+
const tagLength = commits.map(({ tag }) => tag.length).reduce((a, b) => Math.max(a, b), 0);
|
|
815
|
+
let scopeLength = commits.map(({ scope }) => scope.length).reduce((a, b) => Math.max(a, b), 0);
|
|
816
|
+
if (scopeLength)
|
|
817
|
+
scopeLength += 2;
|
|
818
|
+
return commits.map(({ hash, tag, message, scope, color }) => {
|
|
819
|
+
const paddedTag = tag.padStart(tagLength + 1, " ");
|
|
820
|
+
const paddedScope = !scope ? " ".repeat(scopeLength) : import_picocolors.default.dim("(") + scope.slice(1, -1) + import_picocolors.default.dim(")") + " ".repeat(scopeLength - scope.length);
|
|
821
|
+
return [
|
|
822
|
+
import_picocolors.default.dim(hash),
|
|
823
|
+
" ",
|
|
824
|
+
color === import_picocolors.default.gray ? color(paddedTag) : import_picocolors.default.bold(color(paddedTag)),
|
|
825
|
+
" ",
|
|
826
|
+
paddedScope,
|
|
827
|
+
import_picocolors.default.dim(":"),
|
|
828
|
+
" ",
|
|
829
|
+
color === import_picocolors.default.gray ? color(message) : message
|
|
830
|
+
].join("");
|
|
831
|
+
});
|
|
832
|
+
}
|
|
833
|
+
async function printRecentCommits(operation) {
|
|
834
|
+
let sha;
|
|
835
|
+
sha || (sha = await ezSpawn.async(
|
|
836
|
+
"git",
|
|
837
|
+
["rev-list", "-n", "1", `v${operation.state.currentVersion}`],
|
|
838
|
+
{ stdio: "pipe" }
|
|
839
|
+
).then((res) => res.stdout.trim()).catch(() => void 0));
|
|
840
|
+
sha || (sha = await ezSpawn.async(
|
|
841
|
+
"git",
|
|
842
|
+
["rev-list", "-n", "1", operation.state.currentVersion],
|
|
843
|
+
{ stdio: "pipe" }
|
|
844
|
+
).then((res) => res.stdout.trim()).catch(() => void 0));
|
|
845
|
+
if (!sha) {
|
|
846
|
+
console.log(
|
|
847
|
+
import_picocolors.default.blue(`i`) + import_picocolors.default.gray(` Failed to locate the previous tag ${import_picocolors.default.yellow(`v${operation.state.currentVersion}`)}`)
|
|
848
|
+
);
|
|
849
|
+
return;
|
|
850
|
+
}
|
|
851
|
+
const { stdout } = await ezSpawn.async(
|
|
852
|
+
"git",
|
|
853
|
+
[
|
|
854
|
+
"--no-pager",
|
|
855
|
+
"log",
|
|
856
|
+
`${sha}..HEAD`,
|
|
857
|
+
"--oneline"
|
|
858
|
+
],
|
|
859
|
+
{ stdio: "pipe" }
|
|
860
|
+
);
|
|
861
|
+
const parsed = parseCommits(stdout.toString().trim());
|
|
862
|
+
const prettified = formatParsedCommits(parsed);
|
|
863
|
+
if (!parsed.length) {
|
|
864
|
+
console.log();
|
|
865
|
+
console.log(import_picocolors.default.blue(`i`) + import_picocolors.default.gray(` No commits since ${operation.state.currentVersion}`));
|
|
866
|
+
console.log();
|
|
867
|
+
return;
|
|
868
|
+
}
|
|
869
|
+
console.log();
|
|
870
|
+
console.log(
|
|
871
|
+
import_picocolors.default.bold(
|
|
872
|
+
`${import_picocolors.default.green(parsed.length)} Commits since ${import_picocolors.default.gray(sha.slice(0, 7))}:`
|
|
873
|
+
)
|
|
874
|
+
);
|
|
875
|
+
console.log();
|
|
876
|
+
console.log(prettified.join("\n"));
|
|
877
|
+
console.log();
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
// src/release-type.ts
|
|
881
|
+
var prereleaseTypes = ["premajor", "preminor", "prepatch", "prerelease"];
|
|
882
|
+
var releaseTypes = prereleaseTypes.concat(["major", "minor", "patch", "next"]);
|
|
883
|
+
function isPrerelease(value) {
|
|
884
|
+
return prereleaseTypes.includes(value);
|
|
885
|
+
}
|
|
886
|
+
function isReleaseType(value) {
|
|
887
|
+
return releaseTypes.includes(value);
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
// src/get-new-version.ts
|
|
891
|
+
async function getNewVersion(operation) {
|
|
892
|
+
const { release } = operation.options;
|
|
893
|
+
const { currentVersion } = operation.state;
|
|
894
|
+
switch (release.type) {
|
|
895
|
+
case "prompt":
|
|
896
|
+
return promptForNewVersion(operation);
|
|
897
|
+
case "version":
|
|
898
|
+
return operation.update({
|
|
899
|
+
newVersion: new import_semver2.SemVer(release.version, true).version
|
|
900
|
+
});
|
|
901
|
+
default:
|
|
902
|
+
return operation.update({
|
|
903
|
+
release: release.type,
|
|
904
|
+
newVersion: getNextVersion(currentVersion, release)
|
|
905
|
+
});
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
function getNextVersion(currentVersion, bump) {
|
|
909
|
+
const oldSemVer = new import_semver2.SemVer(currentVersion);
|
|
910
|
+
const type = bump.type === "next" ? oldSemVer.prerelease.length ? "prerelease" : "patch" : bump.type;
|
|
911
|
+
const newSemVer = oldSemVer.inc(type, bump.preid);
|
|
912
|
+
if (isPrerelease(bump.type) && newSemVer.prerelease.length === 2 && newSemVer.prerelease[0] === bump.preid && String(newSemVer.prerelease[1]) === "0") {
|
|
913
|
+
newSemVer.prerelease[1] = "1";
|
|
914
|
+
newSemVer.format();
|
|
915
|
+
}
|
|
916
|
+
return newSemVer.version;
|
|
917
|
+
}
|
|
918
|
+
function getNextVersions(currentVersion, preid) {
|
|
919
|
+
const next = {};
|
|
920
|
+
const parse2 = import_semver2.default.parse(currentVersion);
|
|
921
|
+
if (typeof (parse2 == null ? void 0 : parse2.prerelease[0]) === "string")
|
|
922
|
+
preid = (parse2 == null ? void 0 : parse2.prerelease[0]) || "preid";
|
|
923
|
+
for (const type of releaseTypes)
|
|
924
|
+
next[type] = getNextVersion(currentVersion, { type, preid });
|
|
925
|
+
return next;
|
|
926
|
+
}
|
|
927
|
+
async function promptForNewVersion(operation) {
|
|
928
|
+
var _a, _b;
|
|
929
|
+
const { currentVersion } = operation.state;
|
|
930
|
+
const release = operation.options.release;
|
|
931
|
+
const next = getNextVersions(currentVersion, release.preid);
|
|
932
|
+
const configCustomVersion = await ((_b = (_a = operation.options).customVersion) == null ? void 0 : _b.call(_a, currentVersion, import_semver2.default));
|
|
933
|
+
if (operation.options.printCommits) {
|
|
934
|
+
await printRecentCommits(operation);
|
|
935
|
+
}
|
|
936
|
+
const PADDING = 13;
|
|
937
|
+
const answers = await (0, import_prompts.default)([
|
|
938
|
+
{
|
|
939
|
+
type: "autocomplete",
|
|
940
|
+
name: "release",
|
|
941
|
+
message: `Current version ${import_picocolors2.default.green(currentVersion)}`,
|
|
942
|
+
initial: configCustomVersion ? "config" : "next",
|
|
943
|
+
choices: [
|
|
944
|
+
{ value: "major", title: `${"major".padStart(PADDING, " ")} ${import_picocolors2.default.bold(next.major)}` },
|
|
945
|
+
{ value: "minor", title: `${"minor".padStart(PADDING, " ")} ${import_picocolors2.default.bold(next.minor)}` },
|
|
946
|
+
{ value: "patch", title: `${"patch".padStart(PADDING, " ")} ${import_picocolors2.default.bold(next.patch)}` },
|
|
947
|
+
{ value: "next", title: `${"next".padStart(PADDING, " ")} ${import_picocolors2.default.bold(next.next)}` },
|
|
948
|
+
...configCustomVersion ? [
|
|
949
|
+
{ value: "config", title: `${"from config".padStart(PADDING, " ")} ${import_picocolors2.default.bold(configCustomVersion)}` }
|
|
950
|
+
] : [],
|
|
951
|
+
{ value: "prepatch", title: `${"pre-patch".padStart(PADDING, " ")} ${import_picocolors2.default.bold(next.prepatch)}` },
|
|
952
|
+
{ value: "preminor", title: `${"pre-minor".padStart(PADDING, " ")} ${import_picocolors2.default.bold(next.preminor)}` },
|
|
953
|
+
{ value: "premajor", title: `${"pre-major".padStart(PADDING, " ")} ${import_picocolors2.default.bold(next.premajor)}` },
|
|
954
|
+
{ value: "none", title: `${"as-is".padStart(PADDING, " ")} ${import_picocolors2.default.bold(currentVersion)}` },
|
|
955
|
+
{ value: "custom", title: "custom ...".padStart(PADDING + 4, " ") }
|
|
956
|
+
]
|
|
957
|
+
},
|
|
958
|
+
{
|
|
959
|
+
type: (prev) => prev === "custom" ? "text" : null,
|
|
960
|
+
name: "custom",
|
|
961
|
+
message: "Enter the new version number:",
|
|
962
|
+
initial: currentVersion,
|
|
963
|
+
validate: (custom) => {
|
|
964
|
+
return (0, import_semver2.valid)(custom) ? true : "That's not a valid version number";
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
]);
|
|
968
|
+
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];
|
|
969
|
+
if (!newVersion)
|
|
970
|
+
import_node_process3.default.exit(1);
|
|
971
|
+
switch (answers.release) {
|
|
972
|
+
case "custom":
|
|
973
|
+
case "config":
|
|
974
|
+
case "next":
|
|
975
|
+
case "none":
|
|
976
|
+
return operation.update({ newVersion });
|
|
977
|
+
default:
|
|
978
|
+
return operation.update({ release: answers.release, newVersion });
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
// src/git.ts
|
|
983
|
+
var ezSpawn2 = __toESM(require("@jsdevtools/ez-spawn"));
|
|
851
984
|
async function gitCommit(operation) {
|
|
852
985
|
if (!operation.options.commit)
|
|
853
986
|
return operation;
|
|
@@ -864,7 +997,7 @@ async function gitCommit(operation) {
|
|
|
864
997
|
args.push("--message", commitMessage);
|
|
865
998
|
if (!all)
|
|
866
999
|
args = args.concat(updatedFiles);
|
|
867
|
-
await
|
|
1000
|
+
await ezSpawn2.async("git", ["commit", ...args]);
|
|
868
1001
|
return operation.update({ event: "git commit" /* GitCommit */, commitMessage });
|
|
869
1002
|
}
|
|
870
1003
|
async function gitTag(operation) {
|
|
@@ -882,15 +1015,15 @@ async function gitTag(operation) {
|
|
|
882
1015
|
];
|
|
883
1016
|
const tagName = formatVersionString(tag.name, newVersion);
|
|
884
1017
|
args.push(tagName);
|
|
885
|
-
await
|
|
1018
|
+
await ezSpawn2.async("git", ["tag", ...args]);
|
|
886
1019
|
return operation.update({ event: "git tag" /* GitTag */, tagName });
|
|
887
1020
|
}
|
|
888
1021
|
async function gitPush(operation) {
|
|
889
1022
|
if (!operation.options.push)
|
|
890
1023
|
return operation;
|
|
891
|
-
await
|
|
1024
|
+
await ezSpawn2.async("git", "push");
|
|
892
1025
|
if (operation.options.tag) {
|
|
893
|
-
await
|
|
1026
|
+
await ezSpawn2.async("git", ["push", "--tags"]);
|
|
894
1027
|
}
|
|
895
1028
|
return operation.update({ event: "git push" /* GitPush */ });
|
|
896
1029
|
}
|
|
@@ -902,13 +1035,13 @@ function formatVersionString(template, newVersion) {
|
|
|
902
1035
|
}
|
|
903
1036
|
|
|
904
1037
|
// src/normalize-options.ts
|
|
905
|
-
var import_node_process4 = __toESM(require("process"));
|
|
906
|
-
var import_promises = __toESM(require("fs/promises"));
|
|
907
1038
|
var import_node_fs2 = __toESM(require("fs"));
|
|
1039
|
+
var import_promises = __toESM(require("fs/promises"));
|
|
1040
|
+
var import_node_process4 = __toESM(require("process"));
|
|
908
1041
|
var import_fast_glob = __toESM(require("fast-glob"));
|
|
909
1042
|
var import_js_yaml = __toESM(require("js-yaml"));
|
|
910
1043
|
async function normalizeOptions(raw) {
|
|
911
|
-
var _a, _b;
|
|
1044
|
+
var _a, _b, _d;
|
|
912
1045
|
const preid = typeof raw.preid === "string" ? raw.preid : "beta";
|
|
913
1046
|
const push = Boolean(raw.push);
|
|
914
1047
|
const all = Boolean(raw.all);
|
|
@@ -992,6 +1125,7 @@ async function normalizeOptions(raw) {
|
|
|
992
1125
|
interface: ui,
|
|
993
1126
|
ignoreScripts,
|
|
994
1127
|
execute,
|
|
1128
|
+
printCommits: (_d = raw.printCommits) != null ? _d : true,
|
|
995
1129
|
customVersion: raw.customVersion,
|
|
996
1130
|
currentVersion: raw.currentVersion
|
|
997
1131
|
};
|
|
@@ -1062,13 +1196,13 @@ var Operation = class _Operation {
|
|
|
1062
1196
|
};
|
|
1063
1197
|
|
|
1064
1198
|
// src/run-npm-script.ts
|
|
1065
|
-
var
|
|
1199
|
+
var ezSpawn3 = __toESM(require("@jsdevtools/ez-spawn"));
|
|
1066
1200
|
async function runNpmScript(script, operation) {
|
|
1067
1201
|
const { cwd, ignoreScripts } = operation.options;
|
|
1068
1202
|
if (!ignoreScripts) {
|
|
1069
1203
|
const { data: manifest } = await readJsoncFile("package.json", cwd);
|
|
1070
1204
|
if (isManifest(manifest) && hasScript(manifest, script)) {
|
|
1071
|
-
await
|
|
1205
|
+
await ezSpawn3.async("npm", ["run", script, "--silent"], { stdio: "inherit" });
|
|
1072
1206
|
operation.update({ event: "npm script" /* NpmScript */, script });
|
|
1073
1207
|
}
|
|
1074
1208
|
}
|
|
@@ -1082,8 +1216,8 @@ function hasScript(manifest, script) {
|
|
|
1082
1216
|
}
|
|
1083
1217
|
|
|
1084
1218
|
// src/update-files.ts
|
|
1085
|
-
var path2 = __toESM(require("path"));
|
|
1086
1219
|
var import_node_fs3 = require("fs");
|
|
1220
|
+
var path2 = __toESM(require("path"));
|
|
1087
1221
|
async function updateFiles(operation) {
|
|
1088
1222
|
const { files } = operation.options;
|
|
1089
1223
|
for (const relPath of files) {
|
|
@@ -1172,7 +1306,7 @@ async function versionBump(arg = {}) {
|
|
|
1172
1306
|
await updateFiles(operation);
|
|
1173
1307
|
if (operation.options.execute) {
|
|
1174
1308
|
console.log(log_symbols_default.info, "Executing script", operation.options.execute);
|
|
1175
|
-
await
|
|
1309
|
+
await ezSpawn4.async(operation.options.execute, { stdio: "inherit" });
|
|
1176
1310
|
console.log(log_symbols_default.success, "Script finished");
|
|
1177
1311
|
}
|
|
1178
1312
|
await runNpmScript("version" /* Version */, operation);
|
|
@@ -1184,30 +1318,30 @@ async function versionBump(arg = {}) {
|
|
|
1184
1318
|
}
|
|
1185
1319
|
function printSummary(operation) {
|
|
1186
1320
|
console.log();
|
|
1187
|
-
console.log(` files ${operation.options.files.map((i) =>
|
|
1321
|
+
console.log(` files ${operation.options.files.map((i) => import_picocolors3.default.bold(i)).join("\n ")}`);
|
|
1188
1322
|
if (operation.options.commit)
|
|
1189
|
-
console.log(` commit ${
|
|
1323
|
+
console.log(` commit ${import_picocolors3.default.bold(formatVersionString(operation.options.commit.message, operation.state.newVersion))}`);
|
|
1190
1324
|
if (operation.options.tag)
|
|
1191
|
-
console.log(` tag ${
|
|
1325
|
+
console.log(` tag ${import_picocolors3.default.bold(formatVersionString(operation.options.tag.name, operation.state.newVersion))}`);
|
|
1192
1326
|
if (operation.options.execute)
|
|
1193
|
-
console.log(` execute ${
|
|
1327
|
+
console.log(` execute ${import_picocolors3.default.bold(operation.options.execute)}`);
|
|
1194
1328
|
if (operation.options.push)
|
|
1195
|
-
console.log(` push ${
|
|
1329
|
+
console.log(` push ${import_picocolors3.default.cyan(import_picocolors3.default.bold("yes"))}`);
|
|
1196
1330
|
console.log();
|
|
1197
|
-
console.log(` from ${
|
|
1198
|
-
console.log(` to ${
|
|
1331
|
+
console.log(` from ${import_picocolors3.default.bold(operation.state.currentVersion)}`);
|
|
1332
|
+
console.log(` to ${import_picocolors3.default.green(import_picocolors3.default.bold(operation.state.newVersion))}`);
|
|
1199
1333
|
console.log();
|
|
1200
1334
|
}
|
|
1201
1335
|
|
|
1202
1336
|
// src/cli/parse-args.ts
|
|
1203
1337
|
var import_node_process7 = __toESM(require("process"));
|
|
1204
|
-
var import_semver3 = require("semver");
|
|
1205
1338
|
var import_cac = __toESM(require("cac"));
|
|
1206
|
-
var
|
|
1339
|
+
var import_picocolors4 = __toESM(require_picocolors());
|
|
1340
|
+
var import_semver3 = require("semver");
|
|
1207
1341
|
|
|
1208
1342
|
// src/config.ts
|
|
1209
|
-
var import_node_process6 = __toESM(require("process"));
|
|
1210
1343
|
var import_node_path2 = require("path");
|
|
1344
|
+
var import_node_process6 = __toESM(require("process"));
|
|
1211
1345
|
var import_c12 = require("c12");
|
|
1212
1346
|
var import_sync = __toESM(require("escalade/sync"));
|
|
1213
1347
|
var bumpConfigDefaults = {
|
|
@@ -1279,7 +1413,7 @@ async function parseArgs() {
|
|
|
1279
1413
|
ignoreScripts: args.ignoreScripts,
|
|
1280
1414
|
currentVersion: args.currentVersion,
|
|
1281
1415
|
execute: args.execute,
|
|
1282
|
-
recursive:
|
|
1416
|
+
recursive: args.recursive
|
|
1283
1417
|
})
|
|
1284
1418
|
};
|
|
1285
1419
|
if (parsedArgs.options.files && parsedArgs.options.files.length > 0) {
|
|
@@ -1290,7 +1424,7 @@ async function parseArgs() {
|
|
|
1290
1424
|
}
|
|
1291
1425
|
}
|
|
1292
1426
|
if (parsedArgs.options.recursive && ((_a = parsedArgs.options.files) == null ? void 0 : _a.length))
|
|
1293
|
-
console.log(
|
|
1427
|
+
console.log(import_picocolors4.default.yellow("The --recursive option is ignored when files are specified"));
|
|
1294
1428
|
return parsedArgs;
|
|
1295
1429
|
} catch (error) {
|
|
1296
1430
|
return errorHandler(error);
|
|
@@ -1298,7 +1432,7 @@ async function parseArgs() {
|
|
|
1298
1432
|
}
|
|
1299
1433
|
function loadCliArgs(argv = import_node_process7.default.argv) {
|
|
1300
1434
|
const cli = (0, import_cac.default)("bumpp");
|
|
1301
|
-
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: true }).option("--no-commit", "Skip commit", { default: false }).option("-t, --tag [tag]", "Tag name", { default: true }).option("--no-tag", "Skip tag", { default: false }).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("--current-version <version>", "Current version").option("-x, --execute <command>", "Commands to execute after version bumps").help();
|
|
1435
|
+
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: true }).option("--no-commit", "Skip commit", { default: false }).option("-t, --tag [tag]", "Tag name", { default: true }).option("--no-tag", "Skip tag", { default: false }).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("--current-version <version>", "Current version").option("--print-commits", "Print recent commits", { default: true }).option("-x, --execute <command>", "Commands to execute after version bumps").help();
|
|
1302
1436
|
const result = cli.parse(argv);
|
|
1303
1437
|
const rawArgs = cli.rawArgs;
|
|
1304
1438
|
const args = result.options;
|
package/dist/cli/index.mjs
CHANGED
|
@@ -10,19 +10,19 @@ import {
|
|
|
10
10
|
log_symbols_default,
|
|
11
11
|
require_picocolors,
|
|
12
12
|
versionBump
|
|
13
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-TBB4VMXP.mjs";
|
|
14
14
|
|
|
15
15
|
// src/cli/index.ts
|
|
16
16
|
import process2 from "process";
|
|
17
17
|
|
|
18
18
|
// package.json
|
|
19
|
-
var version = "9.
|
|
19
|
+
var version = "9.6.1";
|
|
20
20
|
|
|
21
21
|
// src/cli/parse-args.ts
|
|
22
22
|
var import_picocolors = __toESM(require_picocolors());
|
|
23
23
|
import process from "process";
|
|
24
|
-
import { valid as isValidVersion } from "semver";
|
|
25
24
|
import cac from "cac";
|
|
25
|
+
import { valid as isValidVersion } from "semver";
|
|
26
26
|
async function parseArgs() {
|
|
27
27
|
var _a;
|
|
28
28
|
try {
|
|
@@ -43,7 +43,7 @@ async function parseArgs() {
|
|
|
43
43
|
ignoreScripts: args.ignoreScripts,
|
|
44
44
|
currentVersion: args.currentVersion,
|
|
45
45
|
execute: args.execute,
|
|
46
|
-
recursive:
|
|
46
|
+
recursive: args.recursive
|
|
47
47
|
})
|
|
48
48
|
};
|
|
49
49
|
if (parsedArgs.options.files && parsedArgs.options.files.length > 0) {
|
|
@@ -62,7 +62,7 @@ async function parseArgs() {
|
|
|
62
62
|
}
|
|
63
63
|
function loadCliArgs(argv = process.argv) {
|
|
64
64
|
const cli = cac("bumpp");
|
|
65
|
-
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: true }).option("--no-commit", "Skip commit", { default: false }).option("-t, --tag [tag]", "Tag name", { default: true }).option("--no-tag", "Skip tag", { default: false }).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("--current-version <version>", "Current version").option("-x, --execute <command>", "Commands to execute after version bumps").help();
|
|
65
|
+
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: true }).option("--no-commit", "Skip commit", { default: false }).option("-t, --tag [tag]", "Tag name", { default: true }).option("--no-tag", "Skip tag", { default: false }).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("--current-version <version>", "Current version").option("--print-commits", "Print recent commits", { default: true }).option("-x, --execute <command>", "Commands to execute after version bumps").help();
|
|
66
66
|
const result = cli.parse(argv);
|
|
67
67
|
const rawArgs = cli.rawArgs;
|
|
68
68
|
const args = result.options;
|
package/dist/index.d.mts
CHANGED
|
@@ -182,6 +182,10 @@ interface VersionBumpOptions {
|
|
|
182
182
|
* @default false
|
|
183
183
|
*/
|
|
184
184
|
recursive?: boolean;
|
|
185
|
+
/**
|
|
186
|
+
* Print recent commits
|
|
187
|
+
*/
|
|
188
|
+
printCommits?: boolean;
|
|
185
189
|
/**
|
|
186
190
|
* Custom function to provide the version number
|
|
187
191
|
*/
|
|
@@ -268,6 +272,7 @@ interface NormalizedOptions {
|
|
|
268
272
|
interface: Interface;
|
|
269
273
|
ignoreScripts: boolean;
|
|
270
274
|
execute?: string;
|
|
275
|
+
printCommits?: boolean;
|
|
271
276
|
customVersion?: VersionBumpOptions['customVersion'];
|
|
272
277
|
currentVersion?: string;
|
|
273
278
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -182,6 +182,10 @@ interface VersionBumpOptions {
|
|
|
182
182
|
* @default false
|
|
183
183
|
*/
|
|
184
184
|
recursive?: boolean;
|
|
185
|
+
/**
|
|
186
|
+
* Print recent commits
|
|
187
|
+
*/
|
|
188
|
+
printCommits?: boolean;
|
|
185
189
|
/**
|
|
186
190
|
* Custom function to provide the version number
|
|
187
191
|
*/
|
|
@@ -268,6 +272,7 @@ interface NormalizedOptions {
|
|
|
268
272
|
interface: Interface;
|
|
269
273
|
ignoreScripts: boolean;
|
|
270
274
|
execute?: string;
|
|
275
|
+
printCommits?: boolean;
|
|
271
276
|
customVersion?: VersionBumpOptions['customVersion'];
|
|
272
277
|
currentVersion?: string;
|
|
273
278
|
}
|