bumpp 9.6.0 → 9.7.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/README.md +1 -0
- package/bin/bumpp.js +0 -0
- package/dist/{chunk-CNEN62NE.mjs → chunk-EGVMKV3X.mjs} +153 -112
- package/dist/cli/index.d.mts +2 -1
- package/dist/cli/index.d.ts +2 -1
- package/dist/cli/index.js +172 -116
- package/dist/cli/index.mjs +17 -3
- package/dist/index.d.mts +13 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +151 -112
- package/dist/index.mjs +1 -1
- package/package.json +22 -19
package/README.md
CHANGED
|
@@ -12,6 +12,7 @@ Forked from [`version-bump-prompt`](https://github.com/JS-DevTools/version-bump-
|
|
|
12
12
|
- Use the current version's `preid` when available.
|
|
13
13
|
- Confirmation before bumping.
|
|
14
14
|
- Enable `--commit` `--tag` `--push` by default. (opt-out by `--no-push`, etc.)
|
|
15
|
+
- `--sign` to sign the commit and tag.
|
|
15
16
|
- `-r` or `--recursive` to bump all packages in the monorepo.
|
|
16
17
|
- Conventional Commits by default.
|
|
17
18
|
- Supports config file `bump.config.ts`:
|
package/bin/bumpp.js
CHANGED
|
File without changes
|
|
@@ -675,7 +675,7 @@ var NpmScript = /* @__PURE__ */ ((NpmScript2) => {
|
|
|
675
675
|
// src/version-bump.ts
|
|
676
676
|
import process6 from "process";
|
|
677
677
|
import * as ezSpawn4 from "@jsdevtools/ez-spawn";
|
|
678
|
-
var
|
|
678
|
+
var import_picocolors3 = __toESM(require_picocolors());
|
|
679
679
|
import prompts2 from "prompts";
|
|
680
680
|
|
|
681
681
|
// src/get-current-version.ts
|
|
@@ -776,11 +776,126 @@ async function readVersion(file, cwd) {
|
|
|
776
776
|
}
|
|
777
777
|
|
|
778
778
|
// src/get-new-version.ts
|
|
779
|
-
var
|
|
779
|
+
var import_picocolors2 = __toESM(require_picocolors());
|
|
780
780
|
import process4 from "process";
|
|
781
|
-
import * as ezSpawn from "@jsdevtools/ez-spawn";
|
|
782
781
|
import prompts from "prompts";
|
|
783
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());
|
|
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
|
|
784
899
|
async function getNewVersion(operation) {
|
|
785
900
|
const { release } = operation.options;
|
|
786
901
|
const { currentVersion } = operation.state;
|
|
@@ -831,20 +946,20 @@ async function promptForNewVersion(operation) {
|
|
|
831
946
|
{
|
|
832
947
|
type: "autocomplete",
|
|
833
948
|
name: "release",
|
|
834
|
-
message: `Current version ${
|
|
949
|
+
message: `Current version ${import_picocolors2.default.green(currentVersion)}`,
|
|
835
950
|
initial: configCustomVersion ? "config" : "next",
|
|
836
951
|
choices: [
|
|
837
|
-
{ value: "major", title: `${"major".padStart(PADDING, " ")} ${
|
|
838
|
-
{ value: "minor", title: `${"minor".padStart(PADDING, " ")} ${
|
|
839
|
-
{ value: "patch", title: `${"patch".padStart(PADDING, " ")} ${
|
|
840
|
-
{ value: "next", title: `${"next".padStart(PADDING, " ")} ${
|
|
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)}` },
|
|
841
956
|
...configCustomVersion ? [
|
|
842
|
-
{ value: "config", title: `${"from config".padStart(PADDING, " ")} ${
|
|
957
|
+
{ value: "config", title: `${"from config".padStart(PADDING, " ")} ${import_picocolors2.default.bold(configCustomVersion)}` }
|
|
843
958
|
] : [],
|
|
844
|
-
{ value: "prepatch", title: `${"pre-patch".padStart(PADDING, " ")} ${
|
|
845
|
-
{ value: "preminor", title: `${"pre-minor".padStart(PADDING, " ")} ${
|
|
846
|
-
{ value: "premajor", title: `${"pre-major".padStart(PADDING, " ")} ${
|
|
847
|
-
{ value: "none", title: `${"as-is".padStart(PADDING, " ")} ${
|
|
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)}` },
|
|
848
963
|
{ value: "custom", title: "custom ...".padStart(PADDING + 4, " ") }
|
|
849
964
|
]
|
|
850
965
|
},
|
|
@@ -871,97 +986,6 @@ async function promptForNewVersion(operation) {
|
|
|
871
986
|
return operation.update({ release: answers.release, newVersion });
|
|
872
987
|
}
|
|
873
988
|
}
|
|
874
|
-
var messageColorMap = {
|
|
875
|
-
chore: import_picocolors.default.gray,
|
|
876
|
-
fix: import_picocolors.default.yellow,
|
|
877
|
-
feat: import_picocolors.default.green,
|
|
878
|
-
refactor: import_picocolors.default.cyan,
|
|
879
|
-
docs: import_picocolors.default.blue,
|
|
880
|
-
doc: import_picocolors.default.blue,
|
|
881
|
-
ci: import_picocolors.default.gray,
|
|
882
|
-
build: import_picocolors.default.gray
|
|
883
|
-
};
|
|
884
|
-
async function printRecentCommits(operation) {
|
|
885
|
-
let sha;
|
|
886
|
-
sha || (sha = await ezSpawn.async(
|
|
887
|
-
"git",
|
|
888
|
-
["rev-list", "-n", "1", `v${operation.state.currentVersion}`],
|
|
889
|
-
{ stdio: "pipe" }
|
|
890
|
-
).then((res) => res.stdout.trim()).catch(() => void 0));
|
|
891
|
-
sha || (sha = await ezSpawn.async(
|
|
892
|
-
"git",
|
|
893
|
-
["rev-list", "-n", "1", operation.state.currentVersion],
|
|
894
|
-
{ stdio: "pipe" }
|
|
895
|
-
).then((res) => res.stdout.trim()).catch(() => void 0));
|
|
896
|
-
if (!sha) {
|
|
897
|
-
console.log(
|
|
898
|
-
import_picocolors.default.blue(`i`) + import_picocolors.default.gray(` Failed to locate the previous tag ${import_picocolors.default.yellow(`v${operation.state.currentVersion}`)}`)
|
|
899
|
-
);
|
|
900
|
-
return;
|
|
901
|
-
}
|
|
902
|
-
const message = await ezSpawn.async(
|
|
903
|
-
"git",
|
|
904
|
-
[
|
|
905
|
-
"--no-pager",
|
|
906
|
-
"log",
|
|
907
|
-
`${sha}..HEAD`,
|
|
908
|
-
"--oneline"
|
|
909
|
-
],
|
|
910
|
-
{ stdio: "pipe" }
|
|
911
|
-
);
|
|
912
|
-
const lines = message.stdout.toString().trim().split(/\n/g);
|
|
913
|
-
if (!lines.length) {
|
|
914
|
-
console.log();
|
|
915
|
-
console.log(import_picocolors.default.blue(`i`) + import_picocolors.default.gray(` No commits since ${operation.state.currentVersion}`));
|
|
916
|
-
console.log();
|
|
917
|
-
return;
|
|
918
|
-
}
|
|
919
|
-
const parsed = lines.map((line) => {
|
|
920
|
-
const [hash, ...parts] = line.split(" ");
|
|
921
|
-
const message2 = parts.join(" ");
|
|
922
|
-
const match = message2.match(/^(\w+)(\([^)]+\))?(!)?:(.*)$/);
|
|
923
|
-
if (match) {
|
|
924
|
-
let color = messageColorMap[match[1].toLowerCase()] || ((c3) => c3);
|
|
925
|
-
if (match[3] === "!") {
|
|
926
|
-
color = import_picocolors.default.red;
|
|
927
|
-
}
|
|
928
|
-
const tag = [match[1], match[2], match[3]].filter(Boolean).join("");
|
|
929
|
-
return {
|
|
930
|
-
hash,
|
|
931
|
-
tag,
|
|
932
|
-
message: match[4].trim(),
|
|
933
|
-
color
|
|
934
|
-
};
|
|
935
|
-
}
|
|
936
|
-
return {
|
|
937
|
-
hash,
|
|
938
|
-
tag: "",
|
|
939
|
-
message: message2,
|
|
940
|
-
color: (c3) => c3
|
|
941
|
-
};
|
|
942
|
-
});
|
|
943
|
-
const tagLength = parsed.map(({ tag }) => tag.length).reduce((a, b) => Math.max(a, b), 0);
|
|
944
|
-
const prettified = parsed.map(({ hash, tag, message: message2, color }) => {
|
|
945
|
-
const paddedTag = tag.padStart(tagLength + 2, " ");
|
|
946
|
-
return [
|
|
947
|
-
import_picocolors.default.dim(hash),
|
|
948
|
-
" ",
|
|
949
|
-
color === import_picocolors.default.gray ? color(paddedTag) : import_picocolors.default.bold(color(paddedTag)),
|
|
950
|
-
import_picocolors.default.dim(":"),
|
|
951
|
-
" ",
|
|
952
|
-
color === import_picocolors.default.gray ? color(message2) : message2
|
|
953
|
-
].join("");
|
|
954
|
-
});
|
|
955
|
-
console.log();
|
|
956
|
-
console.log(
|
|
957
|
-
import_picocolors.default.bold(
|
|
958
|
-
`${import_picocolors.default.green(lines.length)} Commits since ${import_picocolors.default.gray(sha.slice(0, 7))}:`
|
|
959
|
-
)
|
|
960
|
-
);
|
|
961
|
-
console.log();
|
|
962
|
-
console.log(prettified.reverse().join("\n"));
|
|
963
|
-
console.log();
|
|
964
|
-
}
|
|
965
989
|
|
|
966
990
|
// src/git.ts
|
|
967
991
|
import * as ezSpawn2 from "@jsdevtools/ez-spawn";
|
|
@@ -977,6 +1001,9 @@ async function gitCommit(operation) {
|
|
|
977
1001
|
if (noVerify) {
|
|
978
1002
|
args.push("--no-verify");
|
|
979
1003
|
}
|
|
1004
|
+
if (operation.options.sign) {
|
|
1005
|
+
args.push("--gpg-sign");
|
|
1006
|
+
}
|
|
980
1007
|
const commitMessage = formatVersionString(message, newVersion);
|
|
981
1008
|
args.push("--message", commitMessage);
|
|
982
1009
|
if (!all)
|
|
@@ -999,6 +1026,9 @@ async function gitTag(operation) {
|
|
|
999
1026
|
];
|
|
1000
1027
|
const tagName = formatVersionString(tag.name, newVersion);
|
|
1001
1028
|
args.push(tagName);
|
|
1029
|
+
if (operation.options.sign) {
|
|
1030
|
+
args.push("--sign");
|
|
1031
|
+
}
|
|
1002
1032
|
await ezSpawn2.async("git", ["tag", ...args]);
|
|
1003
1033
|
return operation.update({ event: "git tag" /* GitTag */, tagName });
|
|
1004
1034
|
}
|
|
@@ -1027,6 +1057,7 @@ import yaml from "js-yaml";
|
|
|
1027
1057
|
async function normalizeOptions(raw) {
|
|
1028
1058
|
var _a, _b, _d;
|
|
1029
1059
|
const preid = typeof raw.preid === "string" ? raw.preid : "beta";
|
|
1060
|
+
const sign = Boolean(raw.sign);
|
|
1030
1061
|
const push = Boolean(raw.push);
|
|
1031
1062
|
const all = Boolean(raw.all);
|
|
1032
1063
|
const noVerify = Boolean(raw.noVerify);
|
|
@@ -1103,6 +1134,7 @@ async function normalizeOptions(raw) {
|
|
|
1103
1134
|
release,
|
|
1104
1135
|
commit,
|
|
1105
1136
|
tag,
|
|
1137
|
+
sign,
|
|
1106
1138
|
push,
|
|
1107
1139
|
files,
|
|
1108
1140
|
cwd,
|
|
@@ -1244,7 +1276,13 @@ async function updateManifestFile(relPath, operation) {
|
|
|
1244
1276
|
const { newVersion } = operation.state;
|
|
1245
1277
|
let modified = false;
|
|
1246
1278
|
const file = await readJsoncFile(relPath, cwd);
|
|
1247
|
-
if (isManifest(file.data)
|
|
1279
|
+
if (!isManifest(file.data)) {
|
|
1280
|
+
return modified;
|
|
1281
|
+
}
|
|
1282
|
+
if (file.data.version == null) {
|
|
1283
|
+
return modified;
|
|
1284
|
+
}
|
|
1285
|
+
if (file.data.version !== newVersion) {
|
|
1248
1286
|
file.modified.push([["version"], newVersion]);
|
|
1249
1287
|
if (isPackageLockManifest(file.data))
|
|
1250
1288
|
file.modified.push([["packages", "", "version"], newVersion]);
|
|
@@ -1302,18 +1340,18 @@ async function versionBump(arg = {}) {
|
|
|
1302
1340
|
}
|
|
1303
1341
|
function printSummary(operation) {
|
|
1304
1342
|
console.log();
|
|
1305
|
-
console.log(` files ${operation.options.files.map((i) =>
|
|
1343
|
+
console.log(` files ${operation.options.files.map((i) => import_picocolors3.default.bold(i)).join("\n ")}`);
|
|
1306
1344
|
if (operation.options.commit)
|
|
1307
|
-
console.log(` commit ${
|
|
1345
|
+
console.log(` commit ${import_picocolors3.default.bold(formatVersionString(operation.options.commit.message, operation.state.newVersion))}`);
|
|
1308
1346
|
if (operation.options.tag)
|
|
1309
|
-
console.log(` tag ${
|
|
1347
|
+
console.log(` tag ${import_picocolors3.default.bold(formatVersionString(operation.options.tag.name, operation.state.newVersion))}`);
|
|
1310
1348
|
if (operation.options.execute)
|
|
1311
|
-
console.log(` execute ${
|
|
1349
|
+
console.log(` execute ${import_picocolors3.default.bold(operation.options.execute)}`);
|
|
1312
1350
|
if (operation.options.push)
|
|
1313
|
-
console.log(` push ${
|
|
1351
|
+
console.log(` push ${import_picocolors3.default.cyan(import_picocolors3.default.bold("yes"))}`);
|
|
1314
1352
|
console.log();
|
|
1315
|
-
console.log(` from ${
|
|
1316
|
-
console.log(` to ${
|
|
1353
|
+
console.log(` from ${import_picocolors3.default.bold(operation.state.currentVersion)}`);
|
|
1354
|
+
console.log(` to ${import_picocolors3.default.green(import_picocolors3.default.bold(operation.state.newVersion))}`);
|
|
1317
1355
|
console.log();
|
|
1318
1356
|
}
|
|
1319
1357
|
async function versionBumpInfo(arg = {}) {
|
|
@@ -1334,11 +1372,13 @@ var bumpConfigDefaults = {
|
|
|
1334
1372
|
commit: true,
|
|
1335
1373
|
push: true,
|
|
1336
1374
|
tag: true,
|
|
1375
|
+
sign: false,
|
|
1337
1376
|
recursive: false,
|
|
1338
1377
|
noVerify: false,
|
|
1339
1378
|
confirm: true,
|
|
1340
1379
|
ignoreScripts: false,
|
|
1341
1380
|
all: false,
|
|
1381
|
+
noGitCheck: true,
|
|
1342
1382
|
files: []
|
|
1343
1383
|
};
|
|
1344
1384
|
async function loadBumpConfig(overrides, cwd = process7.cwd()) {
|
|
@@ -1350,6 +1390,7 @@ async function loadBumpConfig(overrides, cwd = process7.cwd()) {
|
|
|
1350
1390
|
overrides: __spreadValues({}, overrides),
|
|
1351
1391
|
cwd: configFile ? dirname(configFile) : cwd
|
|
1352
1392
|
});
|
|
1393
|
+
console.log(config);
|
|
1353
1394
|
return config;
|
|
1354
1395
|
}
|
|
1355
1396
|
function findConfigFile(name, cwd) {
|
package/dist/cli/index.d.mts
CHANGED