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
|
@@ -60,9 +60,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
60
60
|
mod
|
|
61
61
|
));
|
|
62
62
|
|
|
63
|
-
// node_modules/.pnpm/picocolors@1.0
|
|
63
|
+
// node_modules/.pnpm/picocolors@1.1.0/node_modules/picocolors/picocolors.js
|
|
64
64
|
var require_picocolors = __commonJS({
|
|
65
|
-
"node_modules/.pnpm/picocolors@1.0
|
|
65
|
+
"node_modules/.pnpm/picocolors@1.1.0/node_modules/picocolors/picocolors.js"(exports, module) {
|
|
66
66
|
var argv = process.argv || [];
|
|
67
67
|
var env2 = process.env;
|
|
68
68
|
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);
|
|
@@ -109,7 +109,23 @@ var require_picocolors = __commonJS({
|
|
|
109
109
|
bgBlue: init("\x1B[44m", "\x1B[49m"),
|
|
110
110
|
bgMagenta: init("\x1B[45m", "\x1B[49m"),
|
|
111
111
|
bgCyan: init("\x1B[46m", "\x1B[49m"),
|
|
112
|
-
bgWhite: init("\x1B[47m", "\x1B[49m")
|
|
112
|
+
bgWhite: init("\x1B[47m", "\x1B[49m"),
|
|
113
|
+
blackBright: init("\x1B[90m", "\x1B[39m"),
|
|
114
|
+
redBright: init("\x1B[91m", "\x1B[39m"),
|
|
115
|
+
greenBright: init("\x1B[92m", "\x1B[39m"),
|
|
116
|
+
yellowBright: init("\x1B[93m", "\x1B[39m"),
|
|
117
|
+
blueBright: init("\x1B[94m", "\x1B[39m"),
|
|
118
|
+
magentaBright: init("\x1B[95m", "\x1B[39m"),
|
|
119
|
+
cyanBright: init("\x1B[96m", "\x1B[39m"),
|
|
120
|
+
whiteBright: init("\x1B[97m", "\x1B[39m"),
|
|
121
|
+
bgBlackBright: init("\x1B[100m", "\x1B[49m"),
|
|
122
|
+
bgRedBright: init("\x1B[101m", "\x1B[49m"),
|
|
123
|
+
bgGreenBright: init("\x1B[102m", "\x1B[49m"),
|
|
124
|
+
bgYellowBright: init("\x1B[103m", "\x1B[49m"),
|
|
125
|
+
bgBlueBright: init("\x1B[104m", "\x1B[49m"),
|
|
126
|
+
bgMagentaBright: init("\x1B[105m", "\x1B[49m"),
|
|
127
|
+
bgCyanBright: init("\x1B[106m", "\x1B[49m"),
|
|
128
|
+
bgWhiteBright: init("\x1B[107m", "\x1B[49m")
|
|
113
129
|
};
|
|
114
130
|
};
|
|
115
131
|
module.exports = createColors();
|
|
@@ -657,106 +673,13 @@ var NpmScript = /* @__PURE__ */ ((NpmScript2) => {
|
|
|
657
673
|
})(NpmScript || {});
|
|
658
674
|
|
|
659
675
|
// src/version-bump.ts
|
|
660
|
-
var import_picocolors2 = __toESM(require_picocolors());
|
|
661
676
|
import process6 from "process";
|
|
662
|
-
import * as
|
|
677
|
+
import * as ezSpawn4 from "@jsdevtools/ez-spawn";
|
|
678
|
+
var import_picocolors3 = __toESM(require_picocolors());
|
|
663
679
|
import prompts2 from "prompts";
|
|
664
680
|
|
|
665
|
-
// src/get-new-version.ts
|
|
666
|
-
var import_picocolors = __toESM(require_picocolors());
|
|
667
|
-
import process4 from "process";
|
|
668
|
-
import prompts from "prompts";
|
|
669
|
-
import semver, { SemVer, clean as cleanVersion, valid as isValidVersion } from "semver";
|
|
670
|
-
async function getNewVersion(operation) {
|
|
671
|
-
const { release } = operation.options;
|
|
672
|
-
const { currentVersion } = operation.state;
|
|
673
|
-
switch (release.type) {
|
|
674
|
-
case "prompt":
|
|
675
|
-
return promptForNewVersion(operation);
|
|
676
|
-
case "version":
|
|
677
|
-
return operation.update({
|
|
678
|
-
newVersion: new SemVer(release.version, true).version
|
|
679
|
-
});
|
|
680
|
-
default:
|
|
681
|
-
return operation.update({
|
|
682
|
-
release: release.type,
|
|
683
|
-
newVersion: getNextVersion(currentVersion, release)
|
|
684
|
-
});
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
function getNextVersion(currentVersion, bump) {
|
|
688
|
-
const oldSemVer = new SemVer(currentVersion);
|
|
689
|
-
const type = bump.type === "next" ? oldSemVer.prerelease.length ? "prerelease" : "patch" : bump.type;
|
|
690
|
-
const newSemVer = oldSemVer.inc(type, bump.preid);
|
|
691
|
-
if (isPrerelease(bump.type) && newSemVer.prerelease.length === 2 && newSemVer.prerelease[0] === bump.preid && String(newSemVer.prerelease[1]) === "0") {
|
|
692
|
-
newSemVer.prerelease[1] = "1";
|
|
693
|
-
newSemVer.format();
|
|
694
|
-
}
|
|
695
|
-
return newSemVer.version;
|
|
696
|
-
}
|
|
697
|
-
function getNextVersions(currentVersion, preid) {
|
|
698
|
-
const next = {};
|
|
699
|
-
const parse2 = semver.parse(currentVersion);
|
|
700
|
-
if (typeof (parse2 == null ? void 0 : parse2.prerelease[0]) === "string")
|
|
701
|
-
preid = (parse2 == null ? void 0 : parse2.prerelease[0]) || "preid";
|
|
702
|
-
for (const type of releaseTypes)
|
|
703
|
-
next[type] = getNextVersion(currentVersion, { type, preid });
|
|
704
|
-
return next;
|
|
705
|
-
}
|
|
706
|
-
async function promptForNewVersion(operation) {
|
|
707
|
-
var _a, _b;
|
|
708
|
-
const { currentVersion } = operation.state;
|
|
709
|
-
const release = operation.options.release;
|
|
710
|
-
const next = getNextVersions(currentVersion, release.preid);
|
|
711
|
-
const configCustomVersion = await ((_b = (_a = operation.options).customVersion) == null ? void 0 : _b.call(_a, currentVersion, semver));
|
|
712
|
-
const PADDING = 13;
|
|
713
|
-
const answers = await prompts([
|
|
714
|
-
{
|
|
715
|
-
type: "autocomplete",
|
|
716
|
-
name: "release",
|
|
717
|
-
message: `Current version ${import_picocolors.default.green(currentVersion)}`,
|
|
718
|
-
initial: configCustomVersion ? "config" : "next",
|
|
719
|
-
choices: [
|
|
720
|
-
{ value: "major", title: `${"major".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.major)}` },
|
|
721
|
-
{ value: "minor", title: `${"minor".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.minor)}` },
|
|
722
|
-
{ value: "patch", title: `${"patch".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.patch)}` },
|
|
723
|
-
{ value: "next", title: `${"next".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.next)}` },
|
|
724
|
-
...configCustomVersion ? [
|
|
725
|
-
{ value: "config", title: `${"from config".padStart(PADDING, " ")} ${import_picocolors.default.bold(configCustomVersion)}` }
|
|
726
|
-
] : [],
|
|
727
|
-
{ value: "prepatch", title: `${"pre-patch".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.prepatch)}` },
|
|
728
|
-
{ value: "preminor", title: `${"pre-minor".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.preminor)}` },
|
|
729
|
-
{ value: "premajor", title: `${"pre-major".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.premajor)}` },
|
|
730
|
-
{ value: "none", title: `${"as-is".padStart(PADDING, " ")} ${import_picocolors.default.bold(currentVersion)}` },
|
|
731
|
-
{ value: "custom", title: "custom ...".padStart(PADDING + 4, " ") }
|
|
732
|
-
]
|
|
733
|
-
},
|
|
734
|
-
{
|
|
735
|
-
type: (prev) => prev === "custom" ? "text" : null,
|
|
736
|
-
name: "custom",
|
|
737
|
-
message: "Enter the new version number:",
|
|
738
|
-
initial: currentVersion,
|
|
739
|
-
validate: (custom) => {
|
|
740
|
-
return isValidVersion(custom) ? true : "That's not a valid version number";
|
|
741
|
-
}
|
|
742
|
-
}
|
|
743
|
-
]);
|
|
744
|
-
const newVersion = answers.release === "none" ? currentVersion : answers.release === "custom" ? cleanVersion(answers.custom) : answers.release === "config" ? cleanVersion(configCustomVersion) : next[answers.release];
|
|
745
|
-
if (!newVersion)
|
|
746
|
-
process4.exit(1);
|
|
747
|
-
switch (answers.release) {
|
|
748
|
-
case "custom":
|
|
749
|
-
case "config":
|
|
750
|
-
case "next":
|
|
751
|
-
case "none":
|
|
752
|
-
return operation.update({ newVersion });
|
|
753
|
-
default:
|
|
754
|
-
return operation.update({ release: answers.release, newVersion });
|
|
755
|
-
}
|
|
756
|
-
}
|
|
757
|
-
|
|
758
681
|
// src/get-current-version.ts
|
|
759
|
-
import { valid as
|
|
682
|
+
import { valid as isValidVersion } from "semver";
|
|
760
683
|
|
|
761
684
|
// src/fs.ts
|
|
762
685
|
import fs from "fs";
|
|
@@ -844,7 +767,7 @@ async function readVersion(file, cwd) {
|
|
|
844
767
|
try {
|
|
845
768
|
const { data: manifest } = await readJsoncFile(file, cwd);
|
|
846
769
|
if (isManifest(manifest)) {
|
|
847
|
-
if (
|
|
770
|
+
if (isValidVersion(manifest.version))
|
|
848
771
|
return manifest.version;
|
|
849
772
|
}
|
|
850
773
|
} catch (e) {
|
|
@@ -852,8 +775,220 @@ async function readVersion(file, cwd) {
|
|
|
852
775
|
}
|
|
853
776
|
}
|
|
854
777
|
|
|
855
|
-
// src/
|
|
778
|
+
// src/get-new-version.ts
|
|
779
|
+
var import_picocolors2 = __toESM(require_picocolors());
|
|
780
|
+
import process4 from "process";
|
|
781
|
+
import prompts from "prompts";
|
|
782
|
+
import semver, { clean as cleanVersion, valid as isValidVersion2, SemVer } from "semver";
|
|
783
|
+
|
|
784
|
+
// src/print-commits.ts
|
|
785
|
+
var import_picocolors = __toESM(require_picocolors());
|
|
856
786
|
import * as ezSpawn from "@jsdevtools/ez-spawn";
|
|
787
|
+
var messageColorMap = {
|
|
788
|
+
chore: import_picocolors.default.gray,
|
|
789
|
+
fix: import_picocolors.default.yellow,
|
|
790
|
+
feat: import_picocolors.default.green,
|
|
791
|
+
refactor: import_picocolors.default.cyan,
|
|
792
|
+
docs: import_picocolors.default.blue,
|
|
793
|
+
doc: import_picocolors.default.blue,
|
|
794
|
+
ci: import_picocolors.default.gray,
|
|
795
|
+
build: import_picocolors.default.gray
|
|
796
|
+
};
|
|
797
|
+
function parseCommits(raw) {
|
|
798
|
+
const lines = raw.toString().trim().split(/\n/g);
|
|
799
|
+
if (!lines.length) {
|
|
800
|
+
return [];
|
|
801
|
+
}
|
|
802
|
+
return lines.map((line) => {
|
|
803
|
+
const [hash, ...parts] = line.split(" ");
|
|
804
|
+
const message = parts.join(" ");
|
|
805
|
+
const match = message.match(/^(\w+)(!)?(\([^)]+\))?:(.*)$/);
|
|
806
|
+
if (match) {
|
|
807
|
+
let color = messageColorMap[match[1].toLowerCase()] || ((c4) => c4);
|
|
808
|
+
if (match[2] === "!") {
|
|
809
|
+
color = (s) => import_picocolors.default.inverse(import_picocolors.default.red(s));
|
|
810
|
+
}
|
|
811
|
+
const tag = [match[1], match[2]].filter(Boolean).join("");
|
|
812
|
+
const scope = match[3] || "";
|
|
813
|
+
return {
|
|
814
|
+
hash,
|
|
815
|
+
tag,
|
|
816
|
+
message: match[4].trim(),
|
|
817
|
+
scope,
|
|
818
|
+
breaking: match[2] === "!",
|
|
819
|
+
color
|
|
820
|
+
};
|
|
821
|
+
}
|
|
822
|
+
return {
|
|
823
|
+
hash,
|
|
824
|
+
tag: "",
|
|
825
|
+
message,
|
|
826
|
+
scope: "",
|
|
827
|
+
color: (c4) => c4
|
|
828
|
+
};
|
|
829
|
+
}).reverse();
|
|
830
|
+
}
|
|
831
|
+
function formatParsedCommits(commits) {
|
|
832
|
+
const tagLength = commits.map(({ tag }) => tag.length).reduce((a, b) => Math.max(a, b), 0);
|
|
833
|
+
let scopeLength = commits.map(({ scope }) => scope.length).reduce((a, b) => Math.max(a, b), 0);
|
|
834
|
+
if (scopeLength)
|
|
835
|
+
scopeLength += 2;
|
|
836
|
+
return commits.map(({ hash, tag, message, scope, color }) => {
|
|
837
|
+
const paddedTag = tag.padStart(tagLength + 1, " ");
|
|
838
|
+
const paddedScope = !scope ? " ".repeat(scopeLength) : import_picocolors.default.dim("(") + scope.slice(1, -1) + import_picocolors.default.dim(")") + " ".repeat(scopeLength - scope.length);
|
|
839
|
+
return [
|
|
840
|
+
import_picocolors.default.dim(hash),
|
|
841
|
+
" ",
|
|
842
|
+
color === import_picocolors.default.gray ? color(paddedTag) : import_picocolors.default.bold(color(paddedTag)),
|
|
843
|
+
" ",
|
|
844
|
+
paddedScope,
|
|
845
|
+
import_picocolors.default.dim(":"),
|
|
846
|
+
" ",
|
|
847
|
+
color === import_picocolors.default.gray ? color(message) : message
|
|
848
|
+
].join("");
|
|
849
|
+
});
|
|
850
|
+
}
|
|
851
|
+
async function printRecentCommits(operation) {
|
|
852
|
+
let sha;
|
|
853
|
+
sha || (sha = await ezSpawn.async(
|
|
854
|
+
"git",
|
|
855
|
+
["rev-list", "-n", "1", `v${operation.state.currentVersion}`],
|
|
856
|
+
{ stdio: "pipe" }
|
|
857
|
+
).then((res) => res.stdout.trim()).catch(() => void 0));
|
|
858
|
+
sha || (sha = await ezSpawn.async(
|
|
859
|
+
"git",
|
|
860
|
+
["rev-list", "-n", "1", operation.state.currentVersion],
|
|
861
|
+
{ stdio: "pipe" }
|
|
862
|
+
).then((res) => res.stdout.trim()).catch(() => void 0));
|
|
863
|
+
if (!sha) {
|
|
864
|
+
console.log(
|
|
865
|
+
import_picocolors.default.blue(`i`) + import_picocolors.default.gray(` Failed to locate the previous tag ${import_picocolors.default.yellow(`v${operation.state.currentVersion}`)}`)
|
|
866
|
+
);
|
|
867
|
+
return;
|
|
868
|
+
}
|
|
869
|
+
const { stdout } = await ezSpawn.async(
|
|
870
|
+
"git",
|
|
871
|
+
[
|
|
872
|
+
"--no-pager",
|
|
873
|
+
"log",
|
|
874
|
+
`${sha}..HEAD`,
|
|
875
|
+
"--oneline"
|
|
876
|
+
],
|
|
877
|
+
{ stdio: "pipe" }
|
|
878
|
+
);
|
|
879
|
+
const parsed = parseCommits(stdout.toString().trim());
|
|
880
|
+
const prettified = formatParsedCommits(parsed);
|
|
881
|
+
if (!parsed.length) {
|
|
882
|
+
console.log();
|
|
883
|
+
console.log(import_picocolors.default.blue(`i`) + import_picocolors.default.gray(` No commits since ${operation.state.currentVersion}`));
|
|
884
|
+
console.log();
|
|
885
|
+
return;
|
|
886
|
+
}
|
|
887
|
+
console.log();
|
|
888
|
+
console.log(
|
|
889
|
+
import_picocolors.default.bold(
|
|
890
|
+
`${import_picocolors.default.green(parsed.length)} Commits since ${import_picocolors.default.gray(sha.slice(0, 7))}:`
|
|
891
|
+
)
|
|
892
|
+
);
|
|
893
|
+
console.log();
|
|
894
|
+
console.log(prettified.join("\n"));
|
|
895
|
+
console.log();
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
// src/get-new-version.ts
|
|
899
|
+
async function getNewVersion(operation) {
|
|
900
|
+
const { release } = operation.options;
|
|
901
|
+
const { currentVersion } = operation.state;
|
|
902
|
+
switch (release.type) {
|
|
903
|
+
case "prompt":
|
|
904
|
+
return promptForNewVersion(operation);
|
|
905
|
+
case "version":
|
|
906
|
+
return operation.update({
|
|
907
|
+
newVersion: new SemVer(release.version, true).version
|
|
908
|
+
});
|
|
909
|
+
default:
|
|
910
|
+
return operation.update({
|
|
911
|
+
release: release.type,
|
|
912
|
+
newVersion: getNextVersion(currentVersion, release)
|
|
913
|
+
});
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
function getNextVersion(currentVersion, bump) {
|
|
917
|
+
const oldSemVer = new SemVer(currentVersion);
|
|
918
|
+
const type = bump.type === "next" ? oldSemVer.prerelease.length ? "prerelease" : "patch" : bump.type;
|
|
919
|
+
const newSemVer = oldSemVer.inc(type, bump.preid);
|
|
920
|
+
if (isPrerelease(bump.type) && newSemVer.prerelease.length === 2 && newSemVer.prerelease[0] === bump.preid && String(newSemVer.prerelease[1]) === "0") {
|
|
921
|
+
newSemVer.prerelease[1] = "1";
|
|
922
|
+
newSemVer.format();
|
|
923
|
+
}
|
|
924
|
+
return newSemVer.version;
|
|
925
|
+
}
|
|
926
|
+
function getNextVersions(currentVersion, preid) {
|
|
927
|
+
const next = {};
|
|
928
|
+
const parse2 = semver.parse(currentVersion);
|
|
929
|
+
if (typeof (parse2 == null ? void 0 : parse2.prerelease[0]) === "string")
|
|
930
|
+
preid = (parse2 == null ? void 0 : parse2.prerelease[0]) || "preid";
|
|
931
|
+
for (const type of releaseTypes)
|
|
932
|
+
next[type] = getNextVersion(currentVersion, { type, preid });
|
|
933
|
+
return next;
|
|
934
|
+
}
|
|
935
|
+
async function promptForNewVersion(operation) {
|
|
936
|
+
var _a, _b;
|
|
937
|
+
const { currentVersion } = operation.state;
|
|
938
|
+
const release = operation.options.release;
|
|
939
|
+
const next = getNextVersions(currentVersion, release.preid);
|
|
940
|
+
const configCustomVersion = await ((_b = (_a = operation.options).customVersion) == null ? void 0 : _b.call(_a, currentVersion, semver));
|
|
941
|
+
if (operation.options.printCommits) {
|
|
942
|
+
await printRecentCommits(operation);
|
|
943
|
+
}
|
|
944
|
+
const PADDING = 13;
|
|
945
|
+
const answers = await prompts([
|
|
946
|
+
{
|
|
947
|
+
type: "autocomplete",
|
|
948
|
+
name: "release",
|
|
949
|
+
message: `Current version ${import_picocolors2.default.green(currentVersion)}`,
|
|
950
|
+
initial: configCustomVersion ? "config" : "next",
|
|
951
|
+
choices: [
|
|
952
|
+
{ value: "major", title: `${"major".padStart(PADDING, " ")} ${import_picocolors2.default.bold(next.major)}` },
|
|
953
|
+
{ value: "minor", title: `${"minor".padStart(PADDING, " ")} ${import_picocolors2.default.bold(next.minor)}` },
|
|
954
|
+
{ value: "patch", title: `${"patch".padStart(PADDING, " ")} ${import_picocolors2.default.bold(next.patch)}` },
|
|
955
|
+
{ value: "next", title: `${"next".padStart(PADDING, " ")} ${import_picocolors2.default.bold(next.next)}` },
|
|
956
|
+
...configCustomVersion ? [
|
|
957
|
+
{ value: "config", title: `${"from config".padStart(PADDING, " ")} ${import_picocolors2.default.bold(configCustomVersion)}` }
|
|
958
|
+
] : [],
|
|
959
|
+
{ value: "prepatch", title: `${"pre-patch".padStart(PADDING, " ")} ${import_picocolors2.default.bold(next.prepatch)}` },
|
|
960
|
+
{ value: "preminor", title: `${"pre-minor".padStart(PADDING, " ")} ${import_picocolors2.default.bold(next.preminor)}` },
|
|
961
|
+
{ value: "premajor", title: `${"pre-major".padStart(PADDING, " ")} ${import_picocolors2.default.bold(next.premajor)}` },
|
|
962
|
+
{ value: "none", title: `${"as-is".padStart(PADDING, " ")} ${import_picocolors2.default.bold(currentVersion)}` },
|
|
963
|
+
{ value: "custom", title: "custom ...".padStart(PADDING + 4, " ") }
|
|
964
|
+
]
|
|
965
|
+
},
|
|
966
|
+
{
|
|
967
|
+
type: (prev) => prev === "custom" ? "text" : null,
|
|
968
|
+
name: "custom",
|
|
969
|
+
message: "Enter the new version number:",
|
|
970
|
+
initial: currentVersion,
|
|
971
|
+
validate: (custom) => {
|
|
972
|
+
return isValidVersion2(custom) ? true : "That's not a valid version number";
|
|
973
|
+
}
|
|
974
|
+
}
|
|
975
|
+
]);
|
|
976
|
+
const newVersion = answers.release === "none" ? currentVersion : answers.release === "custom" ? cleanVersion(answers.custom) : answers.release === "config" ? cleanVersion(configCustomVersion) : next[answers.release];
|
|
977
|
+
if (!newVersion)
|
|
978
|
+
process4.exit(1);
|
|
979
|
+
switch (answers.release) {
|
|
980
|
+
case "custom":
|
|
981
|
+
case "config":
|
|
982
|
+
case "next":
|
|
983
|
+
case "none":
|
|
984
|
+
return operation.update({ newVersion });
|
|
985
|
+
default:
|
|
986
|
+
return operation.update({ release: answers.release, newVersion });
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
// src/git.ts
|
|
991
|
+
import * as ezSpawn2 from "@jsdevtools/ez-spawn";
|
|
857
992
|
async function gitCommit(operation) {
|
|
858
993
|
if (!operation.options.commit)
|
|
859
994
|
return operation;
|
|
@@ -870,7 +1005,7 @@ async function gitCommit(operation) {
|
|
|
870
1005
|
args.push("--message", commitMessage);
|
|
871
1006
|
if (!all)
|
|
872
1007
|
args = args.concat(updatedFiles);
|
|
873
|
-
await
|
|
1008
|
+
await ezSpawn2.async("git", ["commit", ...args]);
|
|
874
1009
|
return operation.update({ event: "git commit" /* GitCommit */, commitMessage });
|
|
875
1010
|
}
|
|
876
1011
|
async function gitTag(operation) {
|
|
@@ -888,15 +1023,15 @@ async function gitTag(operation) {
|
|
|
888
1023
|
];
|
|
889
1024
|
const tagName = formatVersionString(tag.name, newVersion);
|
|
890
1025
|
args.push(tagName);
|
|
891
|
-
await
|
|
1026
|
+
await ezSpawn2.async("git", ["tag", ...args]);
|
|
892
1027
|
return operation.update({ event: "git tag" /* GitTag */, tagName });
|
|
893
1028
|
}
|
|
894
1029
|
async function gitPush(operation) {
|
|
895
1030
|
if (!operation.options.push)
|
|
896
1031
|
return operation;
|
|
897
|
-
await
|
|
1032
|
+
await ezSpawn2.async("git", "push");
|
|
898
1033
|
if (operation.options.tag) {
|
|
899
|
-
await
|
|
1034
|
+
await ezSpawn2.async("git", ["push", "--tags"]);
|
|
900
1035
|
}
|
|
901
1036
|
return operation.update({ event: "git push" /* GitPush */ });
|
|
902
1037
|
}
|
|
@@ -908,13 +1043,13 @@ function formatVersionString(template, newVersion) {
|
|
|
908
1043
|
}
|
|
909
1044
|
|
|
910
1045
|
// src/normalize-options.ts
|
|
911
|
-
import process5 from "process";
|
|
912
|
-
import fs2 from "fs/promises";
|
|
913
1046
|
import fsSync from "fs";
|
|
1047
|
+
import fs2 from "fs/promises";
|
|
1048
|
+
import process5 from "process";
|
|
914
1049
|
import fg from "fast-glob";
|
|
915
1050
|
import yaml from "js-yaml";
|
|
916
1051
|
async function normalizeOptions(raw) {
|
|
917
|
-
var _a, _b;
|
|
1052
|
+
var _a, _b, _d;
|
|
918
1053
|
const preid = typeof raw.preid === "string" ? raw.preid : "beta";
|
|
919
1054
|
const push = Boolean(raw.push);
|
|
920
1055
|
const all = Boolean(raw.all);
|
|
@@ -998,6 +1133,7 @@ async function normalizeOptions(raw) {
|
|
|
998
1133
|
interface: ui,
|
|
999
1134
|
ignoreScripts,
|
|
1000
1135
|
execute,
|
|
1136
|
+
printCommits: (_d = raw.printCommits) != null ? _d : true,
|
|
1001
1137
|
customVersion: raw.customVersion,
|
|
1002
1138
|
currentVersion: raw.currentVersion
|
|
1003
1139
|
};
|
|
@@ -1068,13 +1204,13 @@ var Operation = class _Operation {
|
|
|
1068
1204
|
};
|
|
1069
1205
|
|
|
1070
1206
|
// src/run-npm-script.ts
|
|
1071
|
-
import * as
|
|
1207
|
+
import * as ezSpawn3 from "@jsdevtools/ez-spawn";
|
|
1072
1208
|
async function runNpmScript(script, operation) {
|
|
1073
1209
|
const { cwd, ignoreScripts } = operation.options;
|
|
1074
1210
|
if (!ignoreScripts) {
|
|
1075
1211
|
const { data: manifest } = await readJsoncFile("package.json", cwd);
|
|
1076
1212
|
if (isManifest(manifest) && hasScript(manifest, script)) {
|
|
1077
|
-
await
|
|
1213
|
+
await ezSpawn3.async("npm", ["run", script, "--silent"], { stdio: "inherit" });
|
|
1078
1214
|
operation.update({ event: "npm script" /* NpmScript */, script });
|
|
1079
1215
|
}
|
|
1080
1216
|
}
|
|
@@ -1088,8 +1224,8 @@ function hasScript(manifest, script) {
|
|
|
1088
1224
|
}
|
|
1089
1225
|
|
|
1090
1226
|
// src/update-files.ts
|
|
1091
|
-
import * as path2 from "path";
|
|
1092
1227
|
import { existsSync } from "fs";
|
|
1228
|
+
import * as path2 from "path";
|
|
1093
1229
|
async function updateFiles(operation) {
|
|
1094
1230
|
const { files } = operation.options;
|
|
1095
1231
|
for (const relPath of files) {
|
|
@@ -1178,7 +1314,7 @@ async function versionBump(arg = {}) {
|
|
|
1178
1314
|
await updateFiles(operation);
|
|
1179
1315
|
if (operation.options.execute) {
|
|
1180
1316
|
console.log(log_symbols_default.info, "Executing script", operation.options.execute);
|
|
1181
|
-
await
|
|
1317
|
+
await ezSpawn4.async(operation.options.execute, { stdio: "inherit" });
|
|
1182
1318
|
console.log(log_symbols_default.success, "Script finished");
|
|
1183
1319
|
}
|
|
1184
1320
|
await runNpmScript("version" /* Version */, operation);
|
|
@@ -1190,18 +1326,18 @@ async function versionBump(arg = {}) {
|
|
|
1190
1326
|
}
|
|
1191
1327
|
function printSummary(operation) {
|
|
1192
1328
|
console.log();
|
|
1193
|
-
console.log(` files ${operation.options.files.map((i) =>
|
|
1329
|
+
console.log(` files ${operation.options.files.map((i) => import_picocolors3.default.bold(i)).join("\n ")}`);
|
|
1194
1330
|
if (operation.options.commit)
|
|
1195
|
-
console.log(` commit ${
|
|
1331
|
+
console.log(` commit ${import_picocolors3.default.bold(formatVersionString(operation.options.commit.message, operation.state.newVersion))}`);
|
|
1196
1332
|
if (operation.options.tag)
|
|
1197
|
-
console.log(` tag ${
|
|
1333
|
+
console.log(` tag ${import_picocolors3.default.bold(formatVersionString(operation.options.tag.name, operation.state.newVersion))}`);
|
|
1198
1334
|
if (operation.options.execute)
|
|
1199
|
-
console.log(` execute ${
|
|
1335
|
+
console.log(` execute ${import_picocolors3.default.bold(operation.options.execute)}`);
|
|
1200
1336
|
if (operation.options.push)
|
|
1201
|
-
console.log(` push ${
|
|
1337
|
+
console.log(` push ${import_picocolors3.default.cyan(import_picocolors3.default.bold("yes"))}`);
|
|
1202
1338
|
console.log();
|
|
1203
|
-
console.log(` from ${
|
|
1204
|
-
console.log(` to ${
|
|
1339
|
+
console.log(` from ${import_picocolors3.default.bold(operation.state.currentVersion)}`);
|
|
1340
|
+
console.log(` to ${import_picocolors3.default.green(import_picocolors3.default.bold(operation.state.newVersion))}`);
|
|
1205
1341
|
console.log();
|
|
1206
1342
|
}
|
|
1207
1343
|
async function versionBumpInfo(arg = {}) {
|
|
@@ -1214,8 +1350,8 @@ async function versionBumpInfo(arg = {}) {
|
|
|
1214
1350
|
}
|
|
1215
1351
|
|
|
1216
1352
|
// src/config.ts
|
|
1217
|
-
import process7 from "process";
|
|
1218
1353
|
import { dirname } from "path";
|
|
1354
|
+
import process7 from "process";
|
|
1219
1355
|
import { loadConfig } from "c12";
|
|
1220
1356
|
import escalade from "escalade/sync";
|
|
1221
1357
|
var bumpConfigDefaults = {
|
|
@@ -1274,8 +1410,8 @@ export {
|
|
|
1274
1410
|
__spreadProps,
|
|
1275
1411
|
__objRest,
|
|
1276
1412
|
__toESM,
|
|
1277
|
-
require_picocolors,
|
|
1278
1413
|
log_symbols_default,
|
|
1414
|
+
require_picocolors,
|
|
1279
1415
|
isReleaseType,
|
|
1280
1416
|
ProgressEvent,
|
|
1281
1417
|
NpmScript,
|