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/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,19 +652,117 @@ 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.0";
|
|
640
656
|
|
|
641
657
|
// src/version-bump.ts
|
|
642
658
|
var import_node_process5 = __toESM(require("process"));
|
|
643
|
-
var
|
|
659
|
+
var ezSpawn4 = __toESM(require("@jsdevtools/ez-spawn"));
|
|
644
660
|
var import_picocolors2 = __toESM(require_picocolors());
|
|
645
661
|
var import_prompts2 = __toESM(require("prompts"));
|
|
646
662
|
|
|
663
|
+
// src/get-current-version.ts
|
|
664
|
+
var import_semver = require("semver");
|
|
665
|
+
|
|
666
|
+
// src/fs.ts
|
|
667
|
+
var import_node_fs = __toESM(require("fs"));
|
|
668
|
+
var import_node_path = __toESM(require("path"));
|
|
669
|
+
var jsonc = __toESM(require("jsonc-parser"));
|
|
670
|
+
async function readJsoncFile(name, cwd) {
|
|
671
|
+
const file = await readTextFile(name, cwd);
|
|
672
|
+
const data = jsonc.parse(file.data);
|
|
673
|
+
const modified = [];
|
|
674
|
+
return __spreadProps(__spreadValues({}, file), { data, modified, text: file.data });
|
|
675
|
+
}
|
|
676
|
+
async function writeJsoncFile(file) {
|
|
677
|
+
let newJSON = file.text;
|
|
678
|
+
for (const [key, value] of file.modified) {
|
|
679
|
+
const edit = jsonc.modify(file.text, key, value, {});
|
|
680
|
+
newJSON = jsonc.applyEdits(newJSON, edit);
|
|
681
|
+
}
|
|
682
|
+
return writeTextFile(__spreadProps(__spreadValues({}, file), { data: newJSON }));
|
|
683
|
+
}
|
|
684
|
+
function readTextFile(name, cwd) {
|
|
685
|
+
return new Promise((resolve, reject) => {
|
|
686
|
+
const filePath = import_node_path.default.join(cwd, name);
|
|
687
|
+
import_node_fs.default.readFile(filePath, "utf8", (err, text) => {
|
|
688
|
+
if (err) {
|
|
689
|
+
reject(err);
|
|
690
|
+
} else {
|
|
691
|
+
resolve({
|
|
692
|
+
path: filePath,
|
|
693
|
+
data: text
|
|
694
|
+
});
|
|
695
|
+
}
|
|
696
|
+
});
|
|
697
|
+
});
|
|
698
|
+
}
|
|
699
|
+
function writeTextFile(file) {
|
|
700
|
+
return new Promise((resolve, reject) => {
|
|
701
|
+
import_node_fs.default.writeFile(file.path, file.data, (err) => {
|
|
702
|
+
if (err)
|
|
703
|
+
reject(err);
|
|
704
|
+
else
|
|
705
|
+
resolve();
|
|
706
|
+
});
|
|
707
|
+
});
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
// src/manifest.ts
|
|
711
|
+
function isManifest(obj) {
|
|
712
|
+
return obj && typeof obj === "object" && isOptionalString(obj.name) && isOptionalString(obj.version) && isOptionalString(obj.description);
|
|
713
|
+
}
|
|
714
|
+
function isPackageLockManifest(manifest) {
|
|
715
|
+
var _a, _b;
|
|
716
|
+
return typeof ((_b = (_a = manifest.packages) == null ? void 0 : _a[""]) == null ? void 0 : _b.version) === "string";
|
|
717
|
+
}
|
|
718
|
+
function isOptionalString(value) {
|
|
719
|
+
const type = typeof value;
|
|
720
|
+
return value === null || type === "undefined" || type === "string";
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
// src/get-current-version.ts
|
|
724
|
+
async function getCurrentVersion(operation) {
|
|
725
|
+
if (operation.state.currentVersion)
|
|
726
|
+
return operation;
|
|
727
|
+
const { cwd, files } = operation.options;
|
|
728
|
+
const filesToCheck = files.filter((file) => file.endsWith(".json"));
|
|
729
|
+
if (!filesToCheck.includes("package.json"))
|
|
730
|
+
filesToCheck.push("package.json");
|
|
731
|
+
if (!filesToCheck.includes("deno.json"))
|
|
732
|
+
filesToCheck.push("deno.json");
|
|
733
|
+
if (!filesToCheck.includes("deno.jsonc"))
|
|
734
|
+
filesToCheck.push("deno.jsonc");
|
|
735
|
+
for (const file of filesToCheck) {
|
|
736
|
+
const version2 = await readVersion(file, cwd);
|
|
737
|
+
if (version2) {
|
|
738
|
+
return operation.update({
|
|
739
|
+
currentVersionSource: file,
|
|
740
|
+
currentVersion: version2
|
|
741
|
+
});
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
throw new Error(
|
|
745
|
+
`Unable to determine the current version number. Checked ${filesToCheck.join(", ")}.`
|
|
746
|
+
);
|
|
747
|
+
}
|
|
748
|
+
async function readVersion(file, cwd) {
|
|
749
|
+
try {
|
|
750
|
+
const { data: manifest } = await readJsoncFile(file, cwd);
|
|
751
|
+
if (isManifest(manifest)) {
|
|
752
|
+
if ((0, import_semver.valid)(manifest.version))
|
|
753
|
+
return manifest.version;
|
|
754
|
+
}
|
|
755
|
+
} catch (e) {
|
|
756
|
+
return void 0;
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
|
|
647
760
|
// src/get-new-version.ts
|
|
648
761
|
var import_node_process3 = __toESM(require("process"));
|
|
762
|
+
var ezSpawn = __toESM(require("@jsdevtools/ez-spawn"));
|
|
649
763
|
var import_picocolors = __toESM(require_picocolors());
|
|
650
764
|
var import_prompts = __toESM(require("prompts"));
|
|
651
|
-
var
|
|
765
|
+
var import_semver2 = __toESM(require("semver"));
|
|
652
766
|
|
|
653
767
|
// src/release-type.ts
|
|
654
768
|
var prereleaseTypes = ["premajor", "preminor", "prepatch", "prerelease"];
|
|
@@ -669,7 +783,7 @@ async function getNewVersion(operation) {
|
|
|
669
783
|
return promptForNewVersion(operation);
|
|
670
784
|
case "version":
|
|
671
785
|
return operation.update({
|
|
672
|
-
newVersion: new
|
|
786
|
+
newVersion: new import_semver2.SemVer(release.version, true).version
|
|
673
787
|
});
|
|
674
788
|
default:
|
|
675
789
|
return operation.update({
|
|
@@ -679,7 +793,7 @@ async function getNewVersion(operation) {
|
|
|
679
793
|
}
|
|
680
794
|
}
|
|
681
795
|
function getNextVersion(currentVersion, bump) {
|
|
682
|
-
const oldSemVer = new
|
|
796
|
+
const oldSemVer = new import_semver2.SemVer(currentVersion);
|
|
683
797
|
const type = bump.type === "next" ? oldSemVer.prerelease.length ? "prerelease" : "patch" : bump.type;
|
|
684
798
|
const newSemVer = oldSemVer.inc(type, bump.preid);
|
|
685
799
|
if (isPrerelease(bump.type) && newSemVer.prerelease.length === 2 && newSemVer.prerelease[0] === bump.preid && String(newSemVer.prerelease[1]) === "0") {
|
|
@@ -690,7 +804,7 @@ function getNextVersion(currentVersion, bump) {
|
|
|
690
804
|
}
|
|
691
805
|
function getNextVersions(currentVersion, preid) {
|
|
692
806
|
const next = {};
|
|
693
|
-
const parse2 =
|
|
807
|
+
const parse2 = import_semver2.default.parse(currentVersion);
|
|
694
808
|
if (typeof (parse2 == null ? void 0 : parse2.prerelease[0]) === "string")
|
|
695
809
|
preid = (parse2 == null ? void 0 : parse2.prerelease[0]) || "preid";
|
|
696
810
|
for (const type of releaseTypes)
|
|
@@ -702,7 +816,10 @@ async function promptForNewVersion(operation) {
|
|
|
702
816
|
const { currentVersion } = operation.state;
|
|
703
817
|
const release = operation.options.release;
|
|
704
818
|
const next = getNextVersions(currentVersion, release.preid);
|
|
705
|
-
const configCustomVersion = await ((_b = (_a = operation.options).customVersion) == null ? void 0 : _b.call(_a, currentVersion,
|
|
819
|
+
const configCustomVersion = await ((_b = (_a = operation.options).customVersion) == null ? void 0 : _b.call(_a, currentVersion, import_semver2.default));
|
|
820
|
+
if (operation.options.printCommits) {
|
|
821
|
+
await printRecentCommits(operation);
|
|
822
|
+
}
|
|
706
823
|
const PADDING = 13;
|
|
707
824
|
const answers = await (0, import_prompts.default)([
|
|
708
825
|
{
|
|
@@ -731,11 +848,11 @@ async function promptForNewVersion(operation) {
|
|
|
731
848
|
message: "Enter the new version number:",
|
|
732
849
|
initial: currentVersion,
|
|
733
850
|
validate: (custom) => {
|
|
734
|
-
return (0,
|
|
851
|
+
return (0, import_semver2.valid)(custom) ? true : "That's not a valid version number";
|
|
735
852
|
}
|
|
736
853
|
}
|
|
737
854
|
]);
|
|
738
|
-
const newVersion = answers.release === "none" ? currentVersion : answers.release === "custom" ? (0,
|
|
855
|
+
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];
|
|
739
856
|
if (!newVersion)
|
|
740
857
|
import_node_process3.default.exit(1);
|
|
741
858
|
switch (answers.release) {
|
|
@@ -748,106 +865,100 @@ async function promptForNewVersion(operation) {
|
|
|
748
865
|
return operation.update({ release: answers.release, newVersion });
|
|
749
866
|
}
|
|
750
867
|
}
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
868
|
+
var messageColorMap = {
|
|
869
|
+
chore: import_picocolors.default.gray,
|
|
870
|
+
fix: import_picocolors.default.yellow,
|
|
871
|
+
feat: import_picocolors.default.green,
|
|
872
|
+
refactor: import_picocolors.default.cyan,
|
|
873
|
+
docs: import_picocolors.default.blue,
|
|
874
|
+
doc: import_picocolors.default.blue,
|
|
875
|
+
ci: import_picocolors.default.gray,
|
|
876
|
+
build: import_picocolors.default.gray
|
|
877
|
+
};
|
|
878
|
+
async function printRecentCommits(operation) {
|
|
879
|
+
let sha;
|
|
880
|
+
sha || (sha = await ezSpawn.async(
|
|
881
|
+
"git",
|
|
882
|
+
["rev-list", "-n", "1", `v${operation.state.currentVersion}`],
|
|
883
|
+
{ stdio: "pipe" }
|
|
884
|
+
).then((res) => res.stdout.trim()).catch(() => void 0));
|
|
885
|
+
sha || (sha = await ezSpawn.async(
|
|
886
|
+
"git",
|
|
887
|
+
["rev-list", "-n", "1", operation.state.currentVersion],
|
|
888
|
+
{ stdio: "pipe" }
|
|
889
|
+
).then((res) => res.stdout.trim()).catch(() => void 0));
|
|
890
|
+
if (!sha) {
|
|
891
|
+
console.log(
|
|
892
|
+
import_picocolors.default.blue(`i`) + import_picocolors.default.gray(` Failed to locate the previous tag ${import_picocolors.default.yellow(`v${operation.state.currentVersion}`)}`)
|
|
893
|
+
);
|
|
894
|
+
return;
|
|
770
895
|
}
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
896
|
+
const message = await ezSpawn.async(
|
|
897
|
+
"git",
|
|
898
|
+
[
|
|
899
|
+
"--no-pager",
|
|
900
|
+
"log",
|
|
901
|
+
`${sha}..HEAD`,
|
|
902
|
+
"--oneline"
|
|
903
|
+
],
|
|
904
|
+
{ stdio: "pipe" }
|
|
905
|
+
);
|
|
906
|
+
const lines = message.stdout.toString().trim().split(/\n/g);
|
|
907
|
+
if (!lines.length) {
|
|
908
|
+
console.log();
|
|
909
|
+
console.log(import_picocolors.default.blue(`i`) + import_picocolors.default.gray(` No commits since ${operation.state.currentVersion}`));
|
|
910
|
+
console.log();
|
|
911
|
+
return;
|
|
912
|
+
}
|
|
913
|
+
const parsed = lines.map((line) => {
|
|
914
|
+
const [hash, ...parts] = line.split(" ");
|
|
915
|
+
const message2 = parts.join(" ");
|
|
916
|
+
const match = message2.match(/^(\w+)(\([^)]+\))?(!)?:(.*)$/);
|
|
917
|
+
if (match) {
|
|
918
|
+
let color = messageColorMap[match[1].toLowerCase()] || ((c4) => c4);
|
|
919
|
+
if (match[3] === "!") {
|
|
920
|
+
color = import_picocolors.default.red;
|
|
784
921
|
}
|
|
785
|
-
|
|
922
|
+
const tag = [match[1], match[2], match[3]].filter(Boolean).join("");
|
|
923
|
+
return {
|
|
924
|
+
hash,
|
|
925
|
+
tag,
|
|
926
|
+
message: match[4].trim(),
|
|
927
|
+
color
|
|
928
|
+
};
|
|
929
|
+
}
|
|
930
|
+
return {
|
|
931
|
+
hash,
|
|
932
|
+
tag: "",
|
|
933
|
+
message: message2,
|
|
934
|
+
color: (c4) => c4
|
|
935
|
+
};
|
|
786
936
|
});
|
|
787
|
-
}
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
937
|
+
const tagLength = parsed.map(({ tag }) => tag.length).reduce((a, b) => Math.max(a, b), 0);
|
|
938
|
+
const prettified = parsed.map(({ hash, tag, message: message2, color }) => {
|
|
939
|
+
const paddedTag = tag.padStart(tagLength + 2, " ");
|
|
940
|
+
return [
|
|
941
|
+
import_picocolors.default.dim(hash),
|
|
942
|
+
" ",
|
|
943
|
+
color === import_picocolors.default.gray ? color(paddedTag) : import_picocolors.default.bold(color(paddedTag)),
|
|
944
|
+
import_picocolors.default.dim(":"),
|
|
945
|
+
" ",
|
|
946
|
+
color === import_picocolors.default.gray ? color(message2) : message2
|
|
947
|
+
].join("");
|
|
796
948
|
});
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
}
|
|
803
|
-
function isPackageLockManifest(manifest) {
|
|
804
|
-
var _a, _b;
|
|
805
|
-
return typeof ((_b = (_a = manifest.packages) == null ? void 0 : _a[""]) == null ? void 0 : _b.version) === "string";
|
|
806
|
-
}
|
|
807
|
-
function isOptionalString(value) {
|
|
808
|
-
const type = typeof value;
|
|
809
|
-
return value === null || type === "undefined" || type === "string";
|
|
810
|
-
}
|
|
811
|
-
|
|
812
|
-
// src/get-current-version.ts
|
|
813
|
-
async function getCurrentVersion(operation) {
|
|
814
|
-
if (operation.state.currentVersion)
|
|
815
|
-
return operation;
|
|
816
|
-
const { cwd, files } = operation.options;
|
|
817
|
-
const filesToCheck = files.filter((file) => file.endsWith(".json"));
|
|
818
|
-
if (!filesToCheck.includes("package.json"))
|
|
819
|
-
filesToCheck.push("package.json");
|
|
820
|
-
if (!filesToCheck.includes("deno.json"))
|
|
821
|
-
filesToCheck.push("deno.json");
|
|
822
|
-
if (!filesToCheck.includes("deno.jsonc"))
|
|
823
|
-
filesToCheck.push("deno.jsonc");
|
|
824
|
-
for (const file of filesToCheck) {
|
|
825
|
-
const version2 = await readVersion(file, cwd);
|
|
826
|
-
if (version2) {
|
|
827
|
-
return operation.update({
|
|
828
|
-
currentVersionSource: file,
|
|
829
|
-
currentVersion: version2
|
|
830
|
-
});
|
|
831
|
-
}
|
|
832
|
-
}
|
|
833
|
-
throw new Error(
|
|
834
|
-
`Unable to determine the current version number. Checked ${filesToCheck.join(", ")}.`
|
|
949
|
+
console.log();
|
|
950
|
+
console.log(
|
|
951
|
+
import_picocolors.default.bold(
|
|
952
|
+
`${import_picocolors.default.green(lines.length)} Commits since ${import_picocolors.default.gray(sha.slice(0, 7))}:`
|
|
953
|
+
)
|
|
835
954
|
);
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
const { data: manifest } = await readJsoncFile(file, cwd);
|
|
840
|
-
if (isManifest(manifest)) {
|
|
841
|
-
if ((0, import_semver2.valid)(manifest.version))
|
|
842
|
-
return manifest.version;
|
|
843
|
-
}
|
|
844
|
-
} catch (e) {
|
|
845
|
-
return void 0;
|
|
846
|
-
}
|
|
955
|
+
console.log();
|
|
956
|
+
console.log(prettified.reverse().join("\n"));
|
|
957
|
+
console.log();
|
|
847
958
|
}
|
|
848
959
|
|
|
849
960
|
// src/git.ts
|
|
850
|
-
var
|
|
961
|
+
var ezSpawn2 = __toESM(require("@jsdevtools/ez-spawn"));
|
|
851
962
|
async function gitCommit(operation) {
|
|
852
963
|
if (!operation.options.commit)
|
|
853
964
|
return operation;
|
|
@@ -864,7 +975,7 @@ async function gitCommit(operation) {
|
|
|
864
975
|
args.push("--message", commitMessage);
|
|
865
976
|
if (!all)
|
|
866
977
|
args = args.concat(updatedFiles);
|
|
867
|
-
await
|
|
978
|
+
await ezSpawn2.async("git", ["commit", ...args]);
|
|
868
979
|
return operation.update({ event: "git commit" /* GitCommit */, commitMessage });
|
|
869
980
|
}
|
|
870
981
|
async function gitTag(operation) {
|
|
@@ -882,15 +993,15 @@ async function gitTag(operation) {
|
|
|
882
993
|
];
|
|
883
994
|
const tagName = formatVersionString(tag.name, newVersion);
|
|
884
995
|
args.push(tagName);
|
|
885
|
-
await
|
|
996
|
+
await ezSpawn2.async("git", ["tag", ...args]);
|
|
886
997
|
return operation.update({ event: "git tag" /* GitTag */, tagName });
|
|
887
998
|
}
|
|
888
999
|
async function gitPush(operation) {
|
|
889
1000
|
if (!operation.options.push)
|
|
890
1001
|
return operation;
|
|
891
|
-
await
|
|
1002
|
+
await ezSpawn2.async("git", "push");
|
|
892
1003
|
if (operation.options.tag) {
|
|
893
|
-
await
|
|
1004
|
+
await ezSpawn2.async("git", ["push", "--tags"]);
|
|
894
1005
|
}
|
|
895
1006
|
return operation.update({ event: "git push" /* GitPush */ });
|
|
896
1007
|
}
|
|
@@ -902,13 +1013,13 @@ function formatVersionString(template, newVersion) {
|
|
|
902
1013
|
}
|
|
903
1014
|
|
|
904
1015
|
// src/normalize-options.ts
|
|
905
|
-
var import_node_process4 = __toESM(require("process"));
|
|
906
|
-
var import_promises = __toESM(require("fs/promises"));
|
|
907
1016
|
var import_node_fs2 = __toESM(require("fs"));
|
|
1017
|
+
var import_promises = __toESM(require("fs/promises"));
|
|
1018
|
+
var import_node_process4 = __toESM(require("process"));
|
|
908
1019
|
var import_fast_glob = __toESM(require("fast-glob"));
|
|
909
1020
|
var import_js_yaml = __toESM(require("js-yaml"));
|
|
910
1021
|
async function normalizeOptions(raw) {
|
|
911
|
-
var _a, _b;
|
|
1022
|
+
var _a, _b, _d;
|
|
912
1023
|
const preid = typeof raw.preid === "string" ? raw.preid : "beta";
|
|
913
1024
|
const push = Boolean(raw.push);
|
|
914
1025
|
const all = Boolean(raw.all);
|
|
@@ -992,6 +1103,7 @@ async function normalizeOptions(raw) {
|
|
|
992
1103
|
interface: ui,
|
|
993
1104
|
ignoreScripts,
|
|
994
1105
|
execute,
|
|
1106
|
+
printCommits: (_d = raw.printCommits) != null ? _d : true,
|
|
995
1107
|
customVersion: raw.customVersion,
|
|
996
1108
|
currentVersion: raw.currentVersion
|
|
997
1109
|
};
|
|
@@ -1062,13 +1174,13 @@ var Operation = class _Operation {
|
|
|
1062
1174
|
};
|
|
1063
1175
|
|
|
1064
1176
|
// src/run-npm-script.ts
|
|
1065
|
-
var
|
|
1177
|
+
var ezSpawn3 = __toESM(require("@jsdevtools/ez-spawn"));
|
|
1066
1178
|
async function runNpmScript(script, operation) {
|
|
1067
1179
|
const { cwd, ignoreScripts } = operation.options;
|
|
1068
1180
|
if (!ignoreScripts) {
|
|
1069
1181
|
const { data: manifest } = await readJsoncFile("package.json", cwd);
|
|
1070
1182
|
if (isManifest(manifest) && hasScript(manifest, script)) {
|
|
1071
|
-
await
|
|
1183
|
+
await ezSpawn3.async("npm", ["run", script, "--silent"], { stdio: "inherit" });
|
|
1072
1184
|
operation.update({ event: "npm script" /* NpmScript */, script });
|
|
1073
1185
|
}
|
|
1074
1186
|
}
|
|
@@ -1082,6 +1194,7 @@ function hasScript(manifest, script) {
|
|
|
1082
1194
|
}
|
|
1083
1195
|
|
|
1084
1196
|
// src/update-files.ts
|
|
1197
|
+
var import_node_fs3 = require("fs");
|
|
1085
1198
|
var path2 = __toESM(require("path"));
|
|
1086
1199
|
async function updateFiles(operation) {
|
|
1087
1200
|
const { files } = operation.options;
|
|
@@ -1102,6 +1215,9 @@ async function updateFiles(operation) {
|
|
|
1102
1215
|
return operation;
|
|
1103
1216
|
}
|
|
1104
1217
|
async function updateFile(relPath, operation) {
|
|
1218
|
+
if (!(0, import_node_fs3.existsSync)(relPath)) {
|
|
1219
|
+
return false;
|
|
1220
|
+
}
|
|
1105
1221
|
const name = path2.basename(relPath).trim().toLowerCase();
|
|
1106
1222
|
switch (name) {
|
|
1107
1223
|
case "package.json":
|
|
@@ -1168,7 +1284,7 @@ async function versionBump(arg = {}) {
|
|
|
1168
1284
|
await updateFiles(operation);
|
|
1169
1285
|
if (operation.options.execute) {
|
|
1170
1286
|
console.log(log_symbols_default.info, "Executing script", operation.options.execute);
|
|
1171
|
-
await
|
|
1287
|
+
await ezSpawn4.async(operation.options.execute, { stdio: "inherit" });
|
|
1172
1288
|
console.log(log_symbols_default.success, "Script finished");
|
|
1173
1289
|
}
|
|
1174
1290
|
await runNpmScript("version" /* Version */, operation);
|
|
@@ -1197,13 +1313,13 @@ function printSummary(operation) {
|
|
|
1197
1313
|
|
|
1198
1314
|
// src/cli/parse-args.ts
|
|
1199
1315
|
var import_node_process7 = __toESM(require("process"));
|
|
1200
|
-
var import_semver3 = require("semver");
|
|
1201
1316
|
var import_cac = __toESM(require("cac"));
|
|
1202
1317
|
var import_picocolors3 = __toESM(require_picocolors());
|
|
1318
|
+
var import_semver3 = require("semver");
|
|
1203
1319
|
|
|
1204
1320
|
// src/config.ts
|
|
1205
|
-
var import_node_process6 = __toESM(require("process"));
|
|
1206
1321
|
var import_node_path2 = require("path");
|
|
1322
|
+
var import_node_process6 = __toESM(require("process"));
|
|
1207
1323
|
var import_c12 = require("c12");
|
|
1208
1324
|
var import_sync = __toESM(require("escalade/sync"));
|
|
1209
1325
|
var bumpConfigDefaults = {
|
|
@@ -1275,7 +1391,7 @@ async function parseArgs() {
|
|
|
1275
1391
|
ignoreScripts: args.ignoreScripts,
|
|
1276
1392
|
currentVersion: args.currentVersion,
|
|
1277
1393
|
execute: args.execute,
|
|
1278
|
-
recursive:
|
|
1394
|
+
recursive: args.recursive
|
|
1279
1395
|
})
|
|
1280
1396
|
};
|
|
1281
1397
|
if (parsedArgs.options.files && parsedArgs.options.files.length > 0) {
|
|
@@ -1294,7 +1410,7 @@ async function parseArgs() {
|
|
|
1294
1410
|
}
|
|
1295
1411
|
function loadCliArgs(argv = import_node_process7.default.argv) {
|
|
1296
1412
|
const cli = (0, import_cac.default)("bumpp");
|
|
1297
|
-
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();
|
|
1413
|
+
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();
|
|
1298
1414
|
const result = cli.parse(argv);
|
|
1299
1415
|
const rawArgs = cli.rawArgs;
|
|
1300
1416
|
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-CNEN62NE.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.0";
|
|
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
|
}
|