bumpp 9.2.1 → 9.3.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/README.md CHANGED
@@ -9,14 +9,15 @@ Forked from [`version-bump-prompt`](https://github.com/JS-DevTools/version-bump-
9
9
  - Renamed to `bumpp` - so you can use `npx bumpp` directly.
10
10
  - Ships ESM and CJS bundles.
11
11
  - Add a new argument `--execute` to execute the command before committing.
12
- - Use current version's `preid` when avaliable.
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
15
  - `-r` or `--recursive` to bump all packages in the monorepo.
16
16
  - Conventional Commits by default.
17
- - Supports config file `bumpp.config.ts`:
17
+ - Supports config file `bump.config.ts`:
18
18
 
19
19
  ```ts
20
+ // bump.config.ts
20
21
  import { defineConfig } from 'bumpp'
21
22
 
22
23
  export default defineConfig({
@@ -1,3 +1,4 @@
1
+ import {createRequire as __createRequire} from 'module';var require=__createRequire(import.meta.url);
1
2
  var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __defProps = Object.defineProperties;
@@ -622,7 +623,6 @@ var logSymbols = isUnicodeSupported() ? main : fallback;
622
623
  var log_symbols_default = logSymbols;
623
624
 
624
625
  // src/release-type.ts
625
- import { ReleaseType } from "semver";
626
626
  var prereleaseTypes = ["premajor", "preminor", "prepatch", "prerelease"];
627
627
  var releaseTypes = prereleaseTypes.concat(["major", "minor", "patch"]);
628
628
  function isPrerelease(value) {
@@ -914,6 +914,10 @@ function writeTextFile(file) {
914
914
  function isManifest(obj) {
915
915
  return obj && typeof obj === "object" && isOptionalString(obj.name) && isOptionalString(obj.version) && isOptionalString(obj.description);
916
916
  }
917
+ function isPackageLockManifest(manifest) {
918
+ var _a, _b;
919
+ return typeof ((_b = (_a = manifest.packages) == null ? void 0 : _a[""]) == null ? void 0 : _b.version) === "string";
920
+ }
917
921
  function isOptionalString(value) {
918
922
  const type = typeof value;
919
923
  return value === null || type === "undefined" || type === "string";
@@ -957,7 +961,7 @@ async function gitCommit(operation) {
957
961
  return operation;
958
962
  const { all, noVerify, message } = operation.options.commit;
959
963
  const { updatedFiles, newVersion } = operation.state;
960
- let args = [];
964
+ let args = ["--allow-empty"];
961
965
  if (all) {
962
966
  args.push("--all");
963
967
  }
@@ -1035,7 +1039,7 @@ async function normalizeOptions(raw) {
1035
1039
  else if (raw.commit || tag || push)
1036
1040
  commit = { all, noVerify, message: "chore: release v" };
1037
1041
  const files = await fg(
1038
- ((_a = raw.files) == null ? void 0 : _a.length) ? raw.files : ["package.json", "package-lock.json"],
1042
+ ((_a = raw.files) == null ? void 0 : _a.length) ? raw.files : ["package.json", "package-lock.json", "jsr.json", "jsr.jsonc"],
1039
1043
  {
1040
1044
  cwd,
1041
1045
  onlyFiles: true,
@@ -1178,6 +1182,7 @@ async function updateFile(relPath, operation) {
1178
1182
  case "package-lock.json":
1179
1183
  case "bower.json":
1180
1184
  case "component.json":
1185
+ case "jsr.json":
1181
1186
  return updateManifestFile(relPath, operation);
1182
1187
  default:
1183
1188
  return updateTextFile(relPath, operation);
@@ -1190,6 +1195,9 @@ async function updateManifestFile(relPath, operation) {
1190
1195
  const file = await readJsonFile(relPath, cwd);
1191
1196
  if (isManifest(file.data) && file.data.version !== newVersion) {
1192
1197
  file.data.version = newVersion;
1198
+ if (isPackageLockManifest(file.data)) {
1199
+ file.data.packages[""].version = newVersion;
1200
+ }
1193
1201
  await writeJsonFile(file);
1194
1202
  modified = true;
1195
1203
  }
@@ -1297,7 +1305,6 @@ export {
1297
1305
  __toESM,
1298
1306
  require_picocolors,
1299
1307
  log_symbols_default,
1300
- ReleaseType,
1301
1308
  isReleaseType,
1302
1309
  ProgressEvent,
1303
1310
  NpmScript,
package/dist/cli/index.js CHANGED
@@ -628,7 +628,7 @@ var logSymbols = isUnicodeSupported() ? main : fallback;
628
628
  var log_symbols_default = logSymbols;
629
629
 
630
630
  // package.json
631
- var version = "9.2.1";
631
+ var version = "9.3.1";
632
632
 
633
633
  // src/version-bump.ts
634
634
  var import_node_process5 = __toESM(require("process"));
@@ -640,10 +640,9 @@ var import_prompts2 = __toESM(require("prompts"));
640
640
  var import_node_process3 = __toESM(require("process"));
641
641
  var import_picocolors = __toESM(require_picocolors());
642
642
  var import_prompts = __toESM(require("prompts"));
643
- var import_semver2 = __toESM(require("semver"));
643
+ var import_semver = __toESM(require("semver"));
644
644
 
645
645
  // src/release-type.ts
646
- var import_semver = require("semver");
647
646
  var prereleaseTypes = ["premajor", "preminor", "prepatch", "prerelease"];
648
647
  var releaseTypes = prereleaseTypes.concat(["major", "minor", "patch"]);
649
648
  function isPrerelease(value) {
@@ -662,7 +661,7 @@ async function getNewVersion(operation) {
662
661
  return promptForNewVersion(operation);
663
662
  case "version":
664
663
  return operation.update({
665
- newVersion: new import_semver2.SemVer(release.version, true).version
664
+ newVersion: new import_semver.SemVer(release.version, true).version
666
665
  });
667
666
  default:
668
667
  return operation.update({
@@ -672,7 +671,7 @@ async function getNewVersion(operation) {
672
671
  }
673
672
  }
674
673
  function getNextVersion(oldVersion, bump) {
675
- const oldSemVer = new import_semver2.SemVer(oldVersion);
674
+ const oldSemVer = new import_semver.SemVer(oldVersion);
676
675
  const newSemVer = oldSemVer.inc(bump.type, bump.preid);
677
676
  if (isPrerelease(bump.type) && newSemVer.prerelease.length === 2 && newSemVer.prerelease[0] === bump.preid && String(newSemVer.prerelease[1]) === "0") {
678
677
  newSemVer.prerelease[1] = "1";
@@ -683,12 +682,12 @@ function getNextVersion(oldVersion, bump) {
683
682
  function getNextVersions(oldVersion, preid) {
684
683
  var _a;
685
684
  const next = {};
686
- const parse = import_semver2.default.parse(oldVersion);
685
+ const parse = import_semver.default.parse(oldVersion);
687
686
  if (typeof (parse == null ? void 0 : parse.prerelease[0]) === "string")
688
687
  preid = (parse == null ? void 0 : parse.prerelease[0]) || "preid";
689
688
  for (const type of releaseTypes)
690
- next[type] = import_semver2.default.inc(oldVersion, type, preid);
691
- next.next = ((_a = parse == null ? void 0 : parse.prerelease) == null ? void 0 : _a.length) ? import_semver2.default.inc(oldVersion, "prerelease", preid) : import_semver2.default.inc(oldVersion, "patch");
689
+ next[type] = import_semver.default.inc(oldVersion, type, preid);
690
+ next.next = ((_a = parse == null ? void 0 : parse.prerelease) == null ? void 0 : _a.length) ? import_semver.default.inc(oldVersion, "prerelease", preid) : import_semver.default.inc(oldVersion, "patch");
692
691
  return next;
693
692
  }
694
693
  async function promptForNewVersion(operation) {
@@ -696,7 +695,7 @@ async function promptForNewVersion(operation) {
696
695
  const { oldVersion } = operation.state;
697
696
  const release = operation.options.release;
698
697
  const next = getNextVersions(oldVersion, release.preid);
699
- const configCustomVersion = await ((_b = (_a = operation.options).customVersion) == null ? void 0 : _b.call(_a, oldVersion, import_semver2.default));
698
+ const configCustomVersion = await ((_b = (_a = operation.options).customVersion) == null ? void 0 : _b.call(_a, oldVersion, import_semver.default));
700
699
  const PADDING = 13;
701
700
  const answers = await (0, import_prompts.default)([
702
701
  {
@@ -725,11 +724,11 @@ async function promptForNewVersion(operation) {
725
724
  message: "Enter the new version number:",
726
725
  initial: oldVersion,
727
726
  validate: (custom) => {
728
- return (0, import_semver2.valid)(custom) ? true : "That's not a valid version number";
727
+ return (0, import_semver.valid)(custom) ? true : "That's not a valid version number";
729
728
  }
730
729
  }
731
730
  ]);
732
- const newVersion = answers.release === "none" ? oldVersion : answers.release === "custom" ? (0, import_semver2.clean)(answers.custom) : answers.release === "config" ? (0, import_semver2.clean)(configCustomVersion) : next[answers.release];
731
+ const newVersion = answers.release === "none" ? oldVersion : answers.release === "custom" ? (0, import_semver.clean)(answers.custom) : answers.release === "config" ? (0, import_semver.clean)(configCustomVersion) : next[answers.release];
733
732
  if (!newVersion)
734
733
  import_node_process3.default.exit(1);
735
734
  switch (answers.release) {
@@ -744,7 +743,7 @@ async function promptForNewVersion(operation) {
744
743
  }
745
744
 
746
745
  // src/get-old-version.ts
747
- var import_semver3 = require("semver");
746
+ var import_semver2 = require("semver");
748
747
 
749
748
  // src/fs.ts
750
749
  var import_node_fs = __toESM(require("fs"));
@@ -908,6 +907,10 @@ function writeTextFile(file) {
908
907
  function isManifest(obj) {
909
908
  return obj && typeof obj === "object" && isOptionalString(obj.name) && isOptionalString(obj.version) && isOptionalString(obj.description);
910
909
  }
910
+ function isPackageLockManifest(manifest) {
911
+ var _a, _b;
912
+ return typeof ((_b = (_a = manifest.packages) == null ? void 0 : _a[""]) == null ? void 0 : _b.version) === "string";
913
+ }
911
914
  function isOptionalString(value) {
912
915
  const type = typeof value;
913
916
  return value === null || type === "undefined" || type === "string";
@@ -936,7 +939,7 @@ async function readVersion(file, cwd) {
936
939
  try {
937
940
  const { data: manifest } = await readJsonFile(file, cwd);
938
941
  if (isManifest(manifest)) {
939
- if ((0, import_semver3.valid)(manifest.version))
942
+ if ((0, import_semver2.valid)(manifest.version))
940
943
  return manifest.version;
941
944
  }
942
945
  } catch (error) {
@@ -951,7 +954,7 @@ async function gitCommit(operation) {
951
954
  return operation;
952
955
  const { all, noVerify, message } = operation.options.commit;
953
956
  const { updatedFiles, newVersion } = operation.state;
954
- let args = [];
957
+ let args = ["--allow-empty"];
955
958
  if (all) {
956
959
  args.push("--all");
957
960
  }
@@ -1029,7 +1032,7 @@ async function normalizeOptions(raw) {
1029
1032
  else if (raw.commit || tag || push)
1030
1033
  commit = { all, noVerify, message: "chore: release v" };
1031
1034
  const files = await (0, import_fast_glob.default)(
1032
- ((_a = raw.files) == null ? void 0 : _a.length) ? raw.files : ["package.json", "package-lock.json"],
1035
+ ((_a = raw.files) == null ? void 0 : _a.length) ? raw.files : ["package.json", "package-lock.json", "jsr.json", "jsr.jsonc"],
1033
1036
  {
1034
1037
  cwd,
1035
1038
  onlyFiles: true,
@@ -1172,6 +1175,7 @@ async function updateFile(relPath, operation) {
1172
1175
  case "package-lock.json":
1173
1176
  case "bower.json":
1174
1177
  case "component.json":
1178
+ case "jsr.json":
1175
1179
  return updateManifestFile(relPath, operation);
1176
1180
  default:
1177
1181
  return updateTextFile(relPath, operation);
@@ -1184,6 +1188,9 @@ async function updateManifestFile(relPath, operation) {
1184
1188
  const file = await readJsonFile(relPath, cwd);
1185
1189
  if (isManifest(file.data) && file.data.version !== newVersion) {
1186
1190
  file.data.version = newVersion;
1191
+ if (isPackageLockManifest(file.data)) {
1192
+ file.data.packages[""].version = newVersion;
1193
+ }
1187
1194
  await writeJsonFile(file);
1188
1195
  modified = true;
1189
1196
  }
@@ -1254,9 +1261,12 @@ function printSummary(operation) {
1254
1261
 
1255
1262
  // src/cli/parse-args.ts
1256
1263
  var import_node_process7 = __toESM(require("process"));
1257
- var import_semver4 = require("semver");
1264
+ var import_promises = __toESM(require("fs/promises"));
1265
+ var import_node_fs2 = __toESM(require("fs"));
1266
+ var import_semver3 = require("semver");
1258
1267
  var import_cac = __toESM(require("cac"));
1259
1268
  var import_picocolors3 = __toESM(require_picocolors());
1269
+ var import_js_yaml = __toESM(require("js-yaml"));
1260
1270
 
1261
1271
  // src/config.ts
1262
1272
  var import_node_process6 = __toESM(require("process"));
@@ -1287,7 +1297,7 @@ async function parseArgs() {
1287
1297
  var _a;
1288
1298
  try {
1289
1299
  const cli = (0, import_cac.default)("bumpp");
1290
- cli.version(version).usage("[...files]").option("--preid <preid>", "ID for prerelease").option("--all", `Include all files (default: ${bumpConfigDefaults.all})`).option("-c, --commit [msg]", `Commit message (default: ${bumpConfigDefaults.commit})`).option("--no-commit", "Skip commit").option("-t, --tag [tag]", `Tag name (default: ${bumpConfigDefaults.tag})`).option("--no-tag", "Skip tag").option("-p, --push", `Push to remote (default: ${bumpConfigDefaults.push})`).option("-y, --yes", `Skip confirmation (default: ${!bumpConfigDefaults.confirm})`).option("-r, --recursive", `Bump package.json files recursively (default: ${bumpConfigDefaults.recursive})`).option("--no-verify", "Skip git verification").option("--ignore-scripts", `Ignore scripts (default: ${bumpConfigDefaults.ignoreScripts})`).option("-q, --quiet", "Quiet mode").option("-v, --version <version>", "Tagert version").option("-x, --execute <command>", "Commands to execute after version bumps").help();
1300
+ cli.version(version).usage("[...files]").option("--preid <preid>", "ID for prerelease").option("--all", `Include all files (default: ${bumpConfigDefaults.all})`).option("-c, --commit [msg]", `Commit message (default: ${bumpConfigDefaults.commit})`).option("--no-commit", "Skip commit").option("-t, --tag [tag]", `Tag name (default: ${bumpConfigDefaults.tag})`).option("--no-tag", "Skip tag").option("-p, --push", `Push to remote (default: ${bumpConfigDefaults.push})`).option("-y, --yes", `Skip confirmation (default: ${!bumpConfigDefaults.confirm})`).option("-r, --recursive", `Bump package.json files recursively (default: ${bumpConfigDefaults.recursive})`).option("--no-verify", "Skip git verification").option("--ignore-scripts", `Ignore scripts (default: ${bumpConfigDefaults.ignoreScripts})`).option("-q, --quiet", "Quiet mode").option("-v, --version <version>", "Target version").option("-x, --execute <command>", "Commands to execute after version bumps").help();
1291
1301
  const result = cli.parse();
1292
1302
  const args = result.options;
1293
1303
  const parsedArgs = {
@@ -1310,16 +1320,33 @@ async function parseArgs() {
1310
1320
  };
1311
1321
  if (parsedArgs.options.files && parsedArgs.options.files.length > 0) {
1312
1322
  const firstArg = parsedArgs.options.files[0];
1313
- if (firstArg === "prompt" || isReleaseType(firstArg) || (0, import_semver4.valid)(firstArg)) {
1323
+ if (firstArg === "prompt" || isReleaseType(firstArg) || (0, import_semver3.valid)(firstArg)) {
1314
1324
  parsedArgs.options.release = firstArg;
1315
1325
  parsedArgs.options.files.shift();
1316
1326
  }
1317
1327
  }
1318
1328
  if (parsedArgs.options.recursive) {
1319
- if ((_a = parsedArgs.options.files) == null ? void 0 : _a.length)
1329
+ if ((_a = parsedArgs.options.files) == null ? void 0 : _a.length) {
1320
1330
  console.log(import_picocolors3.default.yellow("The --recursive option is ignored when files are specified"));
1321
- else
1322
- parsedArgs.options.files = ["package.json", "package-lock.json", "packages/**/package.json"];
1331
+ } else {
1332
+ parsedArgs.options.files = [
1333
+ "package.json",
1334
+ "package-lock.json",
1335
+ "packages/**/package.json",
1336
+ "jsr.json",
1337
+ "jsr.jsonc"
1338
+ ];
1339
+ if (import_node_fs2.default.existsSync("pnpm-workspace.yaml")) {
1340
+ const pnpmWorkspace = await import_promises.default.readFile("pnpm-workspace.yaml", "utf8");
1341
+ const workspaces = import_js_yaml.default.load(pnpmWorkspace);
1342
+ const workspacesWithPackageJson = workspaces.packages.map((workspace) => `${workspace}/package.json`);
1343
+ const withoutExcludedWorkspaces = workspacesWithPackageJson.filter((workspace) => {
1344
+ var _a2;
1345
+ return !workspace.startsWith("!") && !((_a2 = parsedArgs.options.files) == null ? void 0 : _a2.includes(workspace));
1346
+ });
1347
+ parsedArgs.options.files = parsedArgs.options.files.concat(withoutExcludedWorkspaces);
1348
+ }
1349
+ }
1323
1350
  }
1324
1351
  return parsedArgs;
1325
1352
  } catch (error) {
@@ -1,3 +1,4 @@
1
+ import {createRequire as __createRequire} from 'module';var require=__createRequire(import.meta.url);
1
2
  import {
2
3
  __toESM,
3
4
  bumpConfigDefaults,
@@ -6,24 +7,27 @@ import {
6
7
  log_symbols_default,
7
8
  require_picocolors,
8
9
  versionBump
9
- } from "../chunk-D4MB64LD.mjs";
10
+ } from "../chunk-2LHJGPFO.mjs";
10
11
 
11
12
  // src/cli/index.ts
12
13
  import process2 from "process";
13
14
 
14
15
  // package.json
15
- var version = "9.2.1";
16
+ var version = "9.3.1";
16
17
 
17
18
  // src/cli/parse-args.ts
18
19
  var import_picocolors = __toESM(require_picocolors());
19
20
  import process from "process";
21
+ import fs from "fs/promises";
22
+ import fsSync from "fs";
20
23
  import { valid as isValidVersion } from "semver";
21
24
  import cac from "cac";
25
+ import yaml from "js-yaml";
22
26
  async function parseArgs() {
23
27
  var _a;
24
28
  try {
25
29
  const cli = cac("bumpp");
26
- cli.version(version).usage("[...files]").option("--preid <preid>", "ID for prerelease").option("--all", `Include all files (default: ${bumpConfigDefaults.all})`).option("-c, --commit [msg]", `Commit message (default: ${bumpConfigDefaults.commit})`).option("--no-commit", "Skip commit").option("-t, --tag [tag]", `Tag name (default: ${bumpConfigDefaults.tag})`).option("--no-tag", "Skip tag").option("-p, --push", `Push to remote (default: ${bumpConfigDefaults.push})`).option("-y, --yes", `Skip confirmation (default: ${!bumpConfigDefaults.confirm})`).option("-r, --recursive", `Bump package.json files recursively (default: ${bumpConfigDefaults.recursive})`).option("--no-verify", "Skip git verification").option("--ignore-scripts", `Ignore scripts (default: ${bumpConfigDefaults.ignoreScripts})`).option("-q, --quiet", "Quiet mode").option("-v, --version <version>", "Tagert version").option("-x, --execute <command>", "Commands to execute after version bumps").help();
30
+ cli.version(version).usage("[...files]").option("--preid <preid>", "ID for prerelease").option("--all", `Include all files (default: ${bumpConfigDefaults.all})`).option("-c, --commit [msg]", `Commit message (default: ${bumpConfigDefaults.commit})`).option("--no-commit", "Skip commit").option("-t, --tag [tag]", `Tag name (default: ${bumpConfigDefaults.tag})`).option("--no-tag", "Skip tag").option("-p, --push", `Push to remote (default: ${bumpConfigDefaults.push})`).option("-y, --yes", `Skip confirmation (default: ${!bumpConfigDefaults.confirm})`).option("-r, --recursive", `Bump package.json files recursively (default: ${bumpConfigDefaults.recursive})`).option("--no-verify", "Skip git verification").option("--ignore-scripts", `Ignore scripts (default: ${bumpConfigDefaults.ignoreScripts})`).option("-q, --quiet", "Quiet mode").option("-v, --version <version>", "Target version").option("-x, --execute <command>", "Commands to execute after version bumps").help();
27
31
  const result = cli.parse();
28
32
  const args = result.options;
29
33
  const parsedArgs = {
@@ -52,10 +56,27 @@ async function parseArgs() {
52
56
  }
53
57
  }
54
58
  if (parsedArgs.options.recursive) {
55
- if ((_a = parsedArgs.options.files) == null ? void 0 : _a.length)
59
+ if ((_a = parsedArgs.options.files) == null ? void 0 : _a.length) {
56
60
  console.log(import_picocolors.default.yellow("The --recursive option is ignored when files are specified"));
57
- else
58
- parsedArgs.options.files = ["package.json", "package-lock.json", "packages/**/package.json"];
61
+ } else {
62
+ parsedArgs.options.files = [
63
+ "package.json",
64
+ "package-lock.json",
65
+ "packages/**/package.json",
66
+ "jsr.json",
67
+ "jsr.jsonc"
68
+ ];
69
+ if (fsSync.existsSync("pnpm-workspace.yaml")) {
70
+ const pnpmWorkspace = await fs.readFile("pnpm-workspace.yaml", "utf8");
71
+ const workspaces = yaml.load(pnpmWorkspace);
72
+ const workspacesWithPackageJson = workspaces.packages.map((workspace) => `${workspace}/package.json`);
73
+ const withoutExcludedWorkspaces = workspacesWithPackageJson.filter((workspace) => {
74
+ var _a2;
75
+ return !workspace.startsWith("!") && !((_a2 = parsedArgs.options.files) == null ? void 0 : _a2.includes(workspace));
76
+ });
77
+ parsedArgs.options.files = parsedArgs.options.files.concat(withoutExcludedWorkspaces);
78
+ }
79
+ }
59
80
  }
60
81
  return parsedArgs;
61
82
  } catch (error) {
package/dist/index.d.mts CHANGED
@@ -137,7 +137,7 @@ interface VersionBumpOptions {
137
137
  * (ReadMe files, config files, source code, etc.) it will simply do a global replacement
138
138
  * of the old version number with the new version number.
139
139
  *
140
- * Defaults to ["package.json", "package-lock.json"]
140
+ * Defaults to ["package.json", "package-lock.json", "jsr.json", "jsr.jsonc"]
141
141
  */
142
142
  files?: string[];
143
143
  /**
package/dist/index.d.ts CHANGED
@@ -137,7 +137,7 @@ interface VersionBumpOptions {
137
137
  * (ReadMe files, config files, source code, etc.) it will simply do a global replacement
138
138
  * of the old version number with the new version number.
139
139
  *
140
- * Defaults to ["package.json", "package-lock.json"]
140
+ * Defaults to ["package.json", "package-lock.json", "jsr.json", "jsr.jsonc"]
141
141
  */
142
142
  files?: string[];
143
143
  /**
package/dist/index.js CHANGED
@@ -112,7 +112,6 @@ var src_exports = {};
112
112
  __export(src_exports, {
113
113
  NpmScript: () => NpmScript,
114
114
  ProgressEvent: () => ProgressEvent,
115
- ReleaseType: () => import_semver.ReleaseType,
116
115
  bumpConfigDefaults: () => bumpConfigDefaults,
117
116
  default: () => src_default,
118
117
  defineConfig: () => defineConfig,
@@ -646,10 +645,9 @@ var import_prompts2 = __toESM(require("prompts"));
646
645
  var import_node_process3 = __toESM(require("process"));
647
646
  var import_picocolors = __toESM(require_picocolors());
648
647
  var import_prompts = __toESM(require("prompts"));
649
- var import_semver2 = __toESM(require("semver"));
648
+ var import_semver = __toESM(require("semver"));
650
649
 
651
650
  // src/release-type.ts
652
- var import_semver = require("semver");
653
651
  var prereleaseTypes = ["premajor", "preminor", "prepatch", "prerelease"];
654
652
  var releaseTypes = prereleaseTypes.concat(["major", "minor", "patch"]);
655
653
  function isPrerelease(value) {
@@ -668,7 +666,7 @@ async function getNewVersion(operation) {
668
666
  return promptForNewVersion(operation);
669
667
  case "version":
670
668
  return operation.update({
671
- newVersion: new import_semver2.SemVer(release.version, true).version
669
+ newVersion: new import_semver.SemVer(release.version, true).version
672
670
  });
673
671
  default:
674
672
  return operation.update({
@@ -678,7 +676,7 @@ async function getNewVersion(operation) {
678
676
  }
679
677
  }
680
678
  function getNextVersion(oldVersion, bump) {
681
- const oldSemVer = new import_semver2.SemVer(oldVersion);
679
+ const oldSemVer = new import_semver.SemVer(oldVersion);
682
680
  const newSemVer = oldSemVer.inc(bump.type, bump.preid);
683
681
  if (isPrerelease(bump.type) && newSemVer.prerelease.length === 2 && newSemVer.prerelease[0] === bump.preid && String(newSemVer.prerelease[1]) === "0") {
684
682
  newSemVer.prerelease[1] = "1";
@@ -689,12 +687,12 @@ function getNextVersion(oldVersion, bump) {
689
687
  function getNextVersions(oldVersion, preid) {
690
688
  var _a;
691
689
  const next = {};
692
- const parse = import_semver2.default.parse(oldVersion);
690
+ const parse = import_semver.default.parse(oldVersion);
693
691
  if (typeof (parse == null ? void 0 : parse.prerelease[0]) === "string")
694
692
  preid = (parse == null ? void 0 : parse.prerelease[0]) || "preid";
695
693
  for (const type of releaseTypes)
696
- next[type] = import_semver2.default.inc(oldVersion, type, preid);
697
- next.next = ((_a = parse == null ? void 0 : parse.prerelease) == null ? void 0 : _a.length) ? import_semver2.default.inc(oldVersion, "prerelease", preid) : import_semver2.default.inc(oldVersion, "patch");
694
+ next[type] = import_semver.default.inc(oldVersion, type, preid);
695
+ next.next = ((_a = parse == null ? void 0 : parse.prerelease) == null ? void 0 : _a.length) ? import_semver.default.inc(oldVersion, "prerelease", preid) : import_semver.default.inc(oldVersion, "patch");
698
696
  return next;
699
697
  }
700
698
  async function promptForNewVersion(operation) {
@@ -702,7 +700,7 @@ async function promptForNewVersion(operation) {
702
700
  const { oldVersion } = operation.state;
703
701
  const release = operation.options.release;
704
702
  const next = getNextVersions(oldVersion, release.preid);
705
- const configCustomVersion = await ((_b = (_a = operation.options).customVersion) == null ? void 0 : _b.call(_a, oldVersion, import_semver2.default));
703
+ const configCustomVersion = await ((_b = (_a = operation.options).customVersion) == null ? void 0 : _b.call(_a, oldVersion, import_semver.default));
706
704
  const PADDING = 13;
707
705
  const answers = await (0, import_prompts.default)([
708
706
  {
@@ -731,11 +729,11 @@ async function promptForNewVersion(operation) {
731
729
  message: "Enter the new version number:",
732
730
  initial: oldVersion,
733
731
  validate: (custom) => {
734
- return (0, import_semver2.valid)(custom) ? true : "That's not a valid version number";
732
+ return (0, import_semver.valid)(custom) ? true : "That's not a valid version number";
735
733
  }
736
734
  }
737
735
  ]);
738
- const newVersion = answers.release === "none" ? oldVersion : answers.release === "custom" ? (0, import_semver2.clean)(answers.custom) : answers.release === "config" ? (0, import_semver2.clean)(configCustomVersion) : next[answers.release];
736
+ const newVersion = answers.release === "none" ? oldVersion : answers.release === "custom" ? (0, import_semver.clean)(answers.custom) : answers.release === "config" ? (0, import_semver.clean)(configCustomVersion) : next[answers.release];
739
737
  if (!newVersion)
740
738
  import_node_process3.default.exit(1);
741
739
  switch (answers.release) {
@@ -750,7 +748,7 @@ async function promptForNewVersion(operation) {
750
748
  }
751
749
 
752
750
  // src/get-old-version.ts
753
- var import_semver3 = require("semver");
751
+ var import_semver2 = require("semver");
754
752
 
755
753
  // src/fs.ts
756
754
  var import_node_fs = __toESM(require("fs"));
@@ -914,6 +912,10 @@ function writeTextFile(file) {
914
912
  function isManifest(obj) {
915
913
  return obj && typeof obj === "object" && isOptionalString(obj.name) && isOptionalString(obj.version) && isOptionalString(obj.description);
916
914
  }
915
+ function isPackageLockManifest(manifest) {
916
+ var _a, _b;
917
+ return typeof ((_b = (_a = manifest.packages) == null ? void 0 : _a[""]) == null ? void 0 : _b.version) === "string";
918
+ }
917
919
  function isOptionalString(value) {
918
920
  const type = typeof value;
919
921
  return value === null || type === "undefined" || type === "string";
@@ -942,7 +944,7 @@ async function readVersion(file, cwd) {
942
944
  try {
943
945
  const { data: manifest } = await readJsonFile(file, cwd);
944
946
  if (isManifest(manifest)) {
945
- if ((0, import_semver3.valid)(manifest.version))
947
+ if ((0, import_semver2.valid)(manifest.version))
946
948
  return manifest.version;
947
949
  }
948
950
  } catch (error) {
@@ -976,7 +978,7 @@ async function gitCommit(operation) {
976
978
  return operation;
977
979
  const { all, noVerify, message } = operation.options.commit;
978
980
  const { updatedFiles, newVersion } = operation.state;
979
- let args = [];
981
+ let args = ["--allow-empty"];
980
982
  if (all) {
981
983
  args.push("--all");
982
984
  }
@@ -1054,7 +1056,7 @@ async function normalizeOptions(raw) {
1054
1056
  else if (raw.commit || tag || push)
1055
1057
  commit = { all, noVerify, message: "chore: release v" };
1056
1058
  const files = await (0, import_fast_glob.default)(
1057
- ((_a = raw.files) == null ? void 0 : _a.length) ? raw.files : ["package.json", "package-lock.json"],
1059
+ ((_a = raw.files) == null ? void 0 : _a.length) ? raw.files : ["package.json", "package-lock.json", "jsr.json", "jsr.jsonc"],
1058
1060
  {
1059
1061
  cwd,
1060
1062
  onlyFiles: true,
@@ -1197,6 +1199,7 @@ async function updateFile(relPath, operation) {
1197
1199
  case "package-lock.json":
1198
1200
  case "bower.json":
1199
1201
  case "component.json":
1202
+ case "jsr.json":
1200
1203
  return updateManifestFile(relPath, operation);
1201
1204
  default:
1202
1205
  return updateTextFile(relPath, operation);
@@ -1209,6 +1212,9 @@ async function updateManifestFile(relPath, operation) {
1209
1212
  const file = await readJsonFile(relPath, cwd);
1210
1213
  if (isManifest(file.data) && file.data.version !== newVersion) {
1211
1214
  file.data.version = newVersion;
1215
+ if (isPackageLockManifest(file.data)) {
1216
+ file.data.packages[""].version = newVersion;
1217
+ }
1212
1218
  await writeJsonFile(file);
1213
1219
  modified = true;
1214
1220
  }
@@ -1318,7 +1324,6 @@ var src_default = versionBump;
1318
1324
  0 && (module.exports = {
1319
1325
  NpmScript,
1320
1326
  ProgressEvent,
1321
- ReleaseType,
1322
1327
  bumpConfigDefaults,
1323
1328
  defineConfig,
1324
1329
  loadBumpConfig,
package/dist/index.mjs CHANGED
@@ -1,20 +1,19 @@
1
+ import {createRequire as __createRequire} from 'module';var require=__createRequire(import.meta.url);
1
2
  import {
2
3
  NpmScript,
3
4
  ProgressEvent,
4
- ReleaseType,
5
5
  bumpConfigDefaults,
6
6
  defineConfig,
7
7
  loadBumpConfig,
8
8
  versionBump,
9
9
  versionBumpInfo
10
- } from "./chunk-D4MB64LD.mjs";
10
+ } from "./chunk-2LHJGPFO.mjs";
11
11
 
12
12
  // src/index.ts
13
13
  var src_default = versionBump;
14
14
  export {
15
15
  NpmScript,
16
16
  ProgressEvent,
17
- ReleaseType,
18
17
  bumpConfigDefaults,
19
18
  src_default as default,
20
19
  defineConfig,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bumpp",
3
- "version": "9.2.1",
4
- "packageManager": "pnpm@8.12.0",
3
+ "version": "9.3.1",
4
+ "packageManager": "pnpm@8.15.4",
5
5
  "description": "Bump version, commit changes, tag, and push to Git",
6
6
  "author": {
7
7
  "name": "James Messinger",
@@ -58,26 +58,28 @@
58
58
  },
59
59
  "dependencies": {
60
60
  "@jsdevtools/ez-spawn": "^3.0.4",
61
- "c12": "^1.5.1",
61
+ "c12": "^1.9.0",
62
62
  "cac": "^6.7.14",
63
63
  "fast-glob": "^3.3.2",
64
+ "js-yaml": "^4.1.0",
64
65
  "prompts": "^2.4.2",
65
- "semver": "^7.5.4"
66
+ "semver": "^7.6.0"
66
67
  },
67
68
  "devDependencies": {
68
- "@antfu/eslint-config": "^2.4.3",
69
- "@types/node": "^20.10.4",
69
+ "@antfu/eslint-config": "^2.7.0",
70
+ "@types/js-yaml": "^4.0.9",
71
+ "@types/node": "^20.11.24",
70
72
  "@types/prompts": "^2.4.9",
71
- "@types/semver": "^7.5.6",
73
+ "@types/semver": "^7.5.8",
72
74
  "detect-indent": "^7.0.1",
73
75
  "detect-newline": "^4.0.1",
74
- "eslint": "^8.55.0",
76
+ "eslint": "^8.57.0",
75
77
  "esno": "^4.0.0",
76
78
  "log-symbols": "^6.0.0",
77
79
  "npm-check": "^6.0.1",
78
80
  "picocolors": "^1.0.0",
79
81
  "rimraf": "^5.0.5",
80
- "tsup": "^8.0.1",
82
+ "tsup": "^8.0.2",
81
83
  "typescript": "^5.3.3"
82
84
  }
83
85
  }