bumpp 9.5.1 → 9.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/bumpp.js +0 -0
- package/dist/{chunk-7Z2ZW6D2.mjs → chunk-CNEN62NE.mjs} +227 -111
- package/dist/cli/index.js +234 -118
- 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 +231 -115
- package/dist/index.mjs +1 -1
- package/package.json +23 -25
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,13 +662,112 @@ var logSymbols = isUnicodeSupported() ? main : fallback;
|
|
|
647
662
|
var log_symbols_default = logSymbols;
|
|
648
663
|
|
|
649
664
|
// src/version-bump.ts
|
|
665
|
+
var import_picocolors2 = __toESM(require_picocolors());
|
|
650
666
|
var import_prompts2 = __toESM(require("prompts"));
|
|
651
667
|
|
|
668
|
+
// src/get-current-version.ts
|
|
669
|
+
var import_semver = require("semver");
|
|
670
|
+
|
|
671
|
+
// src/fs.ts
|
|
672
|
+
var import_node_fs = __toESM(require("fs"));
|
|
673
|
+
var import_node_path = __toESM(require("path"));
|
|
674
|
+
var jsonc = __toESM(require("jsonc-parser"));
|
|
675
|
+
async function readJsoncFile(name, cwd) {
|
|
676
|
+
const file = await readTextFile(name, cwd);
|
|
677
|
+
const data = jsonc.parse(file.data);
|
|
678
|
+
const modified = [];
|
|
679
|
+
return __spreadProps(__spreadValues({}, file), { data, modified, text: file.data });
|
|
680
|
+
}
|
|
681
|
+
async function writeJsoncFile(file) {
|
|
682
|
+
let newJSON = file.text;
|
|
683
|
+
for (const [key, value] of file.modified) {
|
|
684
|
+
const edit = jsonc.modify(file.text, key, value, {});
|
|
685
|
+
newJSON = jsonc.applyEdits(newJSON, edit);
|
|
686
|
+
}
|
|
687
|
+
return writeTextFile(__spreadProps(__spreadValues({}, file), { data: newJSON }));
|
|
688
|
+
}
|
|
689
|
+
function readTextFile(name, cwd) {
|
|
690
|
+
return new Promise((resolve, reject) => {
|
|
691
|
+
const filePath = import_node_path.default.join(cwd, name);
|
|
692
|
+
import_node_fs.default.readFile(filePath, "utf8", (err, text) => {
|
|
693
|
+
if (err) {
|
|
694
|
+
reject(err);
|
|
695
|
+
} else {
|
|
696
|
+
resolve({
|
|
697
|
+
path: filePath,
|
|
698
|
+
data: text
|
|
699
|
+
});
|
|
700
|
+
}
|
|
701
|
+
});
|
|
702
|
+
});
|
|
703
|
+
}
|
|
704
|
+
function writeTextFile(file) {
|
|
705
|
+
return new Promise((resolve, reject) => {
|
|
706
|
+
import_node_fs.default.writeFile(file.path, file.data, (err) => {
|
|
707
|
+
if (err)
|
|
708
|
+
reject(err);
|
|
709
|
+
else
|
|
710
|
+
resolve();
|
|
711
|
+
});
|
|
712
|
+
});
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
// src/manifest.ts
|
|
716
|
+
function isManifest(obj) {
|
|
717
|
+
return obj && typeof obj === "object" && isOptionalString(obj.name) && isOptionalString(obj.version) && isOptionalString(obj.description);
|
|
718
|
+
}
|
|
719
|
+
function isPackageLockManifest(manifest) {
|
|
720
|
+
var _a, _b;
|
|
721
|
+
return typeof ((_b = (_a = manifest.packages) == null ? void 0 : _a[""]) == null ? void 0 : _b.version) === "string";
|
|
722
|
+
}
|
|
723
|
+
function isOptionalString(value) {
|
|
724
|
+
const type = typeof value;
|
|
725
|
+
return value === null || type === "undefined" || type === "string";
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
// src/get-current-version.ts
|
|
729
|
+
async function getCurrentVersion(operation) {
|
|
730
|
+
if (operation.state.currentVersion)
|
|
731
|
+
return operation;
|
|
732
|
+
const { cwd, files } = operation.options;
|
|
733
|
+
const filesToCheck = files.filter((file) => file.endsWith(".json"));
|
|
734
|
+
if (!filesToCheck.includes("package.json"))
|
|
735
|
+
filesToCheck.push("package.json");
|
|
736
|
+
if (!filesToCheck.includes("deno.json"))
|
|
737
|
+
filesToCheck.push("deno.json");
|
|
738
|
+
if (!filesToCheck.includes("deno.jsonc"))
|
|
739
|
+
filesToCheck.push("deno.jsonc");
|
|
740
|
+
for (const file of filesToCheck) {
|
|
741
|
+
const version = await readVersion(file, cwd);
|
|
742
|
+
if (version) {
|
|
743
|
+
return operation.update({
|
|
744
|
+
currentVersionSource: file,
|
|
745
|
+
currentVersion: version
|
|
746
|
+
});
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
throw new Error(
|
|
750
|
+
`Unable to determine the current version number. Checked ${filesToCheck.join(", ")}.`
|
|
751
|
+
);
|
|
752
|
+
}
|
|
753
|
+
async function readVersion(file, cwd) {
|
|
754
|
+
try {
|
|
755
|
+
const { data: manifest } = await readJsoncFile(file, cwd);
|
|
756
|
+
if (isManifest(manifest)) {
|
|
757
|
+
if ((0, import_semver.valid)(manifest.version))
|
|
758
|
+
return manifest.version;
|
|
759
|
+
}
|
|
760
|
+
} catch (e) {
|
|
761
|
+
return void 0;
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
|
|
652
765
|
// src/get-new-version.ts
|
|
653
766
|
var import_node_process3 = __toESM(require("process"));
|
|
767
|
+
var ezSpawn = __toESM(require("@jsdevtools/ez-spawn"));
|
|
654
768
|
var import_picocolors = __toESM(require_picocolors());
|
|
655
769
|
var import_prompts = __toESM(require("prompts"));
|
|
656
|
-
var
|
|
770
|
+
var import_semver2 = __toESM(require("semver"));
|
|
657
771
|
|
|
658
772
|
// src/release-type.ts
|
|
659
773
|
var prereleaseTypes = ["premajor", "preminor", "prepatch", "prerelease"];
|
|
@@ -674,7 +788,7 @@ async function getNewVersion(operation) {
|
|
|
674
788
|
return promptForNewVersion(operation);
|
|
675
789
|
case "version":
|
|
676
790
|
return operation.update({
|
|
677
|
-
newVersion: new
|
|
791
|
+
newVersion: new import_semver2.SemVer(release.version, true).version
|
|
678
792
|
});
|
|
679
793
|
default:
|
|
680
794
|
return operation.update({
|
|
@@ -684,7 +798,7 @@ async function getNewVersion(operation) {
|
|
|
684
798
|
}
|
|
685
799
|
}
|
|
686
800
|
function getNextVersion(currentVersion, bump) {
|
|
687
|
-
const oldSemVer = new
|
|
801
|
+
const oldSemVer = new import_semver2.SemVer(currentVersion);
|
|
688
802
|
const type = bump.type === "next" ? oldSemVer.prerelease.length ? "prerelease" : "patch" : bump.type;
|
|
689
803
|
const newSemVer = oldSemVer.inc(type, bump.preid);
|
|
690
804
|
if (isPrerelease(bump.type) && newSemVer.prerelease.length === 2 && newSemVer.prerelease[0] === bump.preid && String(newSemVer.prerelease[1]) === "0") {
|
|
@@ -695,7 +809,7 @@ function getNextVersion(currentVersion, bump) {
|
|
|
695
809
|
}
|
|
696
810
|
function getNextVersions(currentVersion, preid) {
|
|
697
811
|
const next = {};
|
|
698
|
-
const parse2 =
|
|
812
|
+
const parse2 = import_semver2.default.parse(currentVersion);
|
|
699
813
|
if (typeof (parse2 == null ? void 0 : parse2.prerelease[0]) === "string")
|
|
700
814
|
preid = (parse2 == null ? void 0 : parse2.prerelease[0]) || "preid";
|
|
701
815
|
for (const type of releaseTypes)
|
|
@@ -707,7 +821,10 @@ async function promptForNewVersion(operation) {
|
|
|
707
821
|
const { currentVersion } = operation.state;
|
|
708
822
|
const release = operation.options.release;
|
|
709
823
|
const next = getNextVersions(currentVersion, release.preid);
|
|
710
|
-
const configCustomVersion = await ((_b = (_a = operation.options).customVersion) == null ? void 0 : _b.call(_a, currentVersion,
|
|
824
|
+
const configCustomVersion = await ((_b = (_a = operation.options).customVersion) == null ? void 0 : _b.call(_a, currentVersion, import_semver2.default));
|
|
825
|
+
if (operation.options.printCommits) {
|
|
826
|
+
await printRecentCommits(operation);
|
|
827
|
+
}
|
|
711
828
|
const PADDING = 13;
|
|
712
829
|
const answers = await (0, import_prompts.default)([
|
|
713
830
|
{
|
|
@@ -736,11 +853,11 @@ async function promptForNewVersion(operation) {
|
|
|
736
853
|
message: "Enter the new version number:",
|
|
737
854
|
initial: currentVersion,
|
|
738
855
|
validate: (custom) => {
|
|
739
|
-
return (0,
|
|
856
|
+
return (0, import_semver2.valid)(custom) ? true : "That's not a valid version number";
|
|
740
857
|
}
|
|
741
858
|
}
|
|
742
859
|
]);
|
|
743
|
-
const newVersion = answers.release === "none" ? currentVersion : answers.release === "custom" ? (0,
|
|
860
|
+
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];
|
|
744
861
|
if (!newVersion)
|
|
745
862
|
import_node_process3.default.exit(1);
|
|
746
863
|
switch (answers.release) {
|
|
@@ -753,106 +870,100 @@ async function promptForNewVersion(operation) {
|
|
|
753
870
|
return operation.update({ release: answers.release, newVersion });
|
|
754
871
|
}
|
|
755
872
|
}
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
873
|
+
var messageColorMap = {
|
|
874
|
+
chore: import_picocolors.default.gray,
|
|
875
|
+
fix: import_picocolors.default.yellow,
|
|
876
|
+
feat: import_picocolors.default.green,
|
|
877
|
+
refactor: import_picocolors.default.cyan,
|
|
878
|
+
docs: import_picocolors.default.blue,
|
|
879
|
+
doc: import_picocolors.default.blue,
|
|
880
|
+
ci: import_picocolors.default.gray,
|
|
881
|
+
build: import_picocolors.default.gray
|
|
882
|
+
};
|
|
883
|
+
async function printRecentCommits(operation) {
|
|
884
|
+
let sha;
|
|
885
|
+
sha || (sha = await ezSpawn.async(
|
|
886
|
+
"git",
|
|
887
|
+
["rev-list", "-n", "1", `v${operation.state.currentVersion}`],
|
|
888
|
+
{ stdio: "pipe" }
|
|
889
|
+
).then((res) => res.stdout.trim()).catch(() => void 0));
|
|
890
|
+
sha || (sha = await ezSpawn.async(
|
|
891
|
+
"git",
|
|
892
|
+
["rev-list", "-n", "1", operation.state.currentVersion],
|
|
893
|
+
{ stdio: "pipe" }
|
|
894
|
+
).then((res) => res.stdout.trim()).catch(() => void 0));
|
|
895
|
+
if (!sha) {
|
|
896
|
+
console.log(
|
|
897
|
+
import_picocolors.default.blue(`i`) + import_picocolors.default.gray(` Failed to locate the previous tag ${import_picocolors.default.yellow(`v${operation.state.currentVersion}`)}`)
|
|
898
|
+
);
|
|
899
|
+
return;
|
|
775
900
|
}
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
901
|
+
const message = await ezSpawn.async(
|
|
902
|
+
"git",
|
|
903
|
+
[
|
|
904
|
+
"--no-pager",
|
|
905
|
+
"log",
|
|
906
|
+
`${sha}..HEAD`,
|
|
907
|
+
"--oneline"
|
|
908
|
+
],
|
|
909
|
+
{ stdio: "pipe" }
|
|
910
|
+
);
|
|
911
|
+
const lines = message.stdout.toString().trim().split(/\n/g);
|
|
912
|
+
if (!lines.length) {
|
|
913
|
+
console.log();
|
|
914
|
+
console.log(import_picocolors.default.blue(`i`) + import_picocolors.default.gray(` No commits since ${operation.state.currentVersion}`));
|
|
915
|
+
console.log();
|
|
916
|
+
return;
|
|
917
|
+
}
|
|
918
|
+
const parsed = lines.map((line) => {
|
|
919
|
+
const [hash, ...parts] = line.split(" ");
|
|
920
|
+
const message2 = parts.join(" ");
|
|
921
|
+
const match = message2.match(/^(\w+)(\([^)]+\))?(!)?:(.*)$/);
|
|
922
|
+
if (match) {
|
|
923
|
+
let color = messageColorMap[match[1].toLowerCase()] || ((c3) => c3);
|
|
924
|
+
if (match[3] === "!") {
|
|
925
|
+
color = import_picocolors.default.red;
|
|
789
926
|
}
|
|
790
|
-
|
|
927
|
+
const tag = [match[1], match[2], match[3]].filter(Boolean).join("");
|
|
928
|
+
return {
|
|
929
|
+
hash,
|
|
930
|
+
tag,
|
|
931
|
+
message: match[4].trim(),
|
|
932
|
+
color
|
|
933
|
+
};
|
|
934
|
+
}
|
|
935
|
+
return {
|
|
936
|
+
hash,
|
|
937
|
+
tag: "",
|
|
938
|
+
message: message2,
|
|
939
|
+
color: (c3) => c3
|
|
940
|
+
};
|
|
791
941
|
});
|
|
792
|
-
}
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
942
|
+
const tagLength = parsed.map(({ tag }) => tag.length).reduce((a, b) => Math.max(a, b), 0);
|
|
943
|
+
const prettified = parsed.map(({ hash, tag, message: message2, color }) => {
|
|
944
|
+
const paddedTag = tag.padStart(tagLength + 2, " ");
|
|
945
|
+
return [
|
|
946
|
+
import_picocolors.default.dim(hash),
|
|
947
|
+
" ",
|
|
948
|
+
color === import_picocolors.default.gray ? color(paddedTag) : import_picocolors.default.bold(color(paddedTag)),
|
|
949
|
+
import_picocolors.default.dim(":"),
|
|
950
|
+
" ",
|
|
951
|
+
color === import_picocolors.default.gray ? color(message2) : message2
|
|
952
|
+
].join("");
|
|
801
953
|
});
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
}
|
|
808
|
-
function isPackageLockManifest(manifest) {
|
|
809
|
-
var _a, _b;
|
|
810
|
-
return typeof ((_b = (_a = manifest.packages) == null ? void 0 : _a[""]) == null ? void 0 : _b.version) === "string";
|
|
811
|
-
}
|
|
812
|
-
function isOptionalString(value) {
|
|
813
|
-
const type = typeof value;
|
|
814
|
-
return value === null || type === "undefined" || type === "string";
|
|
815
|
-
}
|
|
816
|
-
|
|
817
|
-
// src/get-current-version.ts
|
|
818
|
-
async function getCurrentVersion(operation) {
|
|
819
|
-
if (operation.state.currentVersion)
|
|
820
|
-
return operation;
|
|
821
|
-
const { cwd, files } = operation.options;
|
|
822
|
-
const filesToCheck = files.filter((file) => file.endsWith(".json"));
|
|
823
|
-
if (!filesToCheck.includes("package.json"))
|
|
824
|
-
filesToCheck.push("package.json");
|
|
825
|
-
if (!filesToCheck.includes("deno.json"))
|
|
826
|
-
filesToCheck.push("deno.json");
|
|
827
|
-
if (!filesToCheck.includes("deno.jsonc"))
|
|
828
|
-
filesToCheck.push("deno.jsonc");
|
|
829
|
-
for (const file of filesToCheck) {
|
|
830
|
-
const version = await readVersion(file, cwd);
|
|
831
|
-
if (version) {
|
|
832
|
-
return operation.update({
|
|
833
|
-
currentVersionSource: file,
|
|
834
|
-
currentVersion: version
|
|
835
|
-
});
|
|
836
|
-
}
|
|
837
|
-
}
|
|
838
|
-
throw new Error(
|
|
839
|
-
`Unable to determine the current version number. Checked ${filesToCheck.join(", ")}.`
|
|
954
|
+
console.log();
|
|
955
|
+
console.log(
|
|
956
|
+
import_picocolors.default.bold(
|
|
957
|
+
`${import_picocolors.default.green(lines.length)} Commits since ${import_picocolors.default.gray(sha.slice(0, 7))}:`
|
|
958
|
+
)
|
|
840
959
|
);
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
const { data: manifest } = await readJsoncFile(file, cwd);
|
|
845
|
-
if (isManifest(manifest)) {
|
|
846
|
-
if ((0, import_semver2.valid)(manifest.version))
|
|
847
|
-
return manifest.version;
|
|
848
|
-
}
|
|
849
|
-
} catch (e) {
|
|
850
|
-
return void 0;
|
|
851
|
-
}
|
|
960
|
+
console.log();
|
|
961
|
+
console.log(prettified.reverse().join("\n"));
|
|
962
|
+
console.log();
|
|
852
963
|
}
|
|
853
964
|
|
|
854
965
|
// src/git.ts
|
|
855
|
-
var
|
|
966
|
+
var ezSpawn2 = __toESM(require("@jsdevtools/ez-spawn"));
|
|
856
967
|
|
|
857
968
|
// src/types/version-bump-progress.ts
|
|
858
969
|
var ProgressEvent = /* @__PURE__ */ ((ProgressEvent2) => {
|
|
@@ -888,7 +999,7 @@ async function gitCommit(operation) {
|
|
|
888
999
|
args.push("--message", commitMessage);
|
|
889
1000
|
if (!all)
|
|
890
1001
|
args = args.concat(updatedFiles);
|
|
891
|
-
await
|
|
1002
|
+
await ezSpawn2.async("git", ["commit", ...args]);
|
|
892
1003
|
return operation.update({ event: "git commit" /* GitCommit */, commitMessage });
|
|
893
1004
|
}
|
|
894
1005
|
async function gitTag(operation) {
|
|
@@ -906,15 +1017,15 @@ async function gitTag(operation) {
|
|
|
906
1017
|
];
|
|
907
1018
|
const tagName = formatVersionString(tag.name, newVersion);
|
|
908
1019
|
args.push(tagName);
|
|
909
|
-
await
|
|
1020
|
+
await ezSpawn2.async("git", ["tag", ...args]);
|
|
910
1021
|
return operation.update({ event: "git tag" /* GitTag */, tagName });
|
|
911
1022
|
}
|
|
912
1023
|
async function gitPush(operation) {
|
|
913
1024
|
if (!operation.options.push)
|
|
914
1025
|
return operation;
|
|
915
|
-
await
|
|
1026
|
+
await ezSpawn2.async("git", "push");
|
|
916
1027
|
if (operation.options.tag) {
|
|
917
|
-
await
|
|
1028
|
+
await ezSpawn2.async("git", ["push", "--tags"]);
|
|
918
1029
|
}
|
|
919
1030
|
return operation.update({ event: "git push" /* GitPush */ });
|
|
920
1031
|
}
|
|
@@ -926,13 +1037,13 @@ function formatVersionString(template, newVersion) {
|
|
|
926
1037
|
}
|
|
927
1038
|
|
|
928
1039
|
// src/normalize-options.ts
|
|
929
|
-
var import_node_process4 = __toESM(require("process"));
|
|
930
|
-
var import_promises = __toESM(require("fs/promises"));
|
|
931
1040
|
var import_node_fs2 = __toESM(require("fs"));
|
|
1041
|
+
var import_promises = __toESM(require("fs/promises"));
|
|
1042
|
+
var import_node_process4 = __toESM(require("process"));
|
|
932
1043
|
var import_fast_glob = __toESM(require("fast-glob"));
|
|
933
1044
|
var import_js_yaml = __toESM(require("js-yaml"));
|
|
934
1045
|
async function normalizeOptions(raw) {
|
|
935
|
-
var _a, _b;
|
|
1046
|
+
var _a, _b, _d;
|
|
936
1047
|
const preid = typeof raw.preid === "string" ? raw.preid : "beta";
|
|
937
1048
|
const push = Boolean(raw.push);
|
|
938
1049
|
const all = Boolean(raw.all);
|
|
@@ -1016,6 +1127,7 @@ async function normalizeOptions(raw) {
|
|
|
1016
1127
|
interface: ui,
|
|
1017
1128
|
ignoreScripts,
|
|
1018
1129
|
execute,
|
|
1130
|
+
printCommits: (_d = raw.printCommits) != null ? _d : true,
|
|
1019
1131
|
customVersion: raw.customVersion,
|
|
1020
1132
|
currentVersion: raw.currentVersion
|
|
1021
1133
|
};
|
|
@@ -1086,13 +1198,13 @@ var Operation = class _Operation {
|
|
|
1086
1198
|
};
|
|
1087
1199
|
|
|
1088
1200
|
// src/run-npm-script.ts
|
|
1089
|
-
var
|
|
1201
|
+
var ezSpawn3 = __toESM(require("@jsdevtools/ez-spawn"));
|
|
1090
1202
|
async function runNpmScript(script, operation) {
|
|
1091
1203
|
const { cwd, ignoreScripts } = operation.options;
|
|
1092
1204
|
if (!ignoreScripts) {
|
|
1093
1205
|
const { data: manifest } = await readJsoncFile("package.json", cwd);
|
|
1094
1206
|
if (isManifest(manifest) && hasScript(manifest, script)) {
|
|
1095
|
-
await
|
|
1207
|
+
await ezSpawn3.async("npm", ["run", script, "--silent"], { stdio: "inherit" });
|
|
1096
1208
|
operation.update({ event: "npm script" /* NpmScript */, script });
|
|
1097
1209
|
}
|
|
1098
1210
|
}
|
|
@@ -1106,6 +1218,7 @@ function hasScript(manifest, script) {
|
|
|
1106
1218
|
}
|
|
1107
1219
|
|
|
1108
1220
|
// src/update-files.ts
|
|
1221
|
+
var import_node_fs3 = require("fs");
|
|
1109
1222
|
var path2 = __toESM(require("path"));
|
|
1110
1223
|
async function updateFiles(operation) {
|
|
1111
1224
|
const { files } = operation.options;
|
|
@@ -1126,6 +1239,9 @@ async function updateFiles(operation) {
|
|
|
1126
1239
|
return operation;
|
|
1127
1240
|
}
|
|
1128
1241
|
async function updateFile(relPath, operation) {
|
|
1242
|
+
if (!(0, import_node_fs3.existsSync)(relPath)) {
|
|
1243
|
+
return false;
|
|
1244
|
+
}
|
|
1129
1245
|
const name = path2.basename(relPath).trim().toLowerCase();
|
|
1130
1246
|
switch (name) {
|
|
1131
1247
|
case "package.json":
|
|
@@ -1192,7 +1308,7 @@ async function versionBump(arg = {}) {
|
|
|
1192
1308
|
await updateFiles(operation);
|
|
1193
1309
|
if (operation.options.execute) {
|
|
1194
1310
|
console.log(log_symbols_default.info, "Executing script", operation.options.execute);
|
|
1195
|
-
await
|
|
1311
|
+
await ezSpawn4.async(operation.options.execute, { stdio: "inherit" });
|
|
1196
1312
|
console.log(log_symbols_default.success, "Script finished");
|
|
1197
1313
|
}
|
|
1198
1314
|
await runNpmScript("version" /* Version */, operation);
|
|
@@ -1228,8 +1344,8 @@ async function versionBumpInfo(arg = {}) {
|
|
|
1228
1344
|
}
|
|
1229
1345
|
|
|
1230
1346
|
// src/config.ts
|
|
1231
|
-
var import_node_process6 = __toESM(require("process"));
|
|
1232
1347
|
var import_node_path2 = require("path");
|
|
1348
|
+
var import_node_process6 = __toESM(require("process"));
|
|
1233
1349
|
var import_c12 = require("c12");
|
|
1234
1350
|
var import_sync = __toESM(require("escalade/sync"));
|
|
1235
1351
|
var bumpConfigDefaults = {
|
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bumpp",
|
|
3
|
-
"version": "9.
|
|
4
|
-
"packageManager": "pnpm@9.7.0",
|
|
3
|
+
"version": "9.6.0",
|
|
5
4
|
"description": "Bump version, commit changes, tag, and push to Git",
|
|
6
5
|
"author": {
|
|
7
6
|
"name": "James Messinger",
|
|
@@ -45,24 +44,11 @@
|
|
|
45
44
|
"engines": {
|
|
46
45
|
"node": ">=10"
|
|
47
46
|
},
|
|
48
|
-
"scripts": {
|
|
49
|
-
"clean": "rimraf .nyc_output coverage dist",
|
|
50
|
-
"lint": "eslint .",
|
|
51
|
-
"build": "tsup src/index.ts src/cli/index.ts --format esm,cjs --dts --clean",
|
|
52
|
-
"watch": "npm run build -- --watch src",
|
|
53
|
-
"start": "esno src/cli/run.ts",
|
|
54
|
-
"test": "vitest",
|
|
55
|
-
"upgrade": "npm-check -u && npm audit fix",
|
|
56
|
-
"bumpp": "esno src/cli/run.ts",
|
|
57
|
-
"prepublishOnly": "npm run clean && npm run build",
|
|
58
|
-
"release": "npm run bumpp && npm publish",
|
|
59
|
-
"typecheck": "tsc --noEmit"
|
|
60
|
-
},
|
|
61
47
|
"dependencies": {
|
|
62
48
|
"@jsdevtools/ez-spawn": "^3.0.4",
|
|
63
|
-
"c12": "^1.11.
|
|
49
|
+
"c12": "^1.11.2",
|
|
64
50
|
"cac": "^6.7.14",
|
|
65
|
-
"escalade": "^3.
|
|
51
|
+
"escalade": "^3.2.0",
|
|
66
52
|
"fast-glob": "^3.3.2",
|
|
67
53
|
"js-yaml": "^4.1.0",
|
|
68
54
|
"jsonc-parser": "^3.3.1",
|
|
@@ -70,19 +56,31 @@
|
|
|
70
56
|
"semver": "^7.6.3"
|
|
71
57
|
},
|
|
72
58
|
"devDependencies": {
|
|
73
|
-
"@antfu/eslint-config": "^
|
|
59
|
+
"@antfu/eslint-config": "^3.7.3",
|
|
74
60
|
"@types/js-yaml": "^4.0.9",
|
|
75
|
-
"@types/node": "^22.
|
|
61
|
+
"@types/node": "^22.7.4",
|
|
76
62
|
"@types/prompts": "^2.4.9",
|
|
77
63
|
"@types/semver": "^7.5.8",
|
|
78
|
-
"eslint": "^9.
|
|
64
|
+
"eslint": "^9.11.1",
|
|
79
65
|
"esno": "^4.7.0",
|
|
80
66
|
"log-symbols": "^6.0.0",
|
|
81
67
|
"npm-check": "^6.0.1",
|
|
82
|
-
"picocolors": "^1.0
|
|
68
|
+
"picocolors": "^1.1.0",
|
|
83
69
|
"rimraf": "^6.0.1",
|
|
84
|
-
"tsup": "^8.
|
|
85
|
-
"typescript": "^5.
|
|
86
|
-
"vitest": "^2.
|
|
70
|
+
"tsup": "^8.3.0",
|
|
71
|
+
"typescript": "^5.6.2",
|
|
72
|
+
"vitest": "^2.1.1"
|
|
73
|
+
},
|
|
74
|
+
"scripts": {
|
|
75
|
+
"clean": "rimraf .nyc_output coverage dist",
|
|
76
|
+
"lint": "eslint .",
|
|
77
|
+
"build": "tsup src/index.ts src/cli/index.ts --format esm,cjs --dts --clean",
|
|
78
|
+
"watch": "npm run build -- --watch src",
|
|
79
|
+
"start": "esno src/cli/run.ts",
|
|
80
|
+
"test": "vitest",
|
|
81
|
+
"upgrade": "npm-check -u && npm audit fix",
|
|
82
|
+
"bumpp": "esno src/cli/run.ts",
|
|
83
|
+
"release": "npm run bumpp && npm publish",
|
|
84
|
+
"typecheck": "tsc --noEmit"
|
|
87
85
|
}
|
|
88
|
-
}
|
|
86
|
+
}
|