bumpp 9.1.1 → 9.2.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
@@ -13,7 +13,7 @@ Forked from [`version-bump-prompt`](https://github.com/JS-DevTools/version-bump-
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
- - Conventional Commits by default.
16
+ - Conventional Commits by default.
17
17
  - Supports config file `bumpp.config.ts`:
18
18
 
19
19
  ```ts
@@ -26,7 +26,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
26
26
  }) : x)(function(x) {
27
27
  if (typeof require !== "undefined")
28
28
  return require.apply(this, arguments);
29
- throw new Error('Dynamic require of "' + x + '" is not supported');
29
+ throw Error('Dynamic require of "' + x + '" is not supported');
30
30
  });
31
31
  var __objRest = (source, exclude) => {
32
32
  var target = {};
@@ -109,7 +109,7 @@ var require_picocolors = __commonJS({
109
109
  }
110
110
  });
111
111
 
112
- // node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/vendor/ansi-styles/index.js
112
+ // node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/ansi-styles/index.js
113
113
  var ANSI_BACKGROUND_OFFSET = 10;
114
114
  var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
115
115
  var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
@@ -295,7 +295,7 @@ function assembleStyles() {
295
295
  var ansiStyles = assembleStyles();
296
296
  var ansi_styles_default = ansiStyles;
297
297
 
298
- // node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/vendor/supports-color/index.js
298
+ // node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/supports-color/index.js
299
299
  import process2 from "process";
300
300
  import os from "os";
301
301
  import tty from "tty";
@@ -369,7 +369,7 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
369
369
  return 1;
370
370
  }
371
371
  if ("CI" in env) {
372
- if ("GITHUB_ACTIONS" in env) {
372
+ if ("GITHUB_ACTIONS" in env || "GITEA_ACTIONS" in env) {
373
373
  return 3;
374
374
  }
375
375
  if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
@@ -420,7 +420,7 @@ var supportsColor = {
420
420
  };
421
421
  var supports_color_default = supportsColor;
422
422
 
423
- // node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/utilities.js
423
+ // node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/utilities.js
424
424
  function stringReplaceAll(string, substring, replacer) {
425
425
  let index = string.indexOf(substring);
426
426
  if (index === -1) {
@@ -450,7 +450,7 @@ function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
450
450
  return returnValue;
451
451
  }
452
452
 
453
- // node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/index.js
453
+ // node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/index.js
454
454
  var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
455
455
  var GENERATOR = Symbol("GENERATOR");
456
456
  var STYLER = Symbol("STYLER");
@@ -605,7 +605,7 @@ function isUnicodeSupported() {
605
605
  return Boolean(process3.env.CI) || Boolean(process3.env.WT_SESSION) || Boolean(process3.env.TERMINUS_SUBLIME) || process3.env.ConEmuTask === "{cmd::Cmder}" || process3.env.TERM_PROGRAM === "Terminus-Sublime" || process3.env.TERM_PROGRAM === "vscode" || process3.env.TERM === "xterm-256color" || process3.env.TERM === "alacritty" || process3.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
606
606
  }
607
607
 
608
- // node_modules/.pnpm/log-symbols@5.1.0/node_modules/log-symbols/index.js
608
+ // node_modules/.pnpm/log-symbols@6.0.0/node_modules/log-symbols/index.js
609
609
  var main = {
610
610
  info: source_default.blue("\u2139"),
611
611
  success: source_default.green("\u2714"),
@@ -651,11 +651,13 @@ var NpmScript = /* @__PURE__ */ ((NpmScript2) => {
651
651
 
652
652
  // src/version-bump.ts
653
653
  var import_picocolors2 = __toESM(require_picocolors());
654
+ import process6 from "process";
654
655
  import * as ezSpawn3 from "@jsdevtools/ez-spawn";
655
656
  import prompts2 from "prompts";
656
657
 
657
658
  // src/get-new-version.ts
658
659
  var import_picocolors = __toESM(require_picocolors());
660
+ import process4 from "process";
659
661
  import prompts from "prompts";
660
662
  import semver, { SemVer, clean as cleanVersion, valid as isValidVersion } from "semver";
661
663
  async function getNewVersion(operation) {
@@ -696,21 +698,26 @@ function getNextVersions(oldVersion, preid) {
696
698
  return next;
697
699
  }
698
700
  async function promptForNewVersion(operation) {
701
+ var _a, _b;
699
702
  const { oldVersion } = operation.state;
700
703
  const release = operation.options.release;
701
704
  const next = getNextVersions(oldVersion, release.preid);
705
+ const configCustomVersion = await ((_b = (_a = operation.options).customVersion) == null ? void 0 : _b.call(_a, oldVersion, semver));
702
706
  const PADDING = 13;
703
707
  const answers = await prompts([
704
708
  {
705
709
  type: "autocomplete",
706
710
  name: "release",
707
711
  message: `Current version ${import_picocolors.default.green(oldVersion)}`,
708
- initial: "next",
712
+ initial: configCustomVersion ? "config" : "next",
709
713
  choices: [
710
714
  { value: "major", title: `${"major".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.major)}` },
711
715
  { value: "minor", title: `${"minor".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.minor)}` },
712
716
  { value: "patch", title: `${"patch".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.patch)}` },
713
717
  { value: "next", title: `${"next".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.next)}` },
718
+ ...configCustomVersion ? [
719
+ { value: "config", title: `${"from config".padStart(PADDING, " ")} ${import_picocolors.default.bold(configCustomVersion)}` }
720
+ ] : [],
714
721
  { value: "prepatch", title: `${"pre-patch".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.prepatch)}` },
715
722
  { value: "preminor", title: `${"pre-minor".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.preminor)}` },
716
723
  { value: "premajor", title: `${"pre-major".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.premajor)}` },
@@ -728,11 +735,12 @@ async function promptForNewVersion(operation) {
728
735
  }
729
736
  }
730
737
  ]);
731
- const newVersion = answers.release === "none" ? oldVersion : answers.release === "custom" ? cleanVersion(answers.custom) : next[answers.release];
738
+ const newVersion = answers.release === "none" ? oldVersion : answers.release === "custom" ? cleanVersion(answers.custom) : answers.release === "config" ? cleanVersion(configCustomVersion) : next[answers.release];
732
739
  if (!newVersion)
733
- process.exit(1);
740
+ process4.exit(1);
734
741
  switch (answers.release) {
735
742
  case "custom":
743
+ case "config":
736
744
  case "next":
737
745
  case "none":
738
746
  return operation.update({ newVersion });
@@ -848,7 +856,7 @@ function detectIndent(string) {
848
856
  };
849
857
  }
850
858
 
851
- // node_modules/.pnpm/detect-newline@4.0.0/node_modules/detect-newline/index.js
859
+ // node_modules/.pnpm/detect-newline@4.0.1/node_modules/detect-newline/index.js
852
860
  function detectNewline(string) {
853
861
  if (typeof string !== "string") {
854
862
  throw new TypeError("Expected a string");
@@ -998,6 +1006,7 @@ function formatVersionString(template, newVersion) {
998
1006
  }
999
1007
 
1000
1008
  // src/normalize-options.ts
1009
+ import process5 from "process";
1001
1010
  import fg from "fast-glob";
1002
1011
  async function normalizeOptions(raw) {
1003
1012
  var _a;
@@ -1005,7 +1014,7 @@ async function normalizeOptions(raw) {
1005
1014
  const push = Boolean(raw.push);
1006
1015
  const all = Boolean(raw.all);
1007
1016
  const noVerify = Boolean(raw.noVerify);
1008
- const cwd = raw.cwd || process.cwd();
1017
+ const cwd = raw.cwd || process5.cwd();
1009
1018
  const ignoreScripts = Boolean(raw.ignoreScripts);
1010
1019
  const execute = raw.execute;
1011
1020
  let release;
@@ -1039,22 +1048,33 @@ async function normalizeOptions(raw) {
1039
1048
  if (raw.interface === false) {
1040
1049
  ui = { input: false, output: false };
1041
1050
  } else if (raw.interface === true || !raw.interface) {
1042
- ui = { input: process.stdin, output: process.stdout };
1051
+ ui = { input: process5.stdin, output: process5.stdout };
1043
1052
  } else {
1044
1053
  let _b = raw.interface, { input, output } = _b, other = __objRest(_b, ["input", "output"]);
1045
1054
  if (input === true || input !== false && !input)
1046
- input = process.stdin;
1055
+ input = process5.stdin;
1047
1056
  if (output === true || output !== false && !output)
1048
- output = process.stdout;
1057
+ output = process5.stdout;
1049
1058
  ui = __spreadValues({ input, output }, other);
1050
1059
  }
1051
1060
  if (release.type === "prompt" && !(ui.input && ui.output))
1052
1061
  throw new Error("Cannot prompt for the version number because input or output has been disabled.");
1053
- return { release, commit, tag, push, files, cwd, interface: ui, ignoreScripts, execute };
1062
+ return {
1063
+ release,
1064
+ commit,
1065
+ tag,
1066
+ push,
1067
+ files,
1068
+ cwd,
1069
+ interface: ui,
1070
+ ignoreScripts,
1071
+ execute,
1072
+ customVersion: raw.customVersion
1073
+ };
1054
1074
  }
1055
1075
 
1056
1076
  // src/operation.ts
1057
- var Operation = class {
1077
+ var Operation = class _Operation {
1058
1078
  /**
1059
1079
  * Private constructor. Use the `Operation.start()` static method instead.
1060
1080
  */
@@ -1096,7 +1116,7 @@ var Operation = class {
1096
1116
  */
1097
1117
  static async start(input) {
1098
1118
  const options = await normalizeOptions(input);
1099
- return new Operation(options, input.progress);
1119
+ return new _Operation(options, input.progress);
1100
1120
  }
1101
1121
  /**
1102
1122
  * Updates the operation state and results, and reports the updated progress to the user.
@@ -1205,7 +1225,7 @@ async function versionBump(arg = {}) {
1205
1225
  message: "Bump?",
1206
1226
  initial: true
1207
1227
  }).then((r) => r.yes))
1208
- process.exit(1);
1228
+ process6.exit(1);
1209
1229
  }
1210
1230
  await runNpmScript("preversion" /* PreVersion */, operation);
1211
1231
  await updateFiles(operation);
@@ -1247,6 +1267,7 @@ async function versionBumpInfo(arg = {}) {
1247
1267
  }
1248
1268
 
1249
1269
  // src/config.ts
1270
+ import process7 from "process";
1250
1271
  import { loadConfig } from "c12";
1251
1272
  var bumpConfigDefaults = {
1252
1273
  commit: true,
@@ -1259,7 +1280,7 @@ var bumpConfigDefaults = {
1259
1280
  all: false,
1260
1281
  files: []
1261
1282
  };
1262
- async function loadBumpConfig(overrides, cwd = process.cwd()) {
1283
+ async function loadBumpConfig(overrides, cwd = process7.cwd()) {
1263
1284
  const { config } = await loadConfig({
1264
1285
  name: "bump",
1265
1286
  defaults: bumpConfigDefaults,
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The main entry point of the CLI
3
+ */
4
+ declare function main(): Promise<void>;
5
+
6
+ export { main };
@@ -1,7 +1,5 @@
1
1
  /**
2
2
  * The main entry point of the CLI
3
- *
4
- * @param args - The command-line arguments (e.g. ["major", "--preid=alpha", "-ctpa"])
5
3
  */
6
4
  declare function main(): Promise<void>;
7
5
 
package/dist/cli/index.js CHANGED
@@ -113,8 +113,9 @@ __export(cli_exports, {
113
113
  main: () => main2
114
114
  });
115
115
  module.exports = __toCommonJS(cli_exports);
116
+ var import_node_process8 = __toESM(require("process"));
116
117
 
117
- // node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/vendor/ansi-styles/index.js
118
+ // node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/ansi-styles/index.js
118
119
  var ANSI_BACKGROUND_OFFSET = 10;
119
120
  var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
120
121
  var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
@@ -300,7 +301,7 @@ function assembleStyles() {
300
301
  var ansiStyles = assembleStyles();
301
302
  var ansi_styles_default = ansiStyles;
302
303
 
303
- // node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/vendor/supports-color/index.js
304
+ // node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/supports-color/index.js
304
305
  var import_node_process = __toESM(require("process"), 1);
305
306
  var import_node_os = __toESM(require("os"), 1);
306
307
  var import_node_tty = __toESM(require("tty"), 1);
@@ -374,7 +375,7 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
374
375
  return 1;
375
376
  }
376
377
  if ("CI" in env) {
377
- if ("GITHUB_ACTIONS" in env) {
378
+ if ("GITHUB_ACTIONS" in env || "GITEA_ACTIONS" in env) {
378
379
  return 3;
379
380
  }
380
381
  if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
@@ -425,7 +426,7 @@ var supportsColor = {
425
426
  };
426
427
  var supports_color_default = supportsColor;
427
428
 
428
- // node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/utilities.js
429
+ // node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/utilities.js
429
430
  function stringReplaceAll(string, substring, replacer) {
430
431
  let index = string.indexOf(substring);
431
432
  if (index === -1) {
@@ -455,7 +456,7 @@ function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
455
456
  return returnValue;
456
457
  }
457
458
 
458
- // node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/index.js
459
+ // node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/index.js
459
460
  var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
460
461
  var GENERATOR = Symbol("GENERATOR");
461
462
  var STYLER = Symbol("STYLER");
@@ -610,7 +611,7 @@ function isUnicodeSupported() {
610
611
  return Boolean(import_node_process2.default.env.CI) || Boolean(import_node_process2.default.env.WT_SESSION) || Boolean(import_node_process2.default.env.TERMINUS_SUBLIME) || import_node_process2.default.env.ConEmuTask === "{cmd::Cmder}" || import_node_process2.default.env.TERM_PROGRAM === "Terminus-Sublime" || import_node_process2.default.env.TERM_PROGRAM === "vscode" || import_node_process2.default.env.TERM === "xterm-256color" || import_node_process2.default.env.TERM === "alacritty" || import_node_process2.default.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
611
612
  }
612
613
 
613
- // node_modules/.pnpm/log-symbols@5.1.0/node_modules/log-symbols/index.js
614
+ // node_modules/.pnpm/log-symbols@6.0.0/node_modules/log-symbols/index.js
614
615
  var main = {
615
616
  info: source_default.blue("\u2139"),
616
617
  success: source_default.green("\u2714"),
@@ -627,14 +628,16 @@ var logSymbols = isUnicodeSupported() ? main : fallback;
627
628
  var log_symbols_default = logSymbols;
628
629
 
629
630
  // package.json
630
- var version = "9.1.1";
631
+ var version = "9.2.1";
631
632
 
632
633
  // src/version-bump.ts
634
+ var import_node_process5 = __toESM(require("process"));
633
635
  var ezSpawn3 = __toESM(require("@jsdevtools/ez-spawn"));
634
636
  var import_picocolors2 = __toESM(require_picocolors());
635
637
  var import_prompts2 = __toESM(require("prompts"));
636
638
 
637
639
  // src/get-new-version.ts
640
+ var import_node_process3 = __toESM(require("process"));
638
641
  var import_picocolors = __toESM(require_picocolors());
639
642
  var import_prompts = __toESM(require("prompts"));
640
643
  var import_semver2 = __toESM(require("semver"));
@@ -689,21 +692,26 @@ function getNextVersions(oldVersion, preid) {
689
692
  return next;
690
693
  }
691
694
  async function promptForNewVersion(operation) {
695
+ var _a, _b;
692
696
  const { oldVersion } = operation.state;
693
697
  const release = operation.options.release;
694
698
  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));
695
700
  const PADDING = 13;
696
701
  const answers = await (0, import_prompts.default)([
697
702
  {
698
703
  type: "autocomplete",
699
704
  name: "release",
700
705
  message: `Current version ${import_picocolors.default.green(oldVersion)}`,
701
- initial: "next",
706
+ initial: configCustomVersion ? "config" : "next",
702
707
  choices: [
703
708
  { value: "major", title: `${"major".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.major)}` },
704
709
  { value: "minor", title: `${"minor".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.minor)}` },
705
710
  { value: "patch", title: `${"patch".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.patch)}` },
706
711
  { value: "next", title: `${"next".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.next)}` },
712
+ ...configCustomVersion ? [
713
+ { value: "config", title: `${"from config".padStart(PADDING, " ")} ${import_picocolors.default.bold(configCustomVersion)}` }
714
+ ] : [],
707
715
  { value: "prepatch", title: `${"pre-patch".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.prepatch)}` },
708
716
  { value: "preminor", title: `${"pre-minor".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.preminor)}` },
709
717
  { value: "premajor", title: `${"pre-major".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.premajor)}` },
@@ -721,11 +729,12 @@ async function promptForNewVersion(operation) {
721
729
  }
722
730
  }
723
731
  ]);
724
- const newVersion = answers.release === "none" ? oldVersion : answers.release === "custom" ? (0, import_semver2.clean)(answers.custom) : next[answers.release];
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];
725
733
  if (!newVersion)
726
- process.exit(1);
734
+ import_node_process3.default.exit(1);
727
735
  switch (answers.release) {
728
736
  case "custom":
737
+ case "config":
729
738
  case "next":
730
739
  case "none":
731
740
  return operation.update({ newVersion });
@@ -841,7 +850,7 @@ function detectIndent(string) {
841
850
  };
842
851
  }
843
852
 
844
- // node_modules/.pnpm/detect-newline@4.0.0/node_modules/detect-newline/index.js
853
+ // node_modules/.pnpm/detect-newline@4.0.1/node_modules/detect-newline/index.js
845
854
  function detectNewline(string) {
846
855
  if (typeof string !== "string") {
847
856
  throw new TypeError("Expected a string");
@@ -991,6 +1000,7 @@ function formatVersionString(template, newVersion) {
991
1000
  }
992
1001
 
993
1002
  // src/normalize-options.ts
1003
+ var import_node_process4 = __toESM(require("process"));
994
1004
  var import_fast_glob = __toESM(require("fast-glob"));
995
1005
  async function normalizeOptions(raw) {
996
1006
  var _a;
@@ -998,7 +1008,7 @@ async function normalizeOptions(raw) {
998
1008
  const push = Boolean(raw.push);
999
1009
  const all = Boolean(raw.all);
1000
1010
  const noVerify = Boolean(raw.noVerify);
1001
- const cwd = raw.cwd || process.cwd();
1011
+ const cwd = raw.cwd || import_node_process4.default.cwd();
1002
1012
  const ignoreScripts = Boolean(raw.ignoreScripts);
1003
1013
  const execute = raw.execute;
1004
1014
  let release;
@@ -1032,22 +1042,33 @@ async function normalizeOptions(raw) {
1032
1042
  if (raw.interface === false) {
1033
1043
  ui = { input: false, output: false };
1034
1044
  } else if (raw.interface === true || !raw.interface) {
1035
- ui = { input: process.stdin, output: process.stdout };
1045
+ ui = { input: import_node_process4.default.stdin, output: import_node_process4.default.stdout };
1036
1046
  } else {
1037
1047
  let _b = raw.interface, { input, output } = _b, other = __objRest(_b, ["input", "output"]);
1038
1048
  if (input === true || input !== false && !input)
1039
- input = process.stdin;
1049
+ input = import_node_process4.default.stdin;
1040
1050
  if (output === true || output !== false && !output)
1041
- output = process.stdout;
1051
+ output = import_node_process4.default.stdout;
1042
1052
  ui = __spreadValues({ input, output }, other);
1043
1053
  }
1044
1054
  if (release.type === "prompt" && !(ui.input && ui.output))
1045
1055
  throw new Error("Cannot prompt for the version number because input or output has been disabled.");
1046
- return { release, commit, tag, push, files, cwd, interface: ui, ignoreScripts, execute };
1056
+ return {
1057
+ release,
1058
+ commit,
1059
+ tag,
1060
+ push,
1061
+ files,
1062
+ cwd,
1063
+ interface: ui,
1064
+ ignoreScripts,
1065
+ execute,
1066
+ customVersion: raw.customVersion
1067
+ };
1047
1068
  }
1048
1069
 
1049
1070
  // src/operation.ts
1050
- var Operation = class {
1071
+ var Operation = class _Operation {
1051
1072
  /**
1052
1073
  * Private constructor. Use the `Operation.start()` static method instead.
1053
1074
  */
@@ -1089,7 +1110,7 @@ var Operation = class {
1089
1110
  */
1090
1111
  static async start(input) {
1091
1112
  const options = await normalizeOptions(input);
1092
- return new Operation(options, input.progress);
1113
+ return new _Operation(options, input.progress);
1093
1114
  }
1094
1115
  /**
1095
1116
  * Updates the operation state and results, and reports the updated progress to the user.
@@ -1198,7 +1219,7 @@ async function versionBump(arg = {}) {
1198
1219
  message: "Bump?",
1199
1220
  initial: true
1200
1221
  }).then((r) => r.yes))
1201
- process.exit(1);
1222
+ import_node_process5.default.exit(1);
1202
1223
  }
1203
1224
  await runNpmScript("preversion" /* PreVersion */, operation);
1204
1225
  await updateFiles(operation);
@@ -1232,11 +1253,13 @@ function printSummary(operation) {
1232
1253
  }
1233
1254
 
1234
1255
  // src/cli/parse-args.ts
1256
+ var import_node_process7 = __toESM(require("process"));
1235
1257
  var import_semver4 = require("semver");
1236
1258
  var import_cac = __toESM(require("cac"));
1237
1259
  var import_picocolors3 = __toESM(require_picocolors());
1238
1260
 
1239
1261
  // src/config.ts
1262
+ var import_node_process6 = __toESM(require("process"));
1240
1263
  var import_c12 = require("c12");
1241
1264
  var bumpConfigDefaults = {
1242
1265
  commit: true,
@@ -1249,7 +1272,7 @@ var bumpConfigDefaults = {
1249
1272
  all: false,
1250
1273
  files: []
1251
1274
  };
1252
- async function loadBumpConfig(overrides, cwd = process.cwd()) {
1275
+ async function loadBumpConfig(overrides, cwd = import_node_process6.default.cwd()) {
1253
1276
  const { config } = await (0, import_c12.loadConfig)({
1254
1277
  name: "bump",
1255
1278
  defaults: bumpConfigDefaults,
@@ -1264,7 +1287,7 @@ async function parseArgs() {
1264
1287
  var _a;
1265
1288
  try {
1266
1289
  const cli = (0, import_cac.default)("bumpp");
1267
- 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("-t, --tag [tag]", `Tag name (default: ${bumpConfigDefaults.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();
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();
1268
1291
  const result = cli.parse();
1269
1292
  const args = result.options;
1270
1293
  const parsedArgs = {
@@ -1273,8 +1296,8 @@ async function parseArgs() {
1273
1296
  quiet: args.quiet,
1274
1297
  options: await loadBumpConfig({
1275
1298
  preid: args.preid,
1276
- commit: args.commit,
1277
- tag: args.tag,
1299
+ commit: !args.noCommit && args.commit,
1300
+ tag: !args.noTag && args.tag,
1278
1301
  push: args.push,
1279
1302
  all: args.all,
1280
1303
  confirm: !args.yes,
@@ -1305,20 +1328,20 @@ async function parseArgs() {
1305
1328
  }
1306
1329
  function errorHandler(error) {
1307
1330
  console.error(error.message);
1308
- return process.exit(9 /* InvalidArgument */);
1331
+ return import_node_process7.default.exit(9 /* InvalidArgument */);
1309
1332
  }
1310
1333
 
1311
1334
  // src/cli/index.ts
1312
1335
  async function main2() {
1313
1336
  try {
1314
- process.on("uncaughtException", errorHandler2);
1315
- process.on("unhandledRejection", errorHandler2);
1337
+ import_node_process8.default.on("uncaughtException", errorHandler2);
1338
+ import_node_process8.default.on("unhandledRejection", errorHandler2);
1316
1339
  const { help, version: version2, quiet, options } = await parseArgs();
1317
1340
  if (help) {
1318
- process.exit(0 /* Success */);
1341
+ import_node_process8.default.exit(0 /* Success */);
1319
1342
  } else if (version2) {
1320
1343
  console.log(version);
1321
- process.exit(0 /* Success */);
1344
+ import_node_process8.default.exit(0 /* Success */);
1322
1345
  } else {
1323
1346
  if (!quiet)
1324
1347
  options.progress = options.progress ? options.progress : progress;
@@ -1352,10 +1375,10 @@ function progress({ event, script, updatedFiles, skippedFiles, newVersion }) {
1352
1375
  }
1353
1376
  function errorHandler2(error) {
1354
1377
  let message = error.message || String(error);
1355
- if (process.env.DEBUG || process.env.NODE_ENV === "development")
1378
+ if (import_node_process8.default.env.DEBUG || import_node_process8.default.env.NODE_ENV === "development")
1356
1379
  message = error.stack || message;
1357
1380
  console.error(message);
1358
- process.exit(1 /* FatalError */);
1381
+ import_node_process8.default.exit(1 /* FatalError */);
1359
1382
  }
1360
1383
  // Annotate the CommonJS export names for ESM import in node:
1361
1384
  0 && (module.exports = {
@@ -6,20 +6,24 @@ import {
6
6
  log_symbols_default,
7
7
  require_picocolors,
8
8
  versionBump
9
- } from "../chunk-L3LY4KGC.mjs";
9
+ } from "../chunk-D4MB64LD.mjs";
10
+
11
+ // src/cli/index.ts
12
+ import process2 from "process";
10
13
 
11
14
  // package.json
12
- var version = "9.1.1";
15
+ var version = "9.2.1";
13
16
 
14
17
  // src/cli/parse-args.ts
15
18
  var import_picocolors = __toESM(require_picocolors());
19
+ import process from "process";
16
20
  import { valid as isValidVersion } from "semver";
17
21
  import cac from "cac";
18
22
  async function parseArgs() {
19
23
  var _a;
20
24
  try {
21
25
  const cli = cac("bumpp");
22
- 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("-t, --tag [tag]", `Tag name (default: ${bumpConfigDefaults.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();
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();
23
27
  const result = cli.parse();
24
28
  const args = result.options;
25
29
  const parsedArgs = {
@@ -28,8 +32,8 @@ async function parseArgs() {
28
32
  quiet: args.quiet,
29
33
  options: await loadBumpConfig({
30
34
  preid: args.preid,
31
- commit: args.commit,
32
- tag: args.tag,
35
+ commit: !args.noCommit && args.commit,
36
+ tag: !args.noTag && args.tag,
33
37
  push: args.push,
34
38
  all: args.all,
35
39
  confirm: !args.yes,
@@ -66,14 +70,14 @@ function errorHandler(error) {
66
70
  // src/cli/index.ts
67
71
  async function main() {
68
72
  try {
69
- process.on("uncaughtException", errorHandler2);
70
- process.on("unhandledRejection", errorHandler2);
73
+ process2.on("uncaughtException", errorHandler2);
74
+ process2.on("unhandledRejection", errorHandler2);
71
75
  const { help, version: version2, quiet, options } = await parseArgs();
72
76
  if (help) {
73
- process.exit(0 /* Success */);
77
+ process2.exit(0 /* Success */);
74
78
  } else if (version2) {
75
79
  console.log(version);
76
- process.exit(0 /* Success */);
80
+ process2.exit(0 /* Success */);
77
81
  } else {
78
82
  if (!quiet)
79
83
  options.progress = options.progress ? options.progress : progress;
@@ -107,10 +111,10 @@ function progress({ event, script, updatedFiles, skippedFiles, newVersion }) {
107
111
  }
108
112
  function errorHandler2(error) {
109
113
  let message = error.message || String(error);
110
- if (process.env.DEBUG || process.env.NODE_ENV === "development")
114
+ if (process2.env.DEBUG || process2.env.NODE_ENV === "development")
111
115
  message = error.stack || message;
112
116
  console.error(message);
113
- process.exit(1 /* FatalError */);
117
+ process2.exit(1 /* FatalError */);
114
118
  }
115
119
  export {
116
120
  main
@@ -0,0 +1,347 @@
1
+ import _semver, { ReleaseType } from 'semver';
2
+ export { ReleaseType } from 'semver';
3
+
4
+ /**
5
+ * Information about the work that was performed by the `versionBump()` function.
6
+ */
7
+ interface VersionBumpResults {
8
+ /**
9
+ * The release type that was used, or `undefined` if an explicit version number was used.
10
+ */
11
+ release?: ReleaseType;
12
+ /**
13
+ * The previous version number in package.json.
14
+ */
15
+ oldVersion: string;
16
+ /**
17
+ * The new version number.
18
+ */
19
+ newVersion: string;
20
+ /**
21
+ * The commit message that was used for the git commit, or `false` if no git commit was created.
22
+ *
23
+ * NOTE: This will never be an empty string. It will always contain at least the new version number.
24
+ */
25
+ commit: string | false;
26
+ /**
27
+ * The tag name that was used for the git tag, or `false` if no git tag was created.
28
+ *
29
+ * NOTE: This will never be an empty string. It will always contain at least the new version number.
30
+ */
31
+ tag: string | false;
32
+ /**
33
+ * The files that were actually modified.
34
+ */
35
+ updatedFiles: string[];
36
+ /**
37
+ * The files that were not updated because they did not contain the old version number.
38
+ */
39
+ skippedFiles: string[];
40
+ }
41
+
42
+ /**
43
+ * Progress events that indicate the progress of the `versionBump()` function.
44
+ */
45
+ declare const enum ProgressEvent {
46
+ FileUpdated = "file updated",
47
+ FileSkipped = "file skipped",
48
+ GitCommit = "git commit",
49
+ GitTag = "git tag",
50
+ GitPush = "git push",
51
+ NpmScript = "npm script"
52
+ }
53
+ /**
54
+ * The NPM version scripts
55
+ *
56
+ * @see https://docs.npmjs.com/cli/version.html
57
+ */
58
+ declare const enum NpmScript {
59
+ PreVersion = "preversion",
60
+ Version = "version",
61
+ PostVersion = "postversion"
62
+ }
63
+ /**
64
+ * Information about the progress of the `versionBump()` function.
65
+ */
66
+ interface VersionBumpProgress extends VersionBumpResults {
67
+ event: ProgressEvent;
68
+ script?: NpmScript;
69
+ }
70
+
71
+ /**
72
+ * Options for the `versionBump()` function.
73
+ */
74
+ interface VersionBumpOptions {
75
+ /**
76
+ * The release version or type. Can be one of the following:
77
+ *
78
+ * - The new version number (e.g. "1.23.456")
79
+ * - A release type (e.g. "major", "minor", "patch", "prerelease", etc.)
80
+ * - "prompt" to prompt the user for the version number
81
+ *
82
+ * Defaults to "prompt".
83
+ */
84
+ release?: string;
85
+ /**
86
+ * The prerelease type (e.g. "alpha", "beta", "next").
87
+ *
88
+ * Defaults to "beta".
89
+ */
90
+ preid?: string;
91
+ /**
92
+ * Indicates whether to create a git commit. Can be set to a custom commit message string
93
+ * or `true` to use "release v". Any `%s` placeholders in the message string will be replaced
94
+ * with the new version number. If the message string does _not_ contain any `%s` placeholders,
95
+ * then the new version number will be appended to the message.
96
+ *
97
+ * Defaults to `false`.
98
+ */
99
+ commit?: boolean | string;
100
+ /**
101
+ * Indicates whether to tag the git commit. Can be set to a custom tag string
102
+ * or `true` to use "v". Any `%s` placeholders in the tag string will be replaced
103
+ * with the new version number. If the tag string does _not_ contain any `%s` placeholders,
104
+ * then the new version number will be appended to the tag.
105
+ *
106
+ * Defaults to `false`.
107
+ */
108
+ tag?: boolean | string;
109
+ /**
110
+ * Indicates whether to push the git commit and tag.
111
+ *
112
+ * Defaults to `false`.
113
+ */
114
+ push?: boolean;
115
+ /**
116
+ * Indicates whether the git commit should include ALL files (`git commit --all`)
117
+ * rather than just the files that were modified by `versionBump()`.
118
+ *
119
+ * Defaults to `false`.
120
+ */
121
+ all?: boolean;
122
+ /**
123
+ * Prompt for confirmation
124
+ *
125
+ * @default false
126
+ */
127
+ confirm?: boolean;
128
+ /**
129
+ * Indicates whether to bypass git commit hooks (`git commit --no-verify`).
130
+ *
131
+ * Defaults to `false`.
132
+ */
133
+ noVerify?: boolean;
134
+ /**
135
+ * The files to be updated. For certain known files ("package.json", "bower.json", etc.)
136
+ * `versionBump()` will explicitly update the file's version number. For other files
137
+ * (ReadMe files, config files, source code, etc.) it will simply do a global replacement
138
+ * of the old version number with the new version number.
139
+ *
140
+ * Defaults to ["package.json", "package-lock.json"]
141
+ */
142
+ files?: string[];
143
+ /**
144
+ * The working directory, which is used as the basis for locating all files.
145
+ *
146
+ * Defaults to `process.cwd()`
147
+ */
148
+ cwd?: string;
149
+ /**
150
+ * Options for the command-line interface. Can be one of the following:
151
+ *
152
+ * - `true` - To default to `process.stdin` and `process.stdout`.
153
+ * - `false` - To disable all CLI output. Cannot be used when `release` is "prompt".
154
+ * - An object that will be passed to `readline.createInterface()`.
155
+ *
156
+ * Defaults to `true`.
157
+ */
158
+ interface?: boolean | InterfaceOptions;
159
+ /**
160
+ * Indicates whether to ignore version scripts.
161
+ *
162
+ * Defaults to `false`.
163
+ */
164
+ ignoreScripts?: boolean;
165
+ /**
166
+ * A callback that is provides information about the progress of the `versionBump()` function.
167
+ */
168
+ progress?(progress: VersionBumpProgress): void;
169
+ /**
170
+ * Excute additional command after bumping and before commiting
171
+ */
172
+ execute?: string;
173
+ /**
174
+ * Bump the files recursively for monorepo. Only works without `files` option.
175
+ *
176
+ * @default false
177
+ */
178
+ recursive?: boolean;
179
+ /**
180
+ * Custom function to provide the version number
181
+ */
182
+ customVersion?: (currentVersion: string, semver: typeof _semver) => Promise<string | void> | string | void;
183
+ }
184
+ /**
185
+ * Options for the command-line interface.
186
+ */
187
+ interface InterfaceOptions {
188
+ /**
189
+ * The stream that will be used to read user input. Can be one of the following:
190
+ *
191
+ * - `true` - To default to `process.stdin`
192
+ * - `false` - To disable all CLI input
193
+ * - Any readable stream
194
+ *
195
+ * Defaults to `true`.
196
+ */
197
+ input?: NodeJS.ReadableStream | NodeJS.ReadStream | boolean;
198
+ /**
199
+ * The stream that will be used to write output, such as prompts and progress.
200
+ * Can be one of the following:
201
+ *
202
+ * - `true` - To default to `process.stdout`
203
+ * - `false` - To disable all CLI output
204
+ * - Any writable stream
205
+ *
206
+ * Defaults to `true`.
207
+ */
208
+ output?: NodeJS.WritableStream | NodeJS.WriteStream | boolean;
209
+ /**
210
+ * Any other properties will be passed directly to `readline.createInterface()`.
211
+ * See the `ReadLineOptions` interface for possible options.
212
+ */
213
+ [key: string]: unknown;
214
+ }
215
+
216
+ interface Interface {
217
+ input?: NodeJS.ReadableStream | NodeJS.ReadStream | false;
218
+ output?: NodeJS.WritableStream | NodeJS.WriteStream | false;
219
+ [key: string]: unknown;
220
+ }
221
+ /**
222
+ * A specific version release.
223
+ */
224
+ interface VersionRelease {
225
+ type: 'version';
226
+ version: string;
227
+ }
228
+ /**
229
+ * Prompt the user for the release number.
230
+ */
231
+ interface PromptRelease {
232
+ type: 'prompt';
233
+ preid: string;
234
+ }
235
+ /**
236
+ * A bump release, relative to the current version number.
237
+ */
238
+ interface BumpRelease {
239
+ type: ReleaseType;
240
+ preid: string;
241
+ }
242
+ /**
243
+ * One of the possible Release types.
244
+ */
245
+ type Release = VersionRelease | PromptRelease | BumpRelease;
246
+ /**
247
+ * Normalized and sanitized options
248
+ */
249
+ interface NormalizedOptions {
250
+ release: Release;
251
+ commit?: {
252
+ message: string;
253
+ noVerify: boolean;
254
+ all: boolean;
255
+ };
256
+ tag?: {
257
+ name: string;
258
+ };
259
+ push: boolean;
260
+ files: string[];
261
+ cwd: string;
262
+ interface: Interface;
263
+ ignoreScripts: boolean;
264
+ execute?: string;
265
+ customVersion?: VersionBumpOptions['customVersion'];
266
+ }
267
+
268
+ interface OperationState {
269
+ release: ReleaseType | undefined;
270
+ oldVersionSource: string;
271
+ oldVersion: string;
272
+ newVersion: string;
273
+ commitMessage: string;
274
+ tagName: string;
275
+ updatedFiles: string[];
276
+ skippedFiles: string[];
277
+ }
278
+ interface UpdateOperationState extends Partial<OperationState> {
279
+ event?: ProgressEvent;
280
+ script?: NpmScript;
281
+ }
282
+ /**
283
+ * All of the inputs, outputs, and state of a single `versionBump()` call.
284
+ */
285
+ declare class Operation {
286
+ /**
287
+ * The options for this operation.
288
+ */
289
+ options: NormalizedOptions;
290
+ /**
291
+ * The current state of the operation.
292
+ */
293
+ readonly state: Readonly<OperationState>;
294
+ /**
295
+ * The results of the operation.
296
+ */
297
+ get results(): VersionBumpResults;
298
+ /**
299
+ * The callback that's used to report the progress of the operation.
300
+ */
301
+ private readonly _progress?;
302
+ /**
303
+ * Private constructor. Use the `Operation.start()` static method instead.
304
+ */
305
+ private constructor();
306
+ /**
307
+ * Starts a new `versionBump()` operation.
308
+ */
309
+ static start(input: VersionBumpOptions): Promise<Operation>;
310
+ /**
311
+ * Updates the operation state and results, and reports the updated progress to the user.
312
+ */
313
+ update({ event, script, ...newState }: UpdateOperationState): this;
314
+ }
315
+
316
+ /**
317
+ * Prompts the user for a version number and updates package.json and package-lock.json.
318
+ *
319
+ * @returns - The new version number
320
+ */
321
+ declare function versionBump(): Promise<VersionBumpResults>;
322
+ /**
323
+ * Bumps the version number in package.json, package-lock.json.
324
+ *
325
+ * @param release
326
+ * The release version or type. Can be one of the following:
327
+ *
328
+ * - The new version number (e.g. "1.23.456")
329
+ * - A release type (e.g. "major", "minor", "patch", "prerelease", etc.)
330
+ * - "prompt" to prompt the user for the version number
331
+ */
332
+ declare function versionBump(release: string): Promise<VersionBumpResults>;
333
+ /**
334
+ * Bumps the version number in one or more files, prompting the user if necessary.
335
+ * Optionally also commits, tags, and pushes to git.
336
+ */
337
+ declare function versionBump(options: VersionBumpOptions): Promise<VersionBumpResults>;
338
+ /**
339
+ * Bumps the version number in one or more files, prompting users if necessary.
340
+ */
341
+ declare function versionBumpInfo(arg?: VersionBumpOptions | string): Promise<Operation>;
342
+
343
+ declare const bumpConfigDefaults: VersionBumpOptions;
344
+ declare function loadBumpConfig(overrides?: Partial<VersionBumpOptions>, cwd?: string): Promise<VersionBumpOptions>;
345
+ declare function defineConfig(config: Partial<VersionBumpOptions>): Partial<VersionBumpOptions>;
346
+
347
+ export { type InterfaceOptions, NpmScript, ProgressEvent, type VersionBumpOptions, type VersionBumpProgress, type VersionBumpResults, bumpConfigDefaults, versionBump as default, defineConfig, loadBumpConfig, versionBump, versionBumpInfo };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ReleaseType } from 'semver';
1
+ import _semver, { ReleaseType } from 'semver';
2
2
  export { ReleaseType } from 'semver';
3
3
 
4
4
  /**
@@ -176,6 +176,10 @@ interface VersionBumpOptions {
176
176
  * @default false
177
177
  */
178
178
  recursive?: boolean;
179
+ /**
180
+ * Custom function to provide the version number
181
+ */
182
+ customVersion?: (currentVersion: string, semver: typeof _semver) => Promise<string | void> | string | void;
179
183
  }
180
184
  /**
181
185
  * Options for the command-line interface.
@@ -258,6 +262,7 @@ interface NormalizedOptions {
258
262
  interface: Interface;
259
263
  ignoreScripts: boolean;
260
264
  execute?: string;
265
+ customVersion?: VersionBumpOptions['customVersion'];
261
266
  }
262
267
 
263
268
  interface OperationState {
@@ -339,4 +344,4 @@ declare const bumpConfigDefaults: VersionBumpOptions;
339
344
  declare function loadBumpConfig(overrides?: Partial<VersionBumpOptions>, cwd?: string): Promise<VersionBumpOptions>;
340
345
  declare function defineConfig(config: Partial<VersionBumpOptions>): Partial<VersionBumpOptions>;
341
346
 
342
- export { InterfaceOptions, NpmScript, ProgressEvent, VersionBumpOptions, VersionBumpProgress, VersionBumpResults, bumpConfigDefaults, versionBump as default, defineConfig, loadBumpConfig, versionBump, versionBumpInfo };
347
+ export { type InterfaceOptions, NpmScript, ProgressEvent, type VersionBumpOptions, type VersionBumpProgress, type VersionBumpResults, bumpConfigDefaults, versionBump as default, defineConfig, loadBumpConfig, versionBump, versionBumpInfo };
package/dist/index.js CHANGED
@@ -123,10 +123,11 @@ __export(src_exports, {
123
123
  module.exports = __toCommonJS(src_exports);
124
124
 
125
125
  // src/version-bump.ts
126
+ var import_node_process5 = __toESM(require("process"));
126
127
  var ezSpawn3 = __toESM(require("@jsdevtools/ez-spawn"));
127
128
  var import_picocolors2 = __toESM(require_picocolors());
128
129
 
129
- // node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/vendor/ansi-styles/index.js
130
+ // node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/ansi-styles/index.js
130
131
  var ANSI_BACKGROUND_OFFSET = 10;
131
132
  var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
132
133
  var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
@@ -312,7 +313,7 @@ function assembleStyles() {
312
313
  var ansiStyles = assembleStyles();
313
314
  var ansi_styles_default = ansiStyles;
314
315
 
315
- // node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/vendor/supports-color/index.js
316
+ // node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/supports-color/index.js
316
317
  var import_node_process = __toESM(require("process"), 1);
317
318
  var import_node_os = __toESM(require("os"), 1);
318
319
  var import_node_tty = __toESM(require("tty"), 1);
@@ -386,7 +387,7 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
386
387
  return 1;
387
388
  }
388
389
  if ("CI" in env) {
389
- if ("GITHUB_ACTIONS" in env) {
390
+ if ("GITHUB_ACTIONS" in env || "GITEA_ACTIONS" in env) {
390
391
  return 3;
391
392
  }
392
393
  if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
@@ -437,7 +438,7 @@ var supportsColor = {
437
438
  };
438
439
  var supports_color_default = supportsColor;
439
440
 
440
- // node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/utilities.js
441
+ // node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/utilities.js
441
442
  function stringReplaceAll(string, substring, replacer) {
442
443
  let index = string.indexOf(substring);
443
444
  if (index === -1) {
@@ -467,7 +468,7 @@ function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
467
468
  return returnValue;
468
469
  }
469
470
 
470
- // node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/index.js
471
+ // node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/index.js
471
472
  var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
472
473
  var GENERATOR = Symbol("GENERATOR");
473
474
  var STYLER = Symbol("STYLER");
@@ -622,7 +623,7 @@ function isUnicodeSupported() {
622
623
  return Boolean(import_node_process2.default.env.CI) || Boolean(import_node_process2.default.env.WT_SESSION) || Boolean(import_node_process2.default.env.TERMINUS_SUBLIME) || import_node_process2.default.env.ConEmuTask === "{cmd::Cmder}" || import_node_process2.default.env.TERM_PROGRAM === "Terminus-Sublime" || import_node_process2.default.env.TERM_PROGRAM === "vscode" || import_node_process2.default.env.TERM === "xterm-256color" || import_node_process2.default.env.TERM === "alacritty" || import_node_process2.default.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
623
624
  }
624
625
 
625
- // node_modules/.pnpm/log-symbols@5.1.0/node_modules/log-symbols/index.js
626
+ // node_modules/.pnpm/log-symbols@6.0.0/node_modules/log-symbols/index.js
626
627
  var main = {
627
628
  info: source_default.blue("\u2139"),
628
629
  success: source_default.green("\u2714"),
@@ -642,6 +643,7 @@ var log_symbols_default = logSymbols;
642
643
  var import_prompts2 = __toESM(require("prompts"));
643
644
 
644
645
  // src/get-new-version.ts
646
+ var import_node_process3 = __toESM(require("process"));
645
647
  var import_picocolors = __toESM(require_picocolors());
646
648
  var import_prompts = __toESM(require("prompts"));
647
649
  var import_semver2 = __toESM(require("semver"));
@@ -696,21 +698,26 @@ function getNextVersions(oldVersion, preid) {
696
698
  return next;
697
699
  }
698
700
  async function promptForNewVersion(operation) {
701
+ var _a, _b;
699
702
  const { oldVersion } = operation.state;
700
703
  const release = operation.options.release;
701
704
  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));
702
706
  const PADDING = 13;
703
707
  const answers = await (0, import_prompts.default)([
704
708
  {
705
709
  type: "autocomplete",
706
710
  name: "release",
707
711
  message: `Current version ${import_picocolors.default.green(oldVersion)}`,
708
- initial: "next",
712
+ initial: configCustomVersion ? "config" : "next",
709
713
  choices: [
710
714
  { value: "major", title: `${"major".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.major)}` },
711
715
  { value: "minor", title: `${"minor".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.minor)}` },
712
716
  { value: "patch", title: `${"patch".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.patch)}` },
713
717
  { value: "next", title: `${"next".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.next)}` },
718
+ ...configCustomVersion ? [
719
+ { value: "config", title: `${"from config".padStart(PADDING, " ")} ${import_picocolors.default.bold(configCustomVersion)}` }
720
+ ] : [],
714
721
  { value: "prepatch", title: `${"pre-patch".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.prepatch)}` },
715
722
  { value: "preminor", title: `${"pre-minor".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.preminor)}` },
716
723
  { value: "premajor", title: `${"pre-major".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.premajor)}` },
@@ -728,11 +735,12 @@ async function promptForNewVersion(operation) {
728
735
  }
729
736
  }
730
737
  ]);
731
- const newVersion = answers.release === "none" ? oldVersion : answers.release === "custom" ? (0, import_semver2.clean)(answers.custom) : next[answers.release];
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];
732
739
  if (!newVersion)
733
- process.exit(1);
740
+ import_node_process3.default.exit(1);
734
741
  switch (answers.release) {
735
742
  case "custom":
743
+ case "config":
736
744
  case "next":
737
745
  case "none":
738
746
  return operation.update({ newVersion });
@@ -848,7 +856,7 @@ function detectIndent(string) {
848
856
  };
849
857
  }
850
858
 
851
- // node_modules/.pnpm/detect-newline@4.0.0/node_modules/detect-newline/index.js
859
+ // node_modules/.pnpm/detect-newline@4.0.1/node_modules/detect-newline/index.js
852
860
  function detectNewline(string) {
853
861
  if (typeof string !== "string") {
854
862
  throw new TypeError("Expected a string");
@@ -1017,6 +1025,7 @@ function formatVersionString(template, newVersion) {
1017
1025
  }
1018
1026
 
1019
1027
  // src/normalize-options.ts
1028
+ var import_node_process4 = __toESM(require("process"));
1020
1029
  var import_fast_glob = __toESM(require("fast-glob"));
1021
1030
  async function normalizeOptions(raw) {
1022
1031
  var _a;
@@ -1024,7 +1033,7 @@ async function normalizeOptions(raw) {
1024
1033
  const push = Boolean(raw.push);
1025
1034
  const all = Boolean(raw.all);
1026
1035
  const noVerify = Boolean(raw.noVerify);
1027
- const cwd = raw.cwd || process.cwd();
1036
+ const cwd = raw.cwd || import_node_process4.default.cwd();
1028
1037
  const ignoreScripts = Boolean(raw.ignoreScripts);
1029
1038
  const execute = raw.execute;
1030
1039
  let release;
@@ -1058,22 +1067,33 @@ async function normalizeOptions(raw) {
1058
1067
  if (raw.interface === false) {
1059
1068
  ui = { input: false, output: false };
1060
1069
  } else if (raw.interface === true || !raw.interface) {
1061
- ui = { input: process.stdin, output: process.stdout };
1070
+ ui = { input: import_node_process4.default.stdin, output: import_node_process4.default.stdout };
1062
1071
  } else {
1063
1072
  let _b = raw.interface, { input, output } = _b, other = __objRest(_b, ["input", "output"]);
1064
1073
  if (input === true || input !== false && !input)
1065
- input = process.stdin;
1074
+ input = import_node_process4.default.stdin;
1066
1075
  if (output === true || output !== false && !output)
1067
- output = process.stdout;
1076
+ output = import_node_process4.default.stdout;
1068
1077
  ui = __spreadValues({ input, output }, other);
1069
1078
  }
1070
1079
  if (release.type === "prompt" && !(ui.input && ui.output))
1071
1080
  throw new Error("Cannot prompt for the version number because input or output has been disabled.");
1072
- return { release, commit, tag, push, files, cwd, interface: ui, ignoreScripts, execute };
1081
+ return {
1082
+ release,
1083
+ commit,
1084
+ tag,
1085
+ push,
1086
+ files,
1087
+ cwd,
1088
+ interface: ui,
1089
+ ignoreScripts,
1090
+ execute,
1091
+ customVersion: raw.customVersion
1092
+ };
1073
1093
  }
1074
1094
 
1075
1095
  // src/operation.ts
1076
- var Operation = class {
1096
+ var Operation = class _Operation {
1077
1097
  /**
1078
1098
  * Private constructor. Use the `Operation.start()` static method instead.
1079
1099
  */
@@ -1115,7 +1135,7 @@ var Operation = class {
1115
1135
  */
1116
1136
  static async start(input) {
1117
1137
  const options = await normalizeOptions(input);
1118
- return new Operation(options, input.progress);
1138
+ return new _Operation(options, input.progress);
1119
1139
  }
1120
1140
  /**
1121
1141
  * Updates the operation state and results, and reports the updated progress to the user.
@@ -1224,7 +1244,7 @@ async function versionBump(arg = {}) {
1224
1244
  message: "Bump?",
1225
1245
  initial: true
1226
1246
  }).then((r) => r.yes))
1227
- process.exit(1);
1247
+ import_node_process5.default.exit(1);
1228
1248
  }
1229
1249
  await runNpmScript("preversion" /* PreVersion */, operation);
1230
1250
  await updateFiles(operation);
@@ -1266,6 +1286,7 @@ async function versionBumpInfo(arg = {}) {
1266
1286
  }
1267
1287
 
1268
1288
  // src/config.ts
1289
+ var import_node_process6 = __toESM(require("process"));
1269
1290
  var import_c12 = require("c12");
1270
1291
  var bumpConfigDefaults = {
1271
1292
  commit: true,
@@ -1278,7 +1299,7 @@ var bumpConfigDefaults = {
1278
1299
  all: false,
1279
1300
  files: []
1280
1301
  };
1281
- async function loadBumpConfig(overrides, cwd = process.cwd()) {
1302
+ async function loadBumpConfig(overrides, cwd = import_node_process6.default.cwd()) {
1282
1303
  const { config } = await (0, import_c12.loadConfig)({
1283
1304
  name: "bump",
1284
1305
  defaults: bumpConfigDefaults,
package/dist/index.mjs CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  loadBumpConfig,
8
8
  versionBump,
9
9
  versionBumpInfo
10
- } from "./chunk-L3LY4KGC.mjs";
10
+ } from "./chunk-D4MB64LD.mjs";
11
11
 
12
12
  // src/index.ts
13
13
  var src_default = versionBump;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bumpp",
3
- "version": "9.1.1",
4
- "packageManager": "pnpm@8.6.0",
3
+ "version": "9.2.1",
4
+ "packageManager": "pnpm@8.12.0",
5
5
  "description": "Bump version, commit changes, tag, and push to Git",
6
6
  "author": {
7
7
  "name": "James Messinger",
@@ -28,8 +28,8 @@
28
28
  "exports": {
29
29
  ".": {
30
30
  "types": "./dist/index.d.ts",
31
- "require": "./dist/index.js",
32
- "import": "./dist/index.mjs"
31
+ "import": "./dist/index.mjs",
32
+ "require": "./dist/index.js"
33
33
  }
34
34
  },
35
35
  "main": "dist/index.js",
@@ -58,26 +58,26 @@
58
58
  },
59
59
  "dependencies": {
60
60
  "@jsdevtools/ez-spawn": "^3.0.4",
61
- "c12": "^1.4.1",
61
+ "c12": "^1.5.1",
62
62
  "cac": "^6.7.14",
63
- "fast-glob": "^3.2.12",
63
+ "fast-glob": "^3.3.2",
64
64
  "prompts": "^2.4.2",
65
- "semver": "^7.5.1"
65
+ "semver": "^7.5.4"
66
66
  },
67
67
  "devDependencies": {
68
- "@antfu/eslint-config": "^0.39.5",
69
- "@types/node": "^18.16.16",
70
- "@types/prompts": "^2.4.4",
71
- "@types/semver": "^7.5.0",
68
+ "@antfu/eslint-config": "^2.4.3",
69
+ "@types/node": "^20.10.4",
70
+ "@types/prompts": "^2.4.9",
71
+ "@types/semver": "^7.5.6",
72
72
  "detect-indent": "^7.0.1",
73
- "detect-newline": "^4.0.0",
74
- "eslint": "^8.42.0",
75
- "esno": "^0.16.3",
76
- "log-symbols": "^5.1.0",
73
+ "detect-newline": "^4.0.1",
74
+ "eslint": "^8.55.0",
75
+ "esno": "^4.0.0",
76
+ "log-symbols": "^6.0.0",
77
77
  "npm-check": "^6.0.1",
78
78
  "picocolors": "^1.0.0",
79
- "rimraf": "^5.0.1",
80
- "tsup": "^6.7.0",
81
- "typescript": "^5.1.3"
79
+ "rimraf": "^5.0.5",
80
+ "tsup": "^8.0.1",
81
+ "typescript": "^5.3.3"
82
82
  }
83
83
  }