bumpp 9.1.1 → 9.2.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.
@@ -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 = {};
@@ -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) {
@@ -730,7 +732,7 @@ async function promptForNewVersion(operation) {
730
732
  ]);
731
733
  const newVersion = answers.release === "none" ? oldVersion : answers.release === "custom" ? cleanVersion(answers.custom) : next[answers.release];
732
734
  if (!newVersion)
733
- process.exit(1);
735
+ process4.exit(1);
734
736
  switch (answers.release) {
735
737
  case "custom":
736
738
  case "next":
@@ -998,6 +1000,7 @@ function formatVersionString(template, newVersion) {
998
1000
  }
999
1001
 
1000
1002
  // src/normalize-options.ts
1003
+ import process5 from "process";
1001
1004
  import fg from "fast-glob";
1002
1005
  async function normalizeOptions(raw) {
1003
1006
  var _a;
@@ -1005,7 +1008,7 @@ async function normalizeOptions(raw) {
1005
1008
  const push = Boolean(raw.push);
1006
1009
  const all = Boolean(raw.all);
1007
1010
  const noVerify = Boolean(raw.noVerify);
1008
- const cwd = raw.cwd || process.cwd();
1011
+ const cwd = raw.cwd || process5.cwd();
1009
1012
  const ignoreScripts = Boolean(raw.ignoreScripts);
1010
1013
  const execute = raw.execute;
1011
1014
  let release;
@@ -1039,13 +1042,13 @@ async function normalizeOptions(raw) {
1039
1042
  if (raw.interface === false) {
1040
1043
  ui = { input: false, output: false };
1041
1044
  } else if (raw.interface === true || !raw.interface) {
1042
- ui = { input: process.stdin, output: process.stdout };
1045
+ ui = { input: process5.stdin, output: process5.stdout };
1043
1046
  } else {
1044
1047
  let _b = raw.interface, { input, output } = _b, other = __objRest(_b, ["input", "output"]);
1045
1048
  if (input === true || input !== false && !input)
1046
- input = process.stdin;
1049
+ input = process5.stdin;
1047
1050
  if (output === true || output !== false && !output)
1048
- output = process.stdout;
1051
+ output = process5.stdout;
1049
1052
  ui = __spreadValues({ input, output }, other);
1050
1053
  }
1051
1054
  if (release.type === "prompt" && !(ui.input && ui.output))
@@ -1054,7 +1057,7 @@ async function normalizeOptions(raw) {
1054
1057
  }
1055
1058
 
1056
1059
  // src/operation.ts
1057
- var Operation = class {
1060
+ var Operation = class _Operation {
1058
1061
  /**
1059
1062
  * Private constructor. Use the `Operation.start()` static method instead.
1060
1063
  */
@@ -1096,7 +1099,7 @@ var Operation = class {
1096
1099
  */
1097
1100
  static async start(input) {
1098
1101
  const options = await normalizeOptions(input);
1099
- return new Operation(options, input.progress);
1102
+ return new _Operation(options, input.progress);
1100
1103
  }
1101
1104
  /**
1102
1105
  * Updates the operation state and results, and reports the updated progress to the user.
@@ -1205,7 +1208,7 @@ async function versionBump(arg = {}) {
1205
1208
  message: "Bump?",
1206
1209
  initial: true
1207
1210
  }).then((r) => r.yes))
1208
- process.exit(1);
1211
+ process6.exit(1);
1209
1212
  }
1210
1213
  await runNpmScript("preversion" /* PreVersion */, operation);
1211
1214
  await updateFiles(operation);
@@ -1247,6 +1250,7 @@ async function versionBumpInfo(arg = {}) {
1247
1250
  }
1248
1251
 
1249
1252
  // src/config.ts
1253
+ import process7 from "process";
1250
1254
  import { loadConfig } from "c12";
1251
1255
  var bumpConfigDefaults = {
1252
1256
  commit: true,
@@ -1259,7 +1263,7 @@ var bumpConfigDefaults = {
1259
1263
  all: false,
1260
1264
  files: []
1261
1265
  };
1262
- async function loadBumpConfig(overrides, cwd = process.cwd()) {
1266
+ async function loadBumpConfig(overrides, cwd = process7.cwd()) {
1263
1267
  const { config } = await loadConfig({
1264
1268
  name: "bump",
1265
1269
  defaults: bumpConfigDefaults,
@@ -0,0 +1,8 @@
1
+ /**
2
+ * The main entry point of the CLI
3
+ *
4
+ * @param args - The command-line arguments (e.g. ["major", "--preid=alpha", "-ctpa"])
5
+ */
6
+ declare function main(): Promise<void>;
7
+
8
+ export { main };
package/dist/cli/index.js CHANGED
@@ -113,6 +113,7 @@ __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
118
  // node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/vendor/ansi-styles/index.js
118
119
  var ANSI_BACKGROUND_OFFSET = 10;
@@ -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.0";
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"));
@@ -723,7 +726,7 @@ async function promptForNewVersion(operation) {
723
726
  ]);
724
727
  const newVersion = answers.release === "none" ? oldVersion : answers.release === "custom" ? (0, import_semver2.clean)(answers.custom) : next[answers.release];
725
728
  if (!newVersion)
726
- process.exit(1);
729
+ import_node_process3.default.exit(1);
727
730
  switch (answers.release) {
728
731
  case "custom":
729
732
  case "next":
@@ -991,6 +994,7 @@ function formatVersionString(template, newVersion) {
991
994
  }
992
995
 
993
996
  // src/normalize-options.ts
997
+ var import_node_process4 = __toESM(require("process"));
994
998
  var import_fast_glob = __toESM(require("fast-glob"));
995
999
  async function normalizeOptions(raw) {
996
1000
  var _a;
@@ -998,7 +1002,7 @@ async function normalizeOptions(raw) {
998
1002
  const push = Boolean(raw.push);
999
1003
  const all = Boolean(raw.all);
1000
1004
  const noVerify = Boolean(raw.noVerify);
1001
- const cwd = raw.cwd || process.cwd();
1005
+ const cwd = raw.cwd || import_node_process4.default.cwd();
1002
1006
  const ignoreScripts = Boolean(raw.ignoreScripts);
1003
1007
  const execute = raw.execute;
1004
1008
  let release;
@@ -1032,13 +1036,13 @@ async function normalizeOptions(raw) {
1032
1036
  if (raw.interface === false) {
1033
1037
  ui = { input: false, output: false };
1034
1038
  } else if (raw.interface === true || !raw.interface) {
1035
- ui = { input: process.stdin, output: process.stdout };
1039
+ ui = { input: import_node_process4.default.stdin, output: import_node_process4.default.stdout };
1036
1040
  } else {
1037
1041
  let _b = raw.interface, { input, output } = _b, other = __objRest(_b, ["input", "output"]);
1038
1042
  if (input === true || input !== false && !input)
1039
- input = process.stdin;
1043
+ input = import_node_process4.default.stdin;
1040
1044
  if (output === true || output !== false && !output)
1041
- output = process.stdout;
1045
+ output = import_node_process4.default.stdout;
1042
1046
  ui = __spreadValues({ input, output }, other);
1043
1047
  }
1044
1048
  if (release.type === "prompt" && !(ui.input && ui.output))
@@ -1047,7 +1051,7 @@ async function normalizeOptions(raw) {
1047
1051
  }
1048
1052
 
1049
1053
  // src/operation.ts
1050
- var Operation = class {
1054
+ var Operation = class _Operation {
1051
1055
  /**
1052
1056
  * Private constructor. Use the `Operation.start()` static method instead.
1053
1057
  */
@@ -1089,7 +1093,7 @@ var Operation = class {
1089
1093
  */
1090
1094
  static async start(input) {
1091
1095
  const options = await normalizeOptions(input);
1092
- return new Operation(options, input.progress);
1096
+ return new _Operation(options, input.progress);
1093
1097
  }
1094
1098
  /**
1095
1099
  * Updates the operation state and results, and reports the updated progress to the user.
@@ -1198,7 +1202,7 @@ async function versionBump(arg = {}) {
1198
1202
  message: "Bump?",
1199
1203
  initial: true
1200
1204
  }).then((r) => r.yes))
1201
- process.exit(1);
1205
+ import_node_process5.default.exit(1);
1202
1206
  }
1203
1207
  await runNpmScript("preversion" /* PreVersion */, operation);
1204
1208
  await updateFiles(operation);
@@ -1232,11 +1236,13 @@ function printSummary(operation) {
1232
1236
  }
1233
1237
 
1234
1238
  // src/cli/parse-args.ts
1239
+ var import_node_process7 = __toESM(require("process"));
1235
1240
  var import_semver4 = require("semver");
1236
1241
  var import_cac = __toESM(require("cac"));
1237
1242
  var import_picocolors3 = __toESM(require_picocolors());
1238
1243
 
1239
1244
  // src/config.ts
1245
+ var import_node_process6 = __toESM(require("process"));
1240
1246
  var import_c12 = require("c12");
1241
1247
  var bumpConfigDefaults = {
1242
1248
  commit: true,
@@ -1249,7 +1255,7 @@ var bumpConfigDefaults = {
1249
1255
  all: false,
1250
1256
  files: []
1251
1257
  };
1252
- async function loadBumpConfig(overrides, cwd = process.cwd()) {
1258
+ async function loadBumpConfig(overrides, cwd = import_node_process6.default.cwd()) {
1253
1259
  const { config } = await (0, import_c12.loadConfig)({
1254
1260
  name: "bump",
1255
1261
  defaults: bumpConfigDefaults,
@@ -1264,7 +1270,7 @@ async function parseArgs() {
1264
1270
  var _a;
1265
1271
  try {
1266
1272
  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();
1273
+ 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
1274
  const result = cli.parse();
1269
1275
  const args = result.options;
1270
1276
  const parsedArgs = {
@@ -1273,8 +1279,8 @@ async function parseArgs() {
1273
1279
  quiet: args.quiet,
1274
1280
  options: await loadBumpConfig({
1275
1281
  preid: args.preid,
1276
- commit: args.commit,
1277
- tag: args.tag,
1282
+ commit: !args.noCommit && args.commit,
1283
+ tag: !args.noTag && args.tag,
1278
1284
  push: args.push,
1279
1285
  all: args.all,
1280
1286
  confirm: !args.yes,
@@ -1305,20 +1311,20 @@ async function parseArgs() {
1305
1311
  }
1306
1312
  function errorHandler(error) {
1307
1313
  console.error(error.message);
1308
- return process.exit(9 /* InvalidArgument */);
1314
+ return import_node_process7.default.exit(9 /* InvalidArgument */);
1309
1315
  }
1310
1316
 
1311
1317
  // src/cli/index.ts
1312
1318
  async function main2() {
1313
1319
  try {
1314
- process.on("uncaughtException", errorHandler2);
1315
- process.on("unhandledRejection", errorHandler2);
1320
+ import_node_process8.default.on("uncaughtException", errorHandler2);
1321
+ import_node_process8.default.on("unhandledRejection", errorHandler2);
1316
1322
  const { help, version: version2, quiet, options } = await parseArgs();
1317
1323
  if (help) {
1318
- process.exit(0 /* Success */);
1324
+ import_node_process8.default.exit(0 /* Success */);
1319
1325
  } else if (version2) {
1320
1326
  console.log(version);
1321
- process.exit(0 /* Success */);
1327
+ import_node_process8.default.exit(0 /* Success */);
1322
1328
  } else {
1323
1329
  if (!quiet)
1324
1330
  options.progress = options.progress ? options.progress : progress;
@@ -1352,10 +1358,10 @@ function progress({ event, script, updatedFiles, skippedFiles, newVersion }) {
1352
1358
  }
1353
1359
  function errorHandler2(error) {
1354
1360
  let message = error.message || String(error);
1355
- if (process.env.DEBUG || process.env.NODE_ENV === "development")
1361
+ if (import_node_process8.default.env.DEBUG || import_node_process8.default.env.NODE_ENV === "development")
1356
1362
  message = error.stack || message;
1357
1363
  console.error(message);
1358
- process.exit(1 /* FatalError */);
1364
+ import_node_process8.default.exit(1 /* FatalError */);
1359
1365
  }
1360
1366
  // Annotate the CommonJS export names for ESM import in node:
1361
1367
  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-UEJT3NCU.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.0";
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,342 @@
1
+ import { 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
+ /**
181
+ * Options for the command-line interface.
182
+ */
183
+ interface InterfaceOptions {
184
+ /**
185
+ * The stream that will be used to read user input. Can be one of the following:
186
+ *
187
+ * - `true` - To default to `process.stdin`
188
+ * - `false` - To disable all CLI input
189
+ * - Any readable stream
190
+ *
191
+ * Defaults to `true`.
192
+ */
193
+ input?: NodeJS.ReadableStream | NodeJS.ReadStream | boolean;
194
+ /**
195
+ * The stream that will be used to write output, such as prompts and progress.
196
+ * Can be one of the following:
197
+ *
198
+ * - `true` - To default to `process.stdout`
199
+ * - `false` - To disable all CLI output
200
+ * - Any writable stream
201
+ *
202
+ * Defaults to `true`.
203
+ */
204
+ output?: NodeJS.WritableStream | NodeJS.WriteStream | boolean;
205
+ /**
206
+ * Any other properties will be passed directly to `readline.createInterface()`.
207
+ * See the `ReadLineOptions` interface for possible options.
208
+ */
209
+ [key: string]: unknown;
210
+ }
211
+
212
+ interface Interface {
213
+ input?: NodeJS.ReadableStream | NodeJS.ReadStream | false;
214
+ output?: NodeJS.WritableStream | NodeJS.WriteStream | false;
215
+ [key: string]: unknown;
216
+ }
217
+ /**
218
+ * A specific version release.
219
+ */
220
+ interface VersionRelease {
221
+ type: 'version';
222
+ version: string;
223
+ }
224
+ /**
225
+ * Prompt the user for the release number.
226
+ */
227
+ interface PromptRelease {
228
+ type: 'prompt';
229
+ preid: string;
230
+ }
231
+ /**
232
+ * A bump release, relative to the current version number.
233
+ */
234
+ interface BumpRelease {
235
+ type: ReleaseType;
236
+ preid: string;
237
+ }
238
+ /**
239
+ * One of the possible Release types.
240
+ */
241
+ type Release = VersionRelease | PromptRelease | BumpRelease;
242
+ /**
243
+ * Normalized and sanitized options
244
+ */
245
+ interface NormalizedOptions {
246
+ release: Release;
247
+ commit?: {
248
+ message: string;
249
+ noVerify: boolean;
250
+ all: boolean;
251
+ };
252
+ tag?: {
253
+ name: string;
254
+ };
255
+ push: boolean;
256
+ files: string[];
257
+ cwd: string;
258
+ interface: Interface;
259
+ ignoreScripts: boolean;
260
+ execute?: string;
261
+ }
262
+
263
+ interface OperationState {
264
+ release: ReleaseType | undefined;
265
+ oldVersionSource: string;
266
+ oldVersion: string;
267
+ newVersion: string;
268
+ commitMessage: string;
269
+ tagName: string;
270
+ updatedFiles: string[];
271
+ skippedFiles: string[];
272
+ }
273
+ interface UpdateOperationState extends Partial<OperationState> {
274
+ event?: ProgressEvent;
275
+ script?: NpmScript;
276
+ }
277
+ /**
278
+ * All of the inputs, outputs, and state of a single `versionBump()` call.
279
+ */
280
+ declare class Operation {
281
+ /**
282
+ * The options for this operation.
283
+ */
284
+ options: NormalizedOptions;
285
+ /**
286
+ * The current state of the operation.
287
+ */
288
+ readonly state: Readonly<OperationState>;
289
+ /**
290
+ * The results of the operation.
291
+ */
292
+ get results(): VersionBumpResults;
293
+ /**
294
+ * The callback that's used to report the progress of the operation.
295
+ */
296
+ private readonly _progress?;
297
+ /**
298
+ * Private constructor. Use the `Operation.start()` static method instead.
299
+ */
300
+ private constructor();
301
+ /**
302
+ * Starts a new `versionBump()` operation.
303
+ */
304
+ static start(input: VersionBumpOptions): Promise<Operation>;
305
+ /**
306
+ * Updates the operation state and results, and reports the updated progress to the user.
307
+ */
308
+ update({ event, script, ...newState }: UpdateOperationState): this;
309
+ }
310
+
311
+ /**
312
+ * Prompts the user for a version number and updates package.json and package-lock.json.
313
+ *
314
+ * @returns - The new version number
315
+ */
316
+ declare function versionBump(): Promise<VersionBumpResults>;
317
+ /**
318
+ * Bumps the version number in package.json, package-lock.json.
319
+ *
320
+ * @param release
321
+ * The release version or type. Can be one of the following:
322
+ *
323
+ * - The new version number (e.g. "1.23.456")
324
+ * - A release type (e.g. "major", "minor", "patch", "prerelease", etc.)
325
+ * - "prompt" to prompt the user for the version number
326
+ */
327
+ declare function versionBump(release: string): Promise<VersionBumpResults>;
328
+ /**
329
+ * Bumps the version number in one or more files, prompting the user if necessary.
330
+ * Optionally also commits, tags, and pushes to git.
331
+ */
332
+ declare function versionBump(options: VersionBumpOptions): Promise<VersionBumpResults>;
333
+ /**
334
+ * Bumps the version number in one or more files, prompting users if necessary.
335
+ */
336
+ declare function versionBumpInfo(arg?: VersionBumpOptions | string): Promise<Operation>;
337
+
338
+ declare const bumpConfigDefaults: VersionBumpOptions;
339
+ declare function loadBumpConfig(overrides?: Partial<VersionBumpOptions>, cwd?: string): Promise<VersionBumpOptions>;
340
+ declare function defineConfig(config: Partial<VersionBumpOptions>): Partial<VersionBumpOptions>;
341
+
342
+ export { InterfaceOptions, NpmScript, ProgressEvent, VersionBumpOptions, VersionBumpProgress, VersionBumpResults, bumpConfigDefaults, versionBump as default, defineConfig, loadBumpConfig, versionBump, versionBumpInfo };
package/dist/index.js CHANGED
@@ -123,6 +123,7 @@ __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
 
@@ -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"));
@@ -730,7 +732,7 @@ async function promptForNewVersion(operation) {
730
732
  ]);
731
733
  const newVersion = answers.release === "none" ? oldVersion : answers.release === "custom" ? (0, import_semver2.clean)(answers.custom) : next[answers.release];
732
734
  if (!newVersion)
733
- process.exit(1);
735
+ import_node_process3.default.exit(1);
734
736
  switch (answers.release) {
735
737
  case "custom":
736
738
  case "next":
@@ -1017,6 +1019,7 @@ function formatVersionString(template, newVersion) {
1017
1019
  }
1018
1020
 
1019
1021
  // src/normalize-options.ts
1022
+ var import_node_process4 = __toESM(require("process"));
1020
1023
  var import_fast_glob = __toESM(require("fast-glob"));
1021
1024
  async function normalizeOptions(raw) {
1022
1025
  var _a;
@@ -1024,7 +1027,7 @@ async function normalizeOptions(raw) {
1024
1027
  const push = Boolean(raw.push);
1025
1028
  const all = Boolean(raw.all);
1026
1029
  const noVerify = Boolean(raw.noVerify);
1027
- const cwd = raw.cwd || process.cwd();
1030
+ const cwd = raw.cwd || import_node_process4.default.cwd();
1028
1031
  const ignoreScripts = Boolean(raw.ignoreScripts);
1029
1032
  const execute = raw.execute;
1030
1033
  let release;
@@ -1058,13 +1061,13 @@ async function normalizeOptions(raw) {
1058
1061
  if (raw.interface === false) {
1059
1062
  ui = { input: false, output: false };
1060
1063
  } else if (raw.interface === true || !raw.interface) {
1061
- ui = { input: process.stdin, output: process.stdout };
1064
+ ui = { input: import_node_process4.default.stdin, output: import_node_process4.default.stdout };
1062
1065
  } else {
1063
1066
  let _b = raw.interface, { input, output } = _b, other = __objRest(_b, ["input", "output"]);
1064
1067
  if (input === true || input !== false && !input)
1065
- input = process.stdin;
1068
+ input = import_node_process4.default.stdin;
1066
1069
  if (output === true || output !== false && !output)
1067
- output = process.stdout;
1070
+ output = import_node_process4.default.stdout;
1068
1071
  ui = __spreadValues({ input, output }, other);
1069
1072
  }
1070
1073
  if (release.type === "prompt" && !(ui.input && ui.output))
@@ -1073,7 +1076,7 @@ async function normalizeOptions(raw) {
1073
1076
  }
1074
1077
 
1075
1078
  // src/operation.ts
1076
- var Operation = class {
1079
+ var Operation = class _Operation {
1077
1080
  /**
1078
1081
  * Private constructor. Use the `Operation.start()` static method instead.
1079
1082
  */
@@ -1115,7 +1118,7 @@ var Operation = class {
1115
1118
  */
1116
1119
  static async start(input) {
1117
1120
  const options = await normalizeOptions(input);
1118
- return new Operation(options, input.progress);
1121
+ return new _Operation(options, input.progress);
1119
1122
  }
1120
1123
  /**
1121
1124
  * Updates the operation state and results, and reports the updated progress to the user.
@@ -1224,7 +1227,7 @@ async function versionBump(arg = {}) {
1224
1227
  message: "Bump?",
1225
1228
  initial: true
1226
1229
  }).then((r) => r.yes))
1227
- process.exit(1);
1230
+ import_node_process5.default.exit(1);
1228
1231
  }
1229
1232
  await runNpmScript("preversion" /* PreVersion */, operation);
1230
1233
  await updateFiles(operation);
@@ -1266,6 +1269,7 @@ async function versionBumpInfo(arg = {}) {
1266
1269
  }
1267
1270
 
1268
1271
  // src/config.ts
1272
+ var import_node_process6 = __toESM(require("process"));
1269
1273
  var import_c12 = require("c12");
1270
1274
  var bumpConfigDefaults = {
1271
1275
  commit: true,
@@ -1278,7 +1282,7 @@ var bumpConfigDefaults = {
1278
1282
  all: false,
1279
1283
  files: []
1280
1284
  };
1281
- async function loadBumpConfig(overrides, cwd = process.cwd()) {
1285
+ async function loadBumpConfig(overrides, cwd = import_node_process6.default.cwd()) {
1282
1286
  const { config } = await (0, import_c12.loadConfig)({
1283
1287
  name: "bump",
1284
1288
  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-UEJT3NCU.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.0",
4
+ "packageManager": "pnpm@8.6.12",
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.4.2",
62
62
  "cac": "^6.7.14",
63
- "fast-glob": "^3.2.12",
63
+ "fast-glob": "^3.3.1",
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",
68
+ "@antfu/eslint-config": "^0.40.2",
69
+ "@types/node": "^20.5.1",
70
70
  "@types/prompts": "^2.4.4",
71
71
  "@types/semver": "^7.5.0",
72
72
  "detect-indent": "^7.0.1",
73
73
  "detect-newline": "^4.0.0",
74
- "eslint": "^8.42.0",
75
- "esno": "^0.16.3",
74
+ "eslint": "^8.47.0",
75
+ "esno": "^0.17.0",
76
76
  "log-symbols": "^5.1.0",
77
77
  "npm-check": "^6.0.1",
78
78
  "picocolors": "^1.0.0",
79
79
  "rimraf": "^5.0.1",
80
- "tsup": "^6.7.0",
81
- "typescript": "^5.1.3"
80
+ "tsup": "^7.2.0",
81
+ "typescript": "^5.1.6"
82
82
  }
83
83
  }