bumpp 9.6.0 → 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/bin/bumpp.js +0 -0
- package/dist/{chunk-CNEN62NE.mjs → chunk-TBB4VMXP.mjs} +135 -111
- package/dist/cli/index.js +136 -114
- package/dist/cli/index.mjs +2 -2
- package/dist/index.js +133 -111
- package/dist/index.mjs +1 -1
- package/package.json +16 -14
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";
|
|
@@ -1302,18 +1326,18 @@ async function versionBump(arg = {}) {
|
|
|
1302
1326
|
}
|
|
1303
1327
|
function printSummary(operation) {
|
|
1304
1328
|
console.log();
|
|
1305
|
-
console.log(` files ${operation.options.files.map((i) =>
|
|
1329
|
+
console.log(` files ${operation.options.files.map((i) => import_picocolors3.default.bold(i)).join("\n ")}`);
|
|
1306
1330
|
if (operation.options.commit)
|
|
1307
|
-
console.log(` commit ${
|
|
1331
|
+
console.log(` commit ${import_picocolors3.default.bold(formatVersionString(operation.options.commit.message, operation.state.newVersion))}`);
|
|
1308
1332
|
if (operation.options.tag)
|
|
1309
|
-
console.log(` tag ${
|
|
1333
|
+
console.log(` tag ${import_picocolors3.default.bold(formatVersionString(operation.options.tag.name, operation.state.newVersion))}`);
|
|
1310
1334
|
if (operation.options.execute)
|
|
1311
|
-
console.log(` execute ${
|
|
1335
|
+
console.log(` execute ${import_picocolors3.default.bold(operation.options.execute)}`);
|
|
1312
1336
|
if (operation.options.push)
|
|
1313
|
-
console.log(` push ${
|
|
1337
|
+
console.log(` push ${import_picocolors3.default.cyan(import_picocolors3.default.bold("yes"))}`);
|
|
1314
1338
|
console.log();
|
|
1315
|
-
console.log(` from ${
|
|
1316
|
-
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))}`);
|
|
1317
1341
|
console.log();
|
|
1318
1342
|
}
|
|
1319
1343
|
async function versionBumpInfo(arg = {}) {
|
package/dist/cli/index.js
CHANGED
|
@@ -652,12 +652,12 @@ var logSymbols = isUnicodeSupported() ? main : fallback;
|
|
|
652
652
|
var log_symbols_default = logSymbols;
|
|
653
653
|
|
|
654
654
|
// package.json
|
|
655
|
-
var version = "9.6.
|
|
655
|
+
var version = "9.6.1";
|
|
656
656
|
|
|
657
657
|
// src/version-bump.ts
|
|
658
658
|
var import_node_process5 = __toESM(require("process"));
|
|
659
659
|
var ezSpawn4 = __toESM(require("@jsdevtools/ez-spawn"));
|
|
660
|
-
var
|
|
660
|
+
var import_picocolors3 = __toESM(require_picocolors());
|
|
661
661
|
var import_prompts2 = __toESM(require("prompts"));
|
|
662
662
|
|
|
663
663
|
// src/get-current-version.ts
|
|
@@ -759,11 +759,124 @@ async function readVersion(file, cwd) {
|
|
|
759
759
|
|
|
760
760
|
// src/get-new-version.ts
|
|
761
761
|
var import_node_process3 = __toESM(require("process"));
|
|
762
|
-
var
|
|
763
|
-
var import_picocolors = __toESM(require_picocolors());
|
|
762
|
+
var import_picocolors2 = __toESM(require_picocolors());
|
|
764
763
|
var import_prompts = __toESM(require("prompts"));
|
|
765
764
|
var import_semver2 = __toESM(require("semver"));
|
|
766
765
|
|
|
766
|
+
// src/print-commits.ts
|
|
767
|
+
var ezSpawn = __toESM(require("@jsdevtools/ez-spawn"));
|
|
768
|
+
var import_picocolors = __toESM(require_picocolors());
|
|
769
|
+
var messageColorMap = {
|
|
770
|
+
chore: import_picocolors.default.gray,
|
|
771
|
+
fix: import_picocolors.default.yellow,
|
|
772
|
+
feat: import_picocolors.default.green,
|
|
773
|
+
refactor: import_picocolors.default.cyan,
|
|
774
|
+
docs: import_picocolors.default.blue,
|
|
775
|
+
doc: import_picocolors.default.blue,
|
|
776
|
+
ci: import_picocolors.default.gray,
|
|
777
|
+
build: import_picocolors.default.gray
|
|
778
|
+
};
|
|
779
|
+
function parseCommits(raw) {
|
|
780
|
+
const lines = raw.toString().trim().split(/\n/g);
|
|
781
|
+
if (!lines.length) {
|
|
782
|
+
return [];
|
|
783
|
+
}
|
|
784
|
+
return lines.map((line) => {
|
|
785
|
+
const [hash, ...parts] = line.split(" ");
|
|
786
|
+
const message = parts.join(" ");
|
|
787
|
+
const match = message.match(/^(\w+)(!)?(\([^)]+\))?:(.*)$/);
|
|
788
|
+
if (match) {
|
|
789
|
+
let color = messageColorMap[match[1].toLowerCase()] || ((c5) => c5);
|
|
790
|
+
if (match[2] === "!") {
|
|
791
|
+
color = (s) => import_picocolors.default.inverse(import_picocolors.default.red(s));
|
|
792
|
+
}
|
|
793
|
+
const tag = [match[1], match[2]].filter(Boolean).join("");
|
|
794
|
+
const scope = match[3] || "";
|
|
795
|
+
return {
|
|
796
|
+
hash,
|
|
797
|
+
tag,
|
|
798
|
+
message: match[4].trim(),
|
|
799
|
+
scope,
|
|
800
|
+
breaking: match[2] === "!",
|
|
801
|
+
color
|
|
802
|
+
};
|
|
803
|
+
}
|
|
804
|
+
return {
|
|
805
|
+
hash,
|
|
806
|
+
tag: "",
|
|
807
|
+
message,
|
|
808
|
+
scope: "",
|
|
809
|
+
color: (c5) => c5
|
|
810
|
+
};
|
|
811
|
+
}).reverse();
|
|
812
|
+
}
|
|
813
|
+
function formatParsedCommits(commits) {
|
|
814
|
+
const tagLength = commits.map(({ tag }) => tag.length).reduce((a, b) => Math.max(a, b), 0);
|
|
815
|
+
let scopeLength = commits.map(({ scope }) => scope.length).reduce((a, b) => Math.max(a, b), 0);
|
|
816
|
+
if (scopeLength)
|
|
817
|
+
scopeLength += 2;
|
|
818
|
+
return commits.map(({ hash, tag, message, scope, color }) => {
|
|
819
|
+
const paddedTag = tag.padStart(tagLength + 1, " ");
|
|
820
|
+
const paddedScope = !scope ? " ".repeat(scopeLength) : import_picocolors.default.dim("(") + scope.slice(1, -1) + import_picocolors.default.dim(")") + " ".repeat(scopeLength - scope.length);
|
|
821
|
+
return [
|
|
822
|
+
import_picocolors.default.dim(hash),
|
|
823
|
+
" ",
|
|
824
|
+
color === import_picocolors.default.gray ? color(paddedTag) : import_picocolors.default.bold(color(paddedTag)),
|
|
825
|
+
" ",
|
|
826
|
+
paddedScope,
|
|
827
|
+
import_picocolors.default.dim(":"),
|
|
828
|
+
" ",
|
|
829
|
+
color === import_picocolors.default.gray ? color(message) : message
|
|
830
|
+
].join("");
|
|
831
|
+
});
|
|
832
|
+
}
|
|
833
|
+
async function printRecentCommits(operation) {
|
|
834
|
+
let sha;
|
|
835
|
+
sha || (sha = await ezSpawn.async(
|
|
836
|
+
"git",
|
|
837
|
+
["rev-list", "-n", "1", `v${operation.state.currentVersion}`],
|
|
838
|
+
{ stdio: "pipe" }
|
|
839
|
+
).then((res) => res.stdout.trim()).catch(() => void 0));
|
|
840
|
+
sha || (sha = await ezSpawn.async(
|
|
841
|
+
"git",
|
|
842
|
+
["rev-list", "-n", "1", operation.state.currentVersion],
|
|
843
|
+
{ stdio: "pipe" }
|
|
844
|
+
).then((res) => res.stdout.trim()).catch(() => void 0));
|
|
845
|
+
if (!sha) {
|
|
846
|
+
console.log(
|
|
847
|
+
import_picocolors.default.blue(`i`) + import_picocolors.default.gray(` Failed to locate the previous tag ${import_picocolors.default.yellow(`v${operation.state.currentVersion}`)}`)
|
|
848
|
+
);
|
|
849
|
+
return;
|
|
850
|
+
}
|
|
851
|
+
const { stdout } = await ezSpawn.async(
|
|
852
|
+
"git",
|
|
853
|
+
[
|
|
854
|
+
"--no-pager",
|
|
855
|
+
"log",
|
|
856
|
+
`${sha}..HEAD`,
|
|
857
|
+
"--oneline"
|
|
858
|
+
],
|
|
859
|
+
{ stdio: "pipe" }
|
|
860
|
+
);
|
|
861
|
+
const parsed = parseCommits(stdout.toString().trim());
|
|
862
|
+
const prettified = formatParsedCommits(parsed);
|
|
863
|
+
if (!parsed.length) {
|
|
864
|
+
console.log();
|
|
865
|
+
console.log(import_picocolors.default.blue(`i`) + import_picocolors.default.gray(` No commits since ${operation.state.currentVersion}`));
|
|
866
|
+
console.log();
|
|
867
|
+
return;
|
|
868
|
+
}
|
|
869
|
+
console.log();
|
|
870
|
+
console.log(
|
|
871
|
+
import_picocolors.default.bold(
|
|
872
|
+
`${import_picocolors.default.green(parsed.length)} Commits since ${import_picocolors.default.gray(sha.slice(0, 7))}:`
|
|
873
|
+
)
|
|
874
|
+
);
|
|
875
|
+
console.log();
|
|
876
|
+
console.log(prettified.join("\n"));
|
|
877
|
+
console.log();
|
|
878
|
+
}
|
|
879
|
+
|
|
767
880
|
// src/release-type.ts
|
|
768
881
|
var prereleaseTypes = ["premajor", "preminor", "prepatch", "prerelease"];
|
|
769
882
|
var releaseTypes = prereleaseTypes.concat(["major", "minor", "patch", "next"]);
|
|
@@ -825,20 +938,20 @@ async function promptForNewVersion(operation) {
|
|
|
825
938
|
{
|
|
826
939
|
type: "autocomplete",
|
|
827
940
|
name: "release",
|
|
828
|
-
message: `Current version ${
|
|
941
|
+
message: `Current version ${import_picocolors2.default.green(currentVersion)}`,
|
|
829
942
|
initial: configCustomVersion ? "config" : "next",
|
|
830
943
|
choices: [
|
|
831
|
-
{ value: "major", title: `${"major".padStart(PADDING, " ")} ${
|
|
832
|
-
{ value: "minor", title: `${"minor".padStart(PADDING, " ")} ${
|
|
833
|
-
{ value: "patch", title: `${"patch".padStart(PADDING, " ")} ${
|
|
834
|
-
{ value: "next", title: `${"next".padStart(PADDING, " ")} ${
|
|
944
|
+
{ value: "major", title: `${"major".padStart(PADDING, " ")} ${import_picocolors2.default.bold(next.major)}` },
|
|
945
|
+
{ value: "minor", title: `${"minor".padStart(PADDING, " ")} ${import_picocolors2.default.bold(next.minor)}` },
|
|
946
|
+
{ value: "patch", title: `${"patch".padStart(PADDING, " ")} ${import_picocolors2.default.bold(next.patch)}` },
|
|
947
|
+
{ value: "next", title: `${"next".padStart(PADDING, " ")} ${import_picocolors2.default.bold(next.next)}` },
|
|
835
948
|
...configCustomVersion ? [
|
|
836
|
-
{ value: "config", title: `${"from config".padStart(PADDING, " ")} ${
|
|
949
|
+
{ value: "config", title: `${"from config".padStart(PADDING, " ")} ${import_picocolors2.default.bold(configCustomVersion)}` }
|
|
837
950
|
] : [],
|
|
838
|
-
{ value: "prepatch", title: `${"pre-patch".padStart(PADDING, " ")} ${
|
|
839
|
-
{ value: "preminor", title: `${"pre-minor".padStart(PADDING, " ")} ${
|
|
840
|
-
{ value: "premajor", title: `${"pre-major".padStart(PADDING, " ")} ${
|
|
841
|
-
{ value: "none", title: `${"as-is".padStart(PADDING, " ")} ${
|
|
951
|
+
{ value: "prepatch", title: `${"pre-patch".padStart(PADDING, " ")} ${import_picocolors2.default.bold(next.prepatch)}` },
|
|
952
|
+
{ value: "preminor", title: `${"pre-minor".padStart(PADDING, " ")} ${import_picocolors2.default.bold(next.preminor)}` },
|
|
953
|
+
{ value: "premajor", title: `${"pre-major".padStart(PADDING, " ")} ${import_picocolors2.default.bold(next.premajor)}` },
|
|
954
|
+
{ value: "none", title: `${"as-is".padStart(PADDING, " ")} ${import_picocolors2.default.bold(currentVersion)}` },
|
|
842
955
|
{ value: "custom", title: "custom ...".padStart(PADDING + 4, " ") }
|
|
843
956
|
]
|
|
844
957
|
},
|
|
@@ -865,97 +978,6 @@ async function promptForNewVersion(operation) {
|
|
|
865
978
|
return operation.update({ release: answers.release, newVersion });
|
|
866
979
|
}
|
|
867
980
|
}
|
|
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;
|
|
895
|
-
}
|
|
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;
|
|
921
|
-
}
|
|
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
|
-
};
|
|
936
|
-
});
|
|
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("");
|
|
948
|
-
});
|
|
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
|
-
)
|
|
954
|
-
);
|
|
955
|
-
console.log();
|
|
956
|
-
console.log(prettified.reverse().join("\n"));
|
|
957
|
-
console.log();
|
|
958
|
-
}
|
|
959
981
|
|
|
960
982
|
// src/git.ts
|
|
961
983
|
var ezSpawn2 = __toESM(require("@jsdevtools/ez-spawn"));
|
|
@@ -1296,25 +1318,25 @@ async function versionBump(arg = {}) {
|
|
|
1296
1318
|
}
|
|
1297
1319
|
function printSummary(operation) {
|
|
1298
1320
|
console.log();
|
|
1299
|
-
console.log(` files ${operation.options.files.map((i) =>
|
|
1321
|
+
console.log(` files ${operation.options.files.map((i) => import_picocolors3.default.bold(i)).join("\n ")}`);
|
|
1300
1322
|
if (operation.options.commit)
|
|
1301
|
-
console.log(` commit ${
|
|
1323
|
+
console.log(` commit ${import_picocolors3.default.bold(formatVersionString(operation.options.commit.message, operation.state.newVersion))}`);
|
|
1302
1324
|
if (operation.options.tag)
|
|
1303
|
-
console.log(` tag ${
|
|
1325
|
+
console.log(` tag ${import_picocolors3.default.bold(formatVersionString(operation.options.tag.name, operation.state.newVersion))}`);
|
|
1304
1326
|
if (operation.options.execute)
|
|
1305
|
-
console.log(` execute ${
|
|
1327
|
+
console.log(` execute ${import_picocolors3.default.bold(operation.options.execute)}`);
|
|
1306
1328
|
if (operation.options.push)
|
|
1307
|
-
console.log(` push ${
|
|
1329
|
+
console.log(` push ${import_picocolors3.default.cyan(import_picocolors3.default.bold("yes"))}`);
|
|
1308
1330
|
console.log();
|
|
1309
|
-
console.log(` from ${
|
|
1310
|
-
console.log(` to ${
|
|
1331
|
+
console.log(` from ${import_picocolors3.default.bold(operation.state.currentVersion)}`);
|
|
1332
|
+
console.log(` to ${import_picocolors3.default.green(import_picocolors3.default.bold(operation.state.newVersion))}`);
|
|
1311
1333
|
console.log();
|
|
1312
1334
|
}
|
|
1313
1335
|
|
|
1314
1336
|
// src/cli/parse-args.ts
|
|
1315
1337
|
var import_node_process7 = __toESM(require("process"));
|
|
1316
1338
|
var import_cac = __toESM(require("cac"));
|
|
1317
|
-
var
|
|
1339
|
+
var import_picocolors4 = __toESM(require_picocolors());
|
|
1318
1340
|
var import_semver3 = require("semver");
|
|
1319
1341
|
|
|
1320
1342
|
// src/config.ts
|
|
@@ -1402,7 +1424,7 @@ async function parseArgs() {
|
|
|
1402
1424
|
}
|
|
1403
1425
|
}
|
|
1404
1426
|
if (parsedArgs.options.recursive && ((_a = parsedArgs.options.files) == null ? void 0 : _a.length))
|
|
1405
|
-
console.log(
|
|
1427
|
+
console.log(import_picocolors4.default.yellow("The --recursive option is ignored when files are specified"));
|
|
1406
1428
|
return parsedArgs;
|
|
1407
1429
|
} catch (error) {
|
|
1408
1430
|
return errorHandler(error);
|
package/dist/cli/index.mjs
CHANGED
|
@@ -10,13 +10,13 @@ import {
|
|
|
10
10
|
log_symbols_default,
|
|
11
11
|
require_picocolors,
|
|
12
12
|
versionBump
|
|
13
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-TBB4VMXP.mjs";
|
|
14
14
|
|
|
15
15
|
// src/cli/index.ts
|
|
16
16
|
import process2 from "process";
|
|
17
17
|
|
|
18
18
|
// package.json
|
|
19
|
-
var version = "9.6.
|
|
19
|
+
var version = "9.6.1";
|
|
20
20
|
|
|
21
21
|
// src/cli/parse-args.ts
|
|
22
22
|
var import_picocolors = __toESM(require_picocolors());
|
package/dist/index.js
CHANGED
|
@@ -662,7 +662,7 @@ var logSymbols = isUnicodeSupported() ? main : fallback;
|
|
|
662
662
|
var log_symbols_default = logSymbols;
|
|
663
663
|
|
|
664
664
|
// src/version-bump.ts
|
|
665
|
-
var
|
|
665
|
+
var import_picocolors3 = __toESM(require_picocolors());
|
|
666
666
|
var import_prompts2 = __toESM(require("prompts"));
|
|
667
667
|
|
|
668
668
|
// src/get-current-version.ts
|
|
@@ -764,11 +764,124 @@ async function readVersion(file, cwd) {
|
|
|
764
764
|
|
|
765
765
|
// src/get-new-version.ts
|
|
766
766
|
var import_node_process3 = __toESM(require("process"));
|
|
767
|
-
var
|
|
768
|
-
var import_picocolors = __toESM(require_picocolors());
|
|
767
|
+
var import_picocolors2 = __toESM(require_picocolors());
|
|
769
768
|
var import_prompts = __toESM(require("prompts"));
|
|
770
769
|
var import_semver2 = __toESM(require("semver"));
|
|
771
770
|
|
|
771
|
+
// src/print-commits.ts
|
|
772
|
+
var ezSpawn = __toESM(require("@jsdevtools/ez-spawn"));
|
|
773
|
+
var import_picocolors = __toESM(require_picocolors());
|
|
774
|
+
var messageColorMap = {
|
|
775
|
+
chore: import_picocolors.default.gray,
|
|
776
|
+
fix: import_picocolors.default.yellow,
|
|
777
|
+
feat: import_picocolors.default.green,
|
|
778
|
+
refactor: import_picocolors.default.cyan,
|
|
779
|
+
docs: import_picocolors.default.blue,
|
|
780
|
+
doc: import_picocolors.default.blue,
|
|
781
|
+
ci: import_picocolors.default.gray,
|
|
782
|
+
build: import_picocolors.default.gray
|
|
783
|
+
};
|
|
784
|
+
function parseCommits(raw) {
|
|
785
|
+
const lines = raw.toString().trim().split(/\n/g);
|
|
786
|
+
if (!lines.length) {
|
|
787
|
+
return [];
|
|
788
|
+
}
|
|
789
|
+
return lines.map((line) => {
|
|
790
|
+
const [hash, ...parts] = line.split(" ");
|
|
791
|
+
const message = parts.join(" ");
|
|
792
|
+
const match = message.match(/^(\w+)(!)?(\([^)]+\))?:(.*)$/);
|
|
793
|
+
if (match) {
|
|
794
|
+
let color = messageColorMap[match[1].toLowerCase()] || ((c4) => c4);
|
|
795
|
+
if (match[2] === "!") {
|
|
796
|
+
color = (s) => import_picocolors.default.inverse(import_picocolors.default.red(s));
|
|
797
|
+
}
|
|
798
|
+
const tag = [match[1], match[2]].filter(Boolean).join("");
|
|
799
|
+
const scope = match[3] || "";
|
|
800
|
+
return {
|
|
801
|
+
hash,
|
|
802
|
+
tag,
|
|
803
|
+
message: match[4].trim(),
|
|
804
|
+
scope,
|
|
805
|
+
breaking: match[2] === "!",
|
|
806
|
+
color
|
|
807
|
+
};
|
|
808
|
+
}
|
|
809
|
+
return {
|
|
810
|
+
hash,
|
|
811
|
+
tag: "",
|
|
812
|
+
message,
|
|
813
|
+
scope: "",
|
|
814
|
+
color: (c4) => c4
|
|
815
|
+
};
|
|
816
|
+
}).reverse();
|
|
817
|
+
}
|
|
818
|
+
function formatParsedCommits(commits) {
|
|
819
|
+
const tagLength = commits.map(({ tag }) => tag.length).reduce((a, b) => Math.max(a, b), 0);
|
|
820
|
+
let scopeLength = commits.map(({ scope }) => scope.length).reduce((a, b) => Math.max(a, b), 0);
|
|
821
|
+
if (scopeLength)
|
|
822
|
+
scopeLength += 2;
|
|
823
|
+
return commits.map(({ hash, tag, message, scope, color }) => {
|
|
824
|
+
const paddedTag = tag.padStart(tagLength + 1, " ");
|
|
825
|
+
const paddedScope = !scope ? " ".repeat(scopeLength) : import_picocolors.default.dim("(") + scope.slice(1, -1) + import_picocolors.default.dim(")") + " ".repeat(scopeLength - scope.length);
|
|
826
|
+
return [
|
|
827
|
+
import_picocolors.default.dim(hash),
|
|
828
|
+
" ",
|
|
829
|
+
color === import_picocolors.default.gray ? color(paddedTag) : import_picocolors.default.bold(color(paddedTag)),
|
|
830
|
+
" ",
|
|
831
|
+
paddedScope,
|
|
832
|
+
import_picocolors.default.dim(":"),
|
|
833
|
+
" ",
|
|
834
|
+
color === import_picocolors.default.gray ? color(message) : message
|
|
835
|
+
].join("");
|
|
836
|
+
});
|
|
837
|
+
}
|
|
838
|
+
async function printRecentCommits(operation) {
|
|
839
|
+
let sha;
|
|
840
|
+
sha || (sha = await ezSpawn.async(
|
|
841
|
+
"git",
|
|
842
|
+
["rev-list", "-n", "1", `v${operation.state.currentVersion}`],
|
|
843
|
+
{ stdio: "pipe" }
|
|
844
|
+
).then((res) => res.stdout.trim()).catch(() => void 0));
|
|
845
|
+
sha || (sha = await ezSpawn.async(
|
|
846
|
+
"git",
|
|
847
|
+
["rev-list", "-n", "1", operation.state.currentVersion],
|
|
848
|
+
{ stdio: "pipe" }
|
|
849
|
+
).then((res) => res.stdout.trim()).catch(() => void 0));
|
|
850
|
+
if (!sha) {
|
|
851
|
+
console.log(
|
|
852
|
+
import_picocolors.default.blue(`i`) + import_picocolors.default.gray(` Failed to locate the previous tag ${import_picocolors.default.yellow(`v${operation.state.currentVersion}`)}`)
|
|
853
|
+
);
|
|
854
|
+
return;
|
|
855
|
+
}
|
|
856
|
+
const { stdout } = await ezSpawn.async(
|
|
857
|
+
"git",
|
|
858
|
+
[
|
|
859
|
+
"--no-pager",
|
|
860
|
+
"log",
|
|
861
|
+
`${sha}..HEAD`,
|
|
862
|
+
"--oneline"
|
|
863
|
+
],
|
|
864
|
+
{ stdio: "pipe" }
|
|
865
|
+
);
|
|
866
|
+
const parsed = parseCommits(stdout.toString().trim());
|
|
867
|
+
const prettified = formatParsedCommits(parsed);
|
|
868
|
+
if (!parsed.length) {
|
|
869
|
+
console.log();
|
|
870
|
+
console.log(import_picocolors.default.blue(`i`) + import_picocolors.default.gray(` No commits since ${operation.state.currentVersion}`));
|
|
871
|
+
console.log();
|
|
872
|
+
return;
|
|
873
|
+
}
|
|
874
|
+
console.log();
|
|
875
|
+
console.log(
|
|
876
|
+
import_picocolors.default.bold(
|
|
877
|
+
`${import_picocolors.default.green(parsed.length)} Commits since ${import_picocolors.default.gray(sha.slice(0, 7))}:`
|
|
878
|
+
)
|
|
879
|
+
);
|
|
880
|
+
console.log();
|
|
881
|
+
console.log(prettified.join("\n"));
|
|
882
|
+
console.log();
|
|
883
|
+
}
|
|
884
|
+
|
|
772
885
|
// src/release-type.ts
|
|
773
886
|
var prereleaseTypes = ["premajor", "preminor", "prepatch", "prerelease"];
|
|
774
887
|
var releaseTypes = prereleaseTypes.concat(["major", "minor", "patch", "next"]);
|
|
@@ -830,20 +943,20 @@ async function promptForNewVersion(operation) {
|
|
|
830
943
|
{
|
|
831
944
|
type: "autocomplete",
|
|
832
945
|
name: "release",
|
|
833
|
-
message: `Current version ${
|
|
946
|
+
message: `Current version ${import_picocolors2.default.green(currentVersion)}`,
|
|
834
947
|
initial: configCustomVersion ? "config" : "next",
|
|
835
948
|
choices: [
|
|
836
|
-
{ value: "major", title: `${"major".padStart(PADDING, " ")} ${
|
|
837
|
-
{ value: "minor", title: `${"minor".padStart(PADDING, " ")} ${
|
|
838
|
-
{ value: "patch", title: `${"patch".padStart(PADDING, " ")} ${
|
|
839
|
-
{ value: "next", title: `${"next".padStart(PADDING, " ")} ${
|
|
949
|
+
{ value: "major", title: `${"major".padStart(PADDING, " ")} ${import_picocolors2.default.bold(next.major)}` },
|
|
950
|
+
{ value: "minor", title: `${"minor".padStart(PADDING, " ")} ${import_picocolors2.default.bold(next.minor)}` },
|
|
951
|
+
{ value: "patch", title: `${"patch".padStart(PADDING, " ")} ${import_picocolors2.default.bold(next.patch)}` },
|
|
952
|
+
{ value: "next", title: `${"next".padStart(PADDING, " ")} ${import_picocolors2.default.bold(next.next)}` },
|
|
840
953
|
...configCustomVersion ? [
|
|
841
|
-
{ value: "config", title: `${"from config".padStart(PADDING, " ")} ${
|
|
954
|
+
{ value: "config", title: `${"from config".padStart(PADDING, " ")} ${import_picocolors2.default.bold(configCustomVersion)}` }
|
|
842
955
|
] : [],
|
|
843
|
-
{ value: "prepatch", title: `${"pre-patch".padStart(PADDING, " ")} ${
|
|
844
|
-
{ value: "preminor", title: `${"pre-minor".padStart(PADDING, " ")} ${
|
|
845
|
-
{ value: "premajor", title: `${"pre-major".padStart(PADDING, " ")} ${
|
|
846
|
-
{ value: "none", title: `${"as-is".padStart(PADDING, " ")} ${
|
|
956
|
+
{ value: "prepatch", title: `${"pre-patch".padStart(PADDING, " ")} ${import_picocolors2.default.bold(next.prepatch)}` },
|
|
957
|
+
{ value: "preminor", title: `${"pre-minor".padStart(PADDING, " ")} ${import_picocolors2.default.bold(next.preminor)}` },
|
|
958
|
+
{ value: "premajor", title: `${"pre-major".padStart(PADDING, " ")} ${import_picocolors2.default.bold(next.premajor)}` },
|
|
959
|
+
{ value: "none", title: `${"as-is".padStart(PADDING, " ")} ${import_picocolors2.default.bold(currentVersion)}` },
|
|
847
960
|
{ value: "custom", title: "custom ...".padStart(PADDING + 4, " ") }
|
|
848
961
|
]
|
|
849
962
|
},
|
|
@@ -870,97 +983,6 @@ async function promptForNewVersion(operation) {
|
|
|
870
983
|
return operation.update({ release: answers.release, newVersion });
|
|
871
984
|
}
|
|
872
985
|
}
|
|
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;
|
|
900
|
-
}
|
|
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;
|
|
926
|
-
}
|
|
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
|
-
};
|
|
941
|
-
});
|
|
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("");
|
|
953
|
-
});
|
|
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
|
-
)
|
|
959
|
-
);
|
|
960
|
-
console.log();
|
|
961
|
-
console.log(prettified.reverse().join("\n"));
|
|
962
|
-
console.log();
|
|
963
|
-
}
|
|
964
986
|
|
|
965
987
|
// src/git.ts
|
|
966
988
|
var ezSpawn2 = __toESM(require("@jsdevtools/ez-spawn"));
|
|
@@ -1320,18 +1342,18 @@ async function versionBump(arg = {}) {
|
|
|
1320
1342
|
}
|
|
1321
1343
|
function printSummary(operation) {
|
|
1322
1344
|
console.log();
|
|
1323
|
-
console.log(` files ${operation.options.files.map((i) =>
|
|
1345
|
+
console.log(` files ${operation.options.files.map((i) => import_picocolors3.default.bold(i)).join("\n ")}`);
|
|
1324
1346
|
if (operation.options.commit)
|
|
1325
|
-
console.log(` commit ${
|
|
1347
|
+
console.log(` commit ${import_picocolors3.default.bold(formatVersionString(operation.options.commit.message, operation.state.newVersion))}`);
|
|
1326
1348
|
if (operation.options.tag)
|
|
1327
|
-
console.log(` tag ${
|
|
1349
|
+
console.log(` tag ${import_picocolors3.default.bold(formatVersionString(operation.options.tag.name, operation.state.newVersion))}`);
|
|
1328
1350
|
if (operation.options.execute)
|
|
1329
|
-
console.log(` execute ${
|
|
1351
|
+
console.log(` execute ${import_picocolors3.default.bold(operation.options.execute)}`);
|
|
1330
1352
|
if (operation.options.push)
|
|
1331
|
-
console.log(` push ${
|
|
1353
|
+
console.log(` push ${import_picocolors3.default.cyan(import_picocolors3.default.bold("yes"))}`);
|
|
1332
1354
|
console.log();
|
|
1333
|
-
console.log(` from ${
|
|
1334
|
-
console.log(` to ${
|
|
1355
|
+
console.log(` from ${import_picocolors3.default.bold(operation.state.currentVersion)}`);
|
|
1356
|
+
console.log(` to ${import_picocolors3.default.green(import_picocolors3.default.bold(operation.state.newVersion))}`);
|
|
1335
1357
|
console.log();
|
|
1336
1358
|
}
|
|
1337
1359
|
async function versionBumpInfo(arg = {}) {
|
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bumpp",
|
|
3
|
-
"version": "9.6.
|
|
3
|
+
"version": "9.6.1",
|
|
4
|
+
"packageManager": "pnpm@9.11.0",
|
|
4
5
|
"description": "Bump version, commit changes, tag, and push to Git",
|
|
5
6
|
"author": {
|
|
6
7
|
"name": "James Messinger",
|
|
@@ -44,6 +45,19 @@
|
|
|
44
45
|
"engines": {
|
|
45
46
|
"node": ">=10"
|
|
46
47
|
},
|
|
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
|
+
},
|
|
47
61
|
"dependencies": {
|
|
48
62
|
"@jsdevtools/ez-spawn": "^3.0.4",
|
|
49
63
|
"c12": "^1.11.2",
|
|
@@ -70,17 +84,5 @@
|
|
|
70
84
|
"tsup": "^8.3.0",
|
|
71
85
|
"typescript": "^5.6.2",
|
|
72
86
|
"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"
|
|
85
87
|
}
|
|
86
|
-
}
|
|
88
|
+
}
|