bumpp 7.2.0 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli/index.js CHANGED
@@ -136,7 +136,7 @@ var import_log_symbols2 = __toESM(require_log_symbols());
136
136
 
137
137
  // package.json
138
138
  var name = "bumpp";
139
- var version = "7.2.0";
139
+ var version = "8.0.0";
140
140
  var description = "Automatically (or with prompts) bump your version number, commit changes, tag, and push to Git";
141
141
 
142
142
  // src/types/version-bump-progress.ts
@@ -150,28 +150,30 @@ var ProgressEvent = /* @__PURE__ */ ((ProgressEvent2) => {
150
150
  ProgressEvent2["NpmScript"] = "npm script";
151
151
  return ProgressEvent2;
152
152
  })(ProgressEvent || {});
153
- var NpmScript = /* @__PURE__ */ ((NpmScript3) => {
154
- NpmScript3["PreVersion"] = "preversion";
155
- NpmScript3["Version"] = "version";
156
- NpmScript3["PostVersion"] = "postversion";
157
- return NpmScript3;
153
+ var NpmScript = /* @__PURE__ */ ((NpmScript2) => {
154
+ NpmScript2["PreVersion"] = "preversion";
155
+ NpmScript2["Version"] = "version";
156
+ NpmScript2["PostVersion"] = "postversion";
157
+ return NpmScript2;
158
158
  })(NpmScript || {});
159
159
 
160
160
  // src/version-bump.ts
161
161
  init_cjs_shims();
162
162
  var ezSpawn3 = __toESM(require("@jsdevtools/ez-spawn"));
163
+ var import_chalk2 = require("chalk");
164
+ var import_log_symbols = __toESM(require_log_symbols());
165
+ var import_prompts2 = __toESM(require("prompts"));
163
166
 
164
167
  // src/get-new-version.ts
165
168
  init_cjs_shims();
166
169
  var import_chalk = require("chalk");
167
170
  var import_prompts = __toESM(require("prompts"));
168
- var import_semver2 = require("semver");
169
- var import_semver3 = __toESM(require("semver"));
171
+ var import_semver2 = __toESM(require("semver"));
170
172
 
171
173
  // src/release-type.ts
172
174
  init_cjs_shims();
173
175
  var import_semver = require("semver");
174
- var prereleaseTypes = ["prerelease"];
176
+ var prereleaseTypes = ["premajor", "preminor", "prepatch", "prerelease"];
175
177
  var releaseTypes = prereleaseTypes.concat(["major", "minor", "patch"]);
176
178
  function isPrerelease(value) {
177
179
  return prereleaseTypes.includes(value);
@@ -182,15 +184,14 @@ function isReleaseType(value) {
182
184
 
183
185
  // src/get-new-version.ts
184
186
  async function getNewVersion(operation) {
185
- let { release } = operation.options;
186
- let { oldVersion } = operation.state;
187
+ const { release } = operation.options;
188
+ const { oldVersion } = operation.state;
187
189
  switch (release.type) {
188
190
  case "prompt":
189
191
  return promptForNewVersion(operation);
190
192
  case "version":
191
- let newSemVer = new import_semver3.SemVer(release.version, true);
192
193
  return operation.update({
193
- newVersion: newSemVer.version
194
+ newVersion: new import_semver2.SemVer(release.version, true).version
194
195
  });
195
196
  default:
196
197
  return operation.update({
@@ -200,8 +201,8 @@ async function getNewVersion(operation) {
200
201
  }
201
202
  }
202
203
  function getNextVersion(oldVersion, bump) {
203
- let oldSemVer = new import_semver3.SemVer(oldVersion);
204
- let newSemVer = oldSemVer.inc(bump.type, bump.preid);
204
+ const oldSemVer = new import_semver2.SemVer(oldVersion);
205
+ const newSemVer = oldSemVer.inc(bump.type, bump.preid);
205
206
  if (isPrerelease(bump.type) && newSemVer.prerelease.length === 2 && newSemVer.prerelease[0] === bump.preid && String(newSemVer.prerelease[1]) === "0") {
206
207
  newSemVer.prerelease[1] = "1";
207
208
  newSemVer.format();
@@ -210,36 +211,34 @@ function getNextVersion(oldVersion, bump) {
210
211
  }
211
212
  function getNextVersions(oldVersion, preid) {
212
213
  var _a;
213
- let next = {};
214
- const parse = import_semver3.default.parse(oldVersion);
215
- if (typeof (parse == null ? void 0 : parse.prerelease[0]) === "string") {
214
+ const next = {};
215
+ const parse = import_semver2.default.parse(oldVersion);
216
+ if (typeof (parse == null ? void 0 : parse.prerelease[0]) === "string")
216
217
  preid = (parse == null ? void 0 : parse.prerelease[0]) || "preid";
217
- }
218
- for (let type of releaseTypes) {
219
- next[type] = import_semver3.default.inc(oldVersion, type, preid);
220
- }
221
- next.next = ((_a = parse == null ? void 0 : parse.prerelease) == null ? void 0 : _a.length) ? import_semver3.default.inc(oldVersion, "prerelease", preid) : import_semver3.default.inc(oldVersion, "patch");
218
+ for (const type of releaseTypes)
219
+ next[type] = import_semver2.default.inc(oldVersion, type, preid);
220
+ next.next = ((_a = parse == null ? void 0 : parse.prerelease) == null ? void 0 : _a.length) ? import_semver2.default.inc(oldVersion, "prerelease", preid) : import_semver2.default.inc(oldVersion, "patch");
222
221
  return next;
223
222
  }
224
223
  async function promptForNewVersion(operation) {
225
- let { oldVersion } = operation.state;
226
- let release = operation.options.release;
227
- let next = getNextVersions(oldVersion, release.preid);
228
- let answers;
229
- answers = await (0, import_prompts.default)([
224
+ const { oldVersion } = operation.state;
225
+ const release = operation.options.release;
226
+ const next = getNextVersions(oldVersion, release.preid);
227
+ const PADDING = 13;
228
+ const answers = await (0, import_prompts.default)([
230
229
  {
231
230
  type: "autocomplete",
232
231
  name: "release",
233
- message: `Current version: ${(0, import_chalk.green)(oldVersion)}`,
232
+ message: `Current version ${(0, import_chalk.green)(oldVersion)}`,
234
233
  initial: "next",
235
234
  choices: [
236
- { value: "major", title: "major - " + (0, import_chalk.bold)(next.major) },
237
- { value: "minor", title: "minor - " + (0, import_chalk.bold)(next.minor) },
238
- { value: "patch", title: "patch - " + (0, import_chalk.bold)(next.patch) },
239
- { value: "next", title: "next - " + (0, import_chalk.bold)(next.next) },
240
- { value: "prerelease", title: "pre-release - " + (0, import_chalk.bold)(next.prerelease) },
241
- { value: "none", title: "as-is - " + (0, import_chalk.bold)(oldVersion) },
242
- { value: "custom", title: "custom..." }
235
+ { value: "major", title: `${"major".padStart(PADDING, " ")} ${(0, import_chalk.bold)(next.major)}` },
236
+ { value: "minor", title: `${"minor".padStart(PADDING, " ")} ${(0, import_chalk.bold)(next.minor)}` },
237
+ { value: "patch", title: `${"patch".padStart(PADDING, " ")} ${(0, import_chalk.bold)(next.patch)}` },
238
+ { value: "next", title: `${"next".padStart(PADDING, " ")} ${(0, import_chalk.bold)(next.next)}` },
239
+ { value: "prerelease", title: `${"pre-release".padStart(PADDING, " ")} ${(0, import_chalk.bold)(next.prerelease)}` },
240
+ { value: "none", title: `${"as-is".padStart(PADDING, " ")} ${(0, import_chalk.bold)(oldVersion)}` },
241
+ { value: "custom", title: "custom ...".padStart(PADDING + 4, " ") }
243
242
  ]
244
243
  },
245
244
  {
@@ -253,11 +252,11 @@ async function promptForNewVersion(operation) {
253
252
  }
254
253
  ]);
255
254
  const newVersion = answers.release === "none" ? oldVersion : answers.release === "custom" ? (0, import_semver2.clean)(answers.custom) : next[answers.release];
256
- if (!newVersion) {
255
+ if (!newVersion)
257
256
  process.exit(1);
258
- }
259
257
  switch (answers.release) {
260
258
  case "custom":
259
+ case "next":
261
260
  case "none":
262
261
  return operation.update({ newVersion });
263
262
  default:
@@ -267,10 +266,12 @@ async function promptForNewVersion(operation) {
267
266
 
268
267
  // src/get-old-version.ts
269
268
  init_cjs_shims();
270
- var import_semver4 = require("semver");
269
+ var import_semver3 = require("semver");
271
270
 
272
271
  // src/fs.ts
273
272
  init_cjs_shims();
273
+ var import_fs = __toESM(require("fs"));
274
+ var import_path = __toESM(require("path"));
274
275
 
275
276
  // node_modules/.pnpm/detect-indent@7.0.0/node_modules/detect-indent/index.js
276
277
  init_cjs_shims();
@@ -372,25 +373,22 @@ function detectIndent(string) {
372
373
 
373
374
  // src/fs.ts
374
375
  var import_detect_newline = __toESM(require_detect_newline());
375
- var import_fs = __toESM(require("fs"));
376
- var import_path = __toESM(require("path"));
377
376
  async function readJsonFile(name2, cwd) {
378
- let file = await readTextFile(name2, cwd);
379
- let data = JSON.parse(file.data);
380
- let indent = detectIndent(file.data).indent;
381
- let newline = (0, import_detect_newline.default)(file.data);
377
+ const file = await readTextFile(name2, cwd);
378
+ const data = JSON.parse(file.data);
379
+ const indent = detectIndent(file.data).indent;
380
+ const newline = (0, import_detect_newline.default)(file.data);
382
381
  return __spreadProps(__spreadValues({}, file), { data, indent, newline });
383
382
  }
384
383
  async function writeJsonFile(file) {
385
384
  let json = JSON.stringify(file.data, void 0, file.indent);
386
- if (file.newline) {
385
+ if (file.newline)
387
386
  json += file.newline;
388
- }
389
387
  return writeTextFile(__spreadProps(__spreadValues({}, file), { data: json }));
390
388
  }
391
389
  function readTextFile(name2, cwd) {
392
390
  return new Promise((resolve, reject) => {
393
- let filePath = import_path.default.join(cwd, name2);
391
+ const filePath = import_path.default.join(cwd, name2);
394
392
  import_fs.default.readFile(filePath, "utf8", (err, text) => {
395
393
  if (err) {
396
394
  reject(err);
@@ -406,11 +404,10 @@ function readTextFile(name2, cwd) {
406
404
  function writeTextFile(file) {
407
405
  return new Promise((resolve, reject) => {
408
406
  import_fs.default.writeFile(file.path, file.data, (err) => {
409
- if (err) {
407
+ if (err)
410
408
  reject(err);
411
- } else {
409
+ else
412
410
  resolve();
413
- }
414
411
  });
415
412
  });
416
413
  }
@@ -421,19 +418,18 @@ function isManifest(obj) {
421
418
  return obj && typeof obj === "object" && isOptionalString(obj.name) && isOptionalString(obj.version) && isOptionalString(obj.description);
422
419
  }
423
420
  function isOptionalString(value) {
424
- let type = typeof value;
421
+ const type = typeof value;
425
422
  return value === null || type === "undefined" || type === "string";
426
423
  }
427
424
 
428
425
  // src/get-old-version.ts
429
426
  async function getOldVersion(operation) {
430
- let { cwd, files } = operation.options;
431
- let filesToCheck = files.filter((file) => file.endsWith(".json"));
432
- if (!filesToCheck.includes("package.json")) {
427
+ const { cwd, files } = operation.options;
428
+ const filesToCheck = files.filter((file) => file.endsWith(".json"));
429
+ if (!filesToCheck.includes("package.json"))
433
430
  filesToCheck.push("package.json");
434
- }
435
- for (let file of filesToCheck) {
436
- let version2 = await readVersion(file, cwd);
431
+ for (const file of filesToCheck) {
432
+ const version2 = await readVersion(file, cwd);
437
433
  if (version2) {
438
434
  return operation.update({
439
435
  oldVersionSource: file,
@@ -445,11 +441,10 @@ async function getOldVersion(operation) {
445
441
  }
446
442
  async function readVersion(file, cwd) {
447
443
  try {
448
- let { data: manifest } = await readJsonFile(file, cwd);
444
+ const { data: manifest } = await readJsonFile(file, cwd);
449
445
  if (isManifest(manifest)) {
450
- if ((0, import_semver4.valid)(manifest.version)) {
446
+ if ((0, import_semver3.valid)(manifest.version))
451
447
  return manifest.version;
452
- }
453
448
  }
454
449
  } catch (error) {
455
450
  return void 0;
@@ -460,11 +455,10 @@ async function readVersion(file, cwd) {
460
455
  init_cjs_shims();
461
456
  var ezSpawn = __toESM(require("@jsdevtools/ez-spawn"));
462
457
  async function gitCommit(operation) {
463
- if (!operation.options.commit) {
458
+ if (!operation.options.commit)
464
459
  return operation;
465
- }
466
- let { all, noVerify, message } = operation.options.commit;
467
- let { updatedFiles, newVersion } = operation.state;
460
+ const { all, noVerify, message } = operation.options.commit;
461
+ const { updatedFiles, newVersion } = operation.state;
468
462
  let args = [];
469
463
  if (all) {
470
464
  args.push("--all");
@@ -472,34 +466,31 @@ async function gitCommit(operation) {
472
466
  if (noVerify) {
473
467
  args.push("--no-verify");
474
468
  }
475
- let commitMessage = formatVersionString(message, newVersion);
469
+ const commitMessage = formatVersionString(message, newVersion);
476
470
  args.push("--message", commitMessage);
477
- if (!all) {
471
+ if (!all)
478
472
  args = args.concat(updatedFiles);
479
- }
480
473
  await ezSpawn.async("git", ["commit", ...args]);
481
474
  return operation.update({ event: "git commit" /* GitCommit */, commitMessage });
482
475
  }
483
476
  async function gitTag(operation) {
484
- if (!operation.options.tag) {
477
+ if (!operation.options.tag)
485
478
  return operation;
486
- }
487
- let { commit, tag } = operation.options;
488
- let { newVersion } = operation.state;
489
- let args = [
479
+ const { commit, tag } = operation.options;
480
+ const { newVersion } = operation.state;
481
+ const args = [
490
482
  "--annotate",
491
483
  "--message",
492
484
  formatVersionString(commit.message, newVersion)
493
485
  ];
494
- let tagName = formatVersionString(tag.name, newVersion);
486
+ const tagName = formatVersionString(tag.name, newVersion);
495
487
  args.push(tagName);
496
488
  await ezSpawn.async("git", ["tag", ...args]);
497
489
  return operation.update({ event: "git tag" /* GitTag */, tagName });
498
490
  }
499
491
  async function gitPush(operation) {
500
- if (!operation.options.push) {
492
+ if (!operation.options.push)
501
493
  return operation;
502
- }
503
494
  await ezSpawn.async("git", "push");
504
495
  if (operation.options.tag) {
505
496
  await ezSpawn.async("git", ["push", "--tags"]);
@@ -507,11 +498,10 @@ async function gitPush(operation) {
507
498
  return operation.update({ event: "git push" /* GitPush */ });
508
499
  }
509
500
  function formatVersionString(template, newVersion) {
510
- if (template.includes("%s")) {
501
+ if (template.includes("%s"))
511
502
  return template.replace(/%s/g, newVersion);
512
- } else {
503
+ else
513
504
  return template + newVersion;
514
- }
515
505
  }
516
506
 
517
507
  // src/operation.ts
@@ -520,35 +510,31 @@ init_cjs_shims();
520
510
  // src/normalize-options.ts
521
511
  init_cjs_shims();
522
512
  var import_globby = __toESM(require("globby"));
523
- var import_globby2 = require("globby");
524
513
  async function normalizeOptions(raw) {
525
- let preid = typeof raw.preid === "string" ? raw.preid : "beta";
526
- let push = Boolean(raw.push);
527
- let all = Boolean(raw.all);
528
- let noVerify = Boolean(raw.noVerify);
529
- let cwd = raw.cwd || process.cwd();
530
- let ignoreScripts = Boolean(raw.ignoreScripts);
531
- let execute = raw.execute;
514
+ const preid = typeof raw.preid === "string" ? raw.preid : "beta";
515
+ const push = Boolean(raw.push);
516
+ const all = Boolean(raw.all);
517
+ const noVerify = Boolean(raw.noVerify);
518
+ const cwd = raw.cwd || process.cwd();
519
+ const ignoreScripts = Boolean(raw.ignoreScripts);
520
+ const execute = raw.execute;
532
521
  let release;
533
- if (!raw.release || raw.release === "prompt") {
522
+ if (!raw.release || raw.release === "prompt")
534
523
  release = { type: "prompt", preid };
535
- } else if (isReleaseType(raw.release)) {
524
+ else if (isReleaseType(raw.release))
536
525
  release = { type: raw.release, preid };
537
- } else {
526
+ else
538
527
  release = { type: "version", version: raw.release };
539
- }
540
528
  let tag;
541
- if (typeof raw.tag === "string") {
529
+ if (typeof raw.tag === "string")
542
530
  tag = { name: raw.tag };
543
- } else if (raw.tag) {
531
+ else if (raw.tag)
544
532
  tag = { name: "v" };
545
- }
546
533
  let commit;
547
- if (typeof raw.commit === "string") {
534
+ if (typeof raw.commit === "string")
548
535
  commit = { all, noVerify, message: raw.commit };
549
- } else if (raw.commit || tag || push) {
550
- commit = { all, noVerify, message: "release v" };
551
- }
536
+ else if (raw.commit || tag || push)
537
+ commit = { all, noVerify, message: "chore: release v" };
552
538
  let files;
553
539
  if (Array.isArray(raw.files) && raw.files.length > 0) {
554
540
  files = await strictGlobMatches(raw.files, { cwd });
@@ -562,37 +548,32 @@ async function normalizeOptions(raw) {
562
548
  ui = { input: process.stdin, output: process.stdout };
563
549
  } else {
564
550
  let _a = raw.interface, { input, output } = _a, other = __objRest(_a, ["input", "output"]);
565
- if (input === true || input !== false && !input) {
551
+ if (input === true || input !== false && !input)
566
552
  input = process.stdin;
567
- }
568
- if (output === true || output !== false && !output) {
553
+ if (output === true || output !== false && !output)
569
554
  output = process.stdout;
570
- }
571
555
  ui = __spreadValues({ input, output }, other);
572
556
  }
573
- if (release.type === "prompt" && !(ui.input && ui.output)) {
557
+ if (release.type === "prompt" && !(ui.input && ui.output))
574
558
  throw new Error("Cannot prompt for the version number because input or output has been disabled.");
575
- }
576
559
  return { release, commit, tag, push, files, cwd, interface: ui, ignoreScripts, execute };
577
560
  }
578
561
  async function strictGlobMatches(files, options) {
579
- let matches = await Promise.all(files.map((file) => strictGlobMatch(file, options)));
580
- let matchedFiles = /* @__PURE__ */ new Set();
581
- for (let match of matches) {
582
- for (let file of match) {
562
+ const matches = await Promise.all(files.map((file) => strictGlobMatch(file, options)));
563
+ const matchedFiles = /* @__PURE__ */ new Set();
564
+ for (const match of matches) {
565
+ for (const file of match)
583
566
  matchedFiles.add(file);
584
- }
585
567
  }
586
568
  return [...matchedFiles];
587
569
  }
588
570
  async function strictGlobMatch(file, options) {
589
- let matches = await (0, import_globby.default)(file, options);
571
+ const matches = await (0, import_globby.default)(file, options);
590
572
  if (matches.length === 0) {
591
- if ((0, import_globby2.hasMagic)(file)) {
573
+ if ((0, import_globby.hasMagic)(file))
592
574
  throw new Error(`Could not find any files matching "${file}".`);
593
- } else {
575
+ else
594
576
  throw new Error(`Could not find file: ${file}.`);
595
- }
596
577
  }
597
578
  return matches.sort();
598
579
  }
@@ -614,8 +595,8 @@ var Operation = class {
614
595
  this._progress = progress2;
615
596
  }
616
597
  get results() {
617
- let options = this.options;
618
- let state = this.state;
598
+ const options = this.options;
599
+ const state = this.state;
619
600
  return {
620
601
  release: state.release,
621
602
  oldVersion: state.oldVersion,
@@ -627,7 +608,7 @@ var Operation = class {
627
608
  };
628
609
  }
629
610
  static async start(input) {
630
- let options = await normalizeOptions(input);
611
+ const options = await normalizeOptions(input);
631
612
  return new Operation(options, input.progress);
632
613
  }
633
614
  update(_a) {
@@ -644,9 +625,9 @@ var Operation = class {
644
625
  init_cjs_shims();
645
626
  var ezSpawn2 = __toESM(require("@jsdevtools/ez-spawn"));
646
627
  async function runNpmScript(script, operation) {
647
- let { cwd, ignoreScripts } = operation.options;
628
+ const { cwd, ignoreScripts } = operation.options;
648
629
  if (!ignoreScripts) {
649
- let { data: manifest } = await readJsonFile("package.json", cwd);
630
+ const { data: manifest } = await readJsonFile("package.json", cwd);
650
631
  if (isManifest(manifest) && hasScript(manifest, script)) {
651
632
  await ezSpawn2.async("npm", ["run", script, "--silent"], { stdio: "inherit" });
652
633
  operation.update({ event: "npm script" /* NpmScript */, script });
@@ -655,10 +636,9 @@ async function runNpmScript(script, operation) {
655
636
  return operation;
656
637
  }
657
638
  function hasScript(manifest, script) {
658
- let scripts = manifest.scripts;
659
- if (scripts && typeof scripts === "object") {
639
+ const scripts = manifest.scripts;
640
+ if (scripts && typeof scripts === "object")
660
641
  return Boolean(scripts[script]);
661
- }
662
642
  return false;
663
643
  }
664
644
 
@@ -666,9 +646,9 @@ function hasScript(manifest, script) {
666
646
  init_cjs_shims();
667
647
  var path2 = __toESM(require("path"));
668
648
  async function updateFiles(operation) {
669
- let { files } = operation.options;
670
- for (let relPath of files) {
671
- let modified = await updateFile(relPath, operation);
649
+ const { files } = operation.options;
650
+ for (const relPath of files) {
651
+ const modified = await updateFile(relPath, operation);
672
652
  if (modified) {
673
653
  operation.update({
674
654
  event: "file updated" /* FileUpdated */,
@@ -684,7 +664,7 @@ async function updateFiles(operation) {
684
664
  return operation;
685
665
  }
686
666
  async function updateFile(relPath, operation) {
687
- let name2 = path2.basename(relPath).trim().toLowerCase();
667
+ const name2 = path2.basename(relPath).trim().toLowerCase();
688
668
  switch (name2) {
689
669
  case "package.json":
690
670
  case "package-lock.json":
@@ -696,10 +676,10 @@ async function updateFile(relPath, operation) {
696
676
  }
697
677
  }
698
678
  async function updateManifestFile(relPath, operation) {
699
- let { cwd } = operation.options;
700
- let { newVersion } = operation.state;
679
+ const { cwd } = operation.options;
680
+ const { newVersion } = operation.state;
701
681
  let modified = false;
702
- let file = await readJsonFile(relPath, cwd);
682
+ const file = await readJsonFile(relPath, cwd);
703
683
  if (isManifest(file.data) && file.data.version !== newVersion) {
704
684
  file.data.version = newVersion;
705
685
  await writeJsonFile(file);
@@ -708,14 +688,14 @@ async function updateManifestFile(relPath, operation) {
708
688
  return modified;
709
689
  }
710
690
  async function updateTextFile(relPath, operation) {
711
- let { cwd } = operation.options;
712
- let { oldVersion, newVersion } = operation.state;
713
- let modified = false;
714
- let file = await readTextFile(relPath, cwd);
691
+ const { cwd } = operation.options;
692
+ const { oldVersion, newVersion } = operation.state;
693
+ const modified = false;
694
+ const file = await readTextFile(relPath, cwd);
715
695
  if (file.data.includes(oldVersion)) {
716
- let sanitizedVersion = oldVersion.replace(/(\W)/g, "\\$1");
717
- let replacePattern = new RegExp("(\\b|v)" + sanitizedVersion + "\\b", "g");
718
- file.data = file.data.replace(replacePattern, "$1" + newVersion);
696
+ const sanitizedVersion = oldVersion.replace(/(\W)/g, "\\$1");
697
+ const replacePattern = new RegExp(`(\\b|v)${sanitizedVersion}\\b`, "g");
698
+ file.data = file.data.replace(replacePattern, `$1${newVersion}`);
719
699
  await writeTextFile(file);
720
700
  return true;
721
701
  }
@@ -723,14 +703,34 @@ async function updateTextFile(relPath, operation) {
723
703
  }
724
704
 
725
705
  // src/version-bump.ts
726
- var import_log_symbols = __toESM(require_log_symbols());
727
706
  async function versionBump(arg = {}) {
728
- if (typeof arg === "string") {
707
+ if (typeof arg === "string")
729
708
  arg = { release: arg };
730
- }
731
- let operation = await Operation.start(arg);
709
+ const operation = await Operation.start(arg);
732
710
  await getOldVersion(operation);
733
711
  await getNewVersion(operation);
712
+ if (arg.confirm) {
713
+ console.log();
714
+ console.log(` files ${operation.options.files.map((i) => (0, import_chalk2.bold)(i)).join(", ")}`);
715
+ if (operation.options.commit)
716
+ console.log(` commit ${(0, import_chalk2.bold)(formatVersionString(operation.options.commit.message, operation.state.newVersion))}`);
717
+ if (operation.options.tag)
718
+ console.log(` tag ${(0, import_chalk2.bold)(formatVersionString(operation.options.tag.name, operation.state.newVersion))}`);
719
+ if (operation.options.execute)
720
+ console.log(` execute ${(0, import_chalk2.bold)(operation.options.execute)}`);
721
+ if (operation.options.push)
722
+ console.log(` push ${(0, import_chalk2.cyan)((0, import_chalk2.bold)("yes"))}`);
723
+ console.log();
724
+ console.log(` from ${(0, import_chalk2.bold)(operation.state.oldVersion)}`);
725
+ console.log(` to ${(0, import_chalk2.green)((0, import_chalk2.bold)(operation.state.newVersion))}`);
726
+ console.log();
727
+ if (!await (0, import_prompts2.default)({
728
+ name: "yes",
729
+ type: "confirm",
730
+ message: "Bump"
731
+ }).then((r) => r.yes))
732
+ return;
733
+ }
734
734
  await runNpmScript("preversion" /* PreVersion */, operation);
735
735
  await updateFiles(operation);
736
736
  if (operation.options.execute) {
@@ -834,25 +834,14 @@ ${usageText}`;
834
834
 
835
835
  // src/cli/parse-args.ts
836
836
  init_cjs_shims();
837
- var import_command_line_args = __toESM(require("command-line-args"));
838
- var import_semver5 = require("semver");
837
+ var import_semver4 = require("semver");
838
+ var import_cac = __toESM(require("cac"));
839
839
  function parseArgs(argv) {
840
840
  try {
841
- let args = (0, import_command_line_args.default)([
842
- { name: "preid", type: String },
843
- { name: "commit", alias: "c", type: String },
844
- { name: "tag", alias: "t", type: String },
845
- { name: "push", alias: "p", type: Boolean },
846
- { name: "all", alias: "a", type: Boolean },
847
- { name: "no-verify", type: Boolean },
848
- { name: "quiet", alias: "q", type: Boolean },
849
- { name: "version", alias: "v", type: Boolean },
850
- { name: "help", alias: "h", type: Boolean },
851
- { name: "ignore-scripts", type: Boolean },
852
- { name: "execute", alias: "x", type: String },
853
- { name: "files", type: String, multiple: true, defaultOption: true }
854
- ], { argv });
855
- let parsedArgs = {
841
+ const cli = (0, import_cac.default)("bumpp");
842
+ cli.version(version).usage("[...files]").option("--preid <preid>", "ID for prerelease").option("--all", "Include all files").option("-c, --commit [msg]", "Commit message", { default: true }).option("-t, --tag [tag]", "Tag name", { default: true }).option("-p, --push", "Push to remote", { default: true }).option("-y, --yes", "Skip confirmation").option("--no-verify", "Skip git verification").option("--ignore-scripts", "Ignore scripts", { default: false }).option("-q, --quiet", "Quiet mode").option("-v, --version <version>", "Tagert version").option("-x, --execute <command>", "Commands to execute after version bumps").help();
843
+ const args = cli.parse(argv).options;
844
+ const parsedArgs = {
856
845
  help: args.help,
857
846
  version: args.version,
858
847
  quiet: args.quiet,
@@ -862,24 +851,16 @@ function parseArgs(argv) {
862
851
  tag: args.tag,
863
852
  push: args.push,
864
853
  all: args.all,
865
- noVerify: args["no-verify"],
866
- files: args.files,
867
- ignoreScripts: args["ignore-scripts"],
854
+ confirm: !args.yes,
855
+ noVerify: !args.verify,
856
+ files: args["--"],
857
+ ignoreScripts: args.ignoreScripts,
868
858
  execute: args.execute
869
859
  }
870
860
  };
871
- if (args.preid === null) {
872
- throw new Error('The --preid option requires a value, such as "alpha", "beta", etc.');
873
- }
874
- if (args.commit === null) {
875
- parsedArgs.options.commit = true;
876
- }
877
- if (args.tag === null) {
878
- parsedArgs.options.tag = true;
879
- }
880
861
  if (parsedArgs.options.files && parsedArgs.options.files.length > 0) {
881
- let firstArg = parsedArgs.options.files[0];
882
- if (firstArg === "prompt" || isReleaseType(firstArg) || (0, import_semver5.valid)(firstArg)) {
862
+ const firstArg = parsedArgs.options.files[0];
863
+ if (firstArg === "prompt" || isReleaseType(firstArg) || (0, import_semver4.valid)(firstArg)) {
883
864
  parsedArgs.options.release = firstArg;
884
865
  parsedArgs.options.files.shift();
885
866
  }
@@ -900,7 +881,7 @@ async function main(args) {
900
881
  try {
901
882
  process.on("uncaughtException", errorHandler2);
902
883
  process.on("unhandledRejection", errorHandler2);
903
- let { help, version: version2, quiet, options } = parseArgs(args);
884
+ const { help, version: version2, quiet, options } = parseArgs(args);
904
885
  if (help) {
905
886
  console.log(helpText);
906
887
  process.exit(0 /* Success */);
@@ -908,9 +889,8 @@ async function main(args) {
908
889
  console.log(version);
909
890
  process.exit(0 /* Success */);
910
891
  } else {
911
- if (!quiet) {
892
+ if (!quiet)
912
893
  options.progress = progress;
913
- }
914
894
  await versionBump(options);
915
895
  }
916
896
  } catch (error) {
@@ -941,9 +921,8 @@ function progress({ event, script, updatedFiles, skippedFiles, newVersion }) {
941
921
  }
942
922
  function errorHandler2(error) {
943
923
  let message = error.message || String(error);
944
- if (process.env.DEBUG || process.env.NODE_ENV === "development") {
924
+ if (process.env.DEBUG || process.env.NODE_ENV === "development")
945
925
  message = error.stack || message;
946
- }
947
926
  console.error(message);
948
927
  process.exit(1 /* FatalError */);
949
928
  }