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/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 import_picocolors2 = __toESM(require_picocolors());
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 ezSpawn = __toESM(require("@jsdevtools/ez-spawn"));
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 ${import_picocolors.default.green(currentVersion)}`,
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, " ")} ${import_picocolors.default.bold(next.major)}` },
837
- { value: "minor", title: `${"minor".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.minor)}` },
838
- { value: "patch", title: `${"patch".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.patch)}` },
839
- { value: "next", title: `${"next".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.next)}` },
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, " ")} ${import_picocolors.default.bold(configCustomVersion)}` }
954
+ { value: "config", title: `${"from config".padStart(PADDING, " ")} ${import_picocolors2.default.bold(configCustomVersion)}` }
842
955
  ] : [],
843
- { value: "prepatch", title: `${"pre-patch".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.prepatch)}` },
844
- { value: "preminor", title: `${"pre-minor".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.preminor)}` },
845
- { value: "premajor", title: `${"pre-major".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.premajor)}` },
846
- { value: "none", title: `${"as-is".padStart(PADDING, " ")} ${import_picocolors.default.bold(currentVersion)}` },
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"));
@@ -995,6 +1017,9 @@ async function gitCommit(operation) {
995
1017
  if (noVerify) {
996
1018
  args.push("--no-verify");
997
1019
  }
1020
+ if (operation.options.sign) {
1021
+ args.push("--gpg-sign");
1022
+ }
998
1023
  const commitMessage = formatVersionString(message, newVersion);
999
1024
  args.push("--message", commitMessage);
1000
1025
  if (!all)
@@ -1017,6 +1042,9 @@ async function gitTag(operation) {
1017
1042
  ];
1018
1043
  const tagName = formatVersionString(tag.name, newVersion);
1019
1044
  args.push(tagName);
1045
+ if (operation.options.sign) {
1046
+ args.push("--sign");
1047
+ }
1020
1048
  await ezSpawn2.async("git", ["tag", ...args]);
1021
1049
  return operation.update({ event: "git tag" /* GitTag */, tagName });
1022
1050
  }
@@ -1045,6 +1073,7 @@ var import_js_yaml = __toESM(require("js-yaml"));
1045
1073
  async function normalizeOptions(raw) {
1046
1074
  var _a, _b, _d;
1047
1075
  const preid = typeof raw.preid === "string" ? raw.preid : "beta";
1076
+ const sign = Boolean(raw.sign);
1048
1077
  const push = Boolean(raw.push);
1049
1078
  const all = Boolean(raw.all);
1050
1079
  const noVerify = Boolean(raw.noVerify);
@@ -1121,6 +1150,7 @@ async function normalizeOptions(raw) {
1121
1150
  release,
1122
1151
  commit,
1123
1152
  tag,
1153
+ sign,
1124
1154
  push,
1125
1155
  files,
1126
1156
  cwd,
@@ -1262,7 +1292,13 @@ async function updateManifestFile(relPath, operation) {
1262
1292
  const { newVersion } = operation.state;
1263
1293
  let modified = false;
1264
1294
  const file = await readJsoncFile(relPath, cwd);
1265
- if (isManifest(file.data) && file.data.version !== newVersion) {
1295
+ if (!isManifest(file.data)) {
1296
+ return modified;
1297
+ }
1298
+ if (file.data.version == null) {
1299
+ return modified;
1300
+ }
1301
+ if (file.data.version !== newVersion) {
1266
1302
  file.modified.push([["version"], newVersion]);
1267
1303
  if (isPackageLockManifest(file.data))
1268
1304
  file.modified.push([["packages", "", "version"], newVersion]);
@@ -1320,18 +1356,18 @@ async function versionBump(arg = {}) {
1320
1356
  }
1321
1357
  function printSummary(operation) {
1322
1358
  console.log();
1323
- console.log(` files ${operation.options.files.map((i) => import_picocolors2.default.bold(i)).join("\n ")}`);
1359
+ console.log(` files ${operation.options.files.map((i) => import_picocolors3.default.bold(i)).join("\n ")}`);
1324
1360
  if (operation.options.commit)
1325
- console.log(` commit ${import_picocolors2.default.bold(formatVersionString(operation.options.commit.message, operation.state.newVersion))}`);
1361
+ console.log(` commit ${import_picocolors3.default.bold(formatVersionString(operation.options.commit.message, operation.state.newVersion))}`);
1326
1362
  if (operation.options.tag)
1327
- console.log(` tag ${import_picocolors2.default.bold(formatVersionString(operation.options.tag.name, operation.state.newVersion))}`);
1363
+ console.log(` tag ${import_picocolors3.default.bold(formatVersionString(operation.options.tag.name, operation.state.newVersion))}`);
1328
1364
  if (operation.options.execute)
1329
- console.log(` execute ${import_picocolors2.default.bold(operation.options.execute)}`);
1365
+ console.log(` execute ${import_picocolors3.default.bold(operation.options.execute)}`);
1330
1366
  if (operation.options.push)
1331
- console.log(` push ${import_picocolors2.default.cyan(import_picocolors2.default.bold("yes"))}`);
1367
+ console.log(` push ${import_picocolors3.default.cyan(import_picocolors3.default.bold("yes"))}`);
1332
1368
  console.log();
1333
- console.log(` from ${import_picocolors2.default.bold(operation.state.currentVersion)}`);
1334
- console.log(` to ${import_picocolors2.default.green(import_picocolors2.default.bold(operation.state.newVersion))}`);
1369
+ console.log(` from ${import_picocolors3.default.bold(operation.state.currentVersion)}`);
1370
+ console.log(` to ${import_picocolors3.default.green(import_picocolors3.default.bold(operation.state.newVersion))}`);
1335
1371
  console.log();
1336
1372
  }
1337
1373
  async function versionBumpInfo(arg = {}) {
@@ -1352,11 +1388,13 @@ var bumpConfigDefaults = {
1352
1388
  commit: true,
1353
1389
  push: true,
1354
1390
  tag: true,
1391
+ sign: false,
1355
1392
  recursive: false,
1356
1393
  noVerify: false,
1357
1394
  confirm: true,
1358
1395
  ignoreScripts: false,
1359
1396
  all: false,
1397
+ noGitCheck: true,
1360
1398
  files: []
1361
1399
  };
1362
1400
  async function loadBumpConfig(overrides, cwd = import_node_process6.default.cwd()) {
@@ -1368,6 +1406,7 @@ async function loadBumpConfig(overrides, cwd = import_node_process6.default.cwd(
1368
1406
  overrides: __spreadValues({}, overrides),
1369
1407
  cwd: configFile ? (0, import_node_path2.dirname)(configFile) : cwd
1370
1408
  });
1409
+ console.log(config);
1371
1410
  return config;
1372
1411
  }
1373
1412
  function findConfigFile(name, cwd) {
package/dist/index.mjs CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  loadBumpConfig,
8
8
  versionBump,
9
9
  versionBumpInfo
10
- } from "./chunk-CNEN62NE.mjs";
10
+ } from "./chunk-EGVMKV3X.mjs";
11
11
 
12
12
  // src/index.ts
13
13
  var src_default = versionBump;
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "bumpp",
3
- "version": "9.6.0",
3
+ "version": "9.7.0",
4
+ "packageManager": "pnpm@9.12.1",
4
5
  "description": "Bump version, commit changes, tag, and push to Git",
5
6
  "author": {
6
7
  "name": "James Messinger",
@@ -44,6 +45,20 @@
44
45
  "engines": {
45
46
  "node": ">=10"
46
47
  },
48
+ "scripts": {
49
+ "clean": "rimraf .nyc_output coverage dist",
50
+ "lint": "eslint .",
51
+ "lint:fix": "eslint --fix .",
52
+ "build": "tsup src/index.ts src/cli/index.ts --format esm,cjs --dts --clean",
53
+ "watch": "npm run build -- --watch src",
54
+ "start": "esno src/cli/run.ts",
55
+ "test": "vitest",
56
+ "upgrade": "npm-check -u && npm audit fix",
57
+ "bumpp": "esno src/cli/run.ts",
58
+ "prepublishOnly": "npm run clean && npm run build",
59
+ "release": "npm run bumpp && npm publish",
60
+ "typecheck": "tsc --noEmit"
61
+ },
47
62
  "dependencies": {
48
63
  "@jsdevtools/ez-spawn": "^3.0.4",
49
64
  "c12": "^1.11.2",
@@ -58,29 +73,17 @@
58
73
  "devDependencies": {
59
74
  "@antfu/eslint-config": "^3.7.3",
60
75
  "@types/js-yaml": "^4.0.9",
61
- "@types/node": "^22.7.4",
76
+ "@types/node": "^22.7.5",
62
77
  "@types/prompts": "^2.4.9",
63
78
  "@types/semver": "^7.5.8",
64
- "eslint": "^9.11.1",
65
- "esno": "^4.7.0",
79
+ "eslint": "^9.12.0",
80
+ "esno": "^4.8.0",
66
81
  "log-symbols": "^6.0.0",
67
82
  "npm-check": "^6.0.1",
68
83
  "picocolors": "^1.1.0",
69
84
  "rimraf": "^6.0.1",
70
85
  "tsup": "^8.3.0",
71
- "typescript": "^5.6.2",
72
- "vitest": "^2.1.1"
73
- },
74
- "scripts": {
75
- "clean": "rimraf .nyc_output coverage dist",
76
- "lint": "eslint .",
77
- "build": "tsup src/index.ts src/cli/index.ts --format esm,cjs --dts --clean",
78
- "watch": "npm run build -- --watch src",
79
- "start": "esno src/cli/run.ts",
80
- "test": "vitest",
81
- "upgrade": "npm-check -u && npm audit fix",
82
- "bumpp": "esno src/cli/run.ts",
83
- "release": "npm run bumpp && npm publish",
84
- "typecheck": "tsc --noEmit"
86
+ "typescript": "^5.6.3",
87
+ "vitest": "^2.1.2"
85
88
  }
86
- }
89
+ }