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/README.md CHANGED
@@ -6,9 +6,13 @@ Forked from [`version-bump-prompt`](https://github.com/JS-DevTools/version-bump-
6
6
 
7
7
  ###### Changes in this fork
8
8
 
9
- - Renamed to `bumpp` - so you can use `npx bumpp` directly
10
- - Ships ESM and CJS bundles
11
- - Add a new argument `--execute` to execute the command before committing
9
+ - Renamed to `bumpp` - so you can use `npx bumpp` directly.
10
+ - Ships ESM and CJS bundles.
11
+ - Add a new argument `--execute` to execute the command before committing.
12
+ - Use current version's `preid` when avaliable.
13
+ - Confirmation before bumping.
14
+ - Enable `--commit` `--tag` `--push` by default. (opt-out by `--no-push`, etc.)
15
+ - Conventional Commits by default.
12
16
 
13
17
  <details>
14
18
  <summary>Original README</summary>
@@ -25,10 +29,6 @@ Forked from [`version-bump-prompt`](https://github.com/JS-DevTools/version-bump-
25
29
  [![License](https://img.shields.io/npm/l/@jsdevtools/version-bump-prompt.svg)](LICENSE)
26
30
  [![Buy us a tree](https://img.shields.io/badge/Treeware-%F0%9F%8C%B3-lightgreen)](https://plant.treeware.earth/JS-DevTools/version-bump-prompt)
27
31
 
28
- ![Screenshot](https://jstools.dev/version-bump-prompt/img/screenshot.gif)
29
-
30
-
31
-
32
32
  ### Automate your release process with a single command that can:
33
33
 
34
34
  - Prompt for the type of version bump
package/bin/bumpp.js CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
- "use strict";
3
- const { main } = require("../dist/cli");
4
- main(process.argv.slice(2));
2
+ 'use strict'
3
+ const { main } = require('../dist/cli')
4
+ main(process.argv.slice(2))
@@ -127,7 +127,7 @@ var require_detect_newline = __commonJS({
127
127
  // src/release-type.ts
128
128
  init_esm_shims();
129
129
  import { ReleaseType } from "semver";
130
- var prereleaseTypes = ["prerelease"];
130
+ var prereleaseTypes = ["premajor", "preminor", "prepatch", "prerelease"];
131
131
  var releaseTypes = prereleaseTypes.concat(["major", "minor", "patch"]);
132
132
  function isPrerelease(value) {
133
133
  return prereleaseTypes.includes(value);
@@ -147,33 +147,34 @@ var ProgressEvent = /* @__PURE__ */ ((ProgressEvent2) => {
147
147
  ProgressEvent2["NpmScript"] = "npm script";
148
148
  return ProgressEvent2;
149
149
  })(ProgressEvent || {});
150
- var NpmScript = /* @__PURE__ */ ((NpmScript3) => {
151
- NpmScript3["PreVersion"] = "preversion";
152
- NpmScript3["Version"] = "version";
153
- NpmScript3["PostVersion"] = "postversion";
154
- return NpmScript3;
150
+ var NpmScript = /* @__PURE__ */ ((NpmScript2) => {
151
+ NpmScript2["PreVersion"] = "preversion";
152
+ NpmScript2["Version"] = "version";
153
+ NpmScript2["PostVersion"] = "postversion";
154
+ return NpmScript2;
155
155
  })(NpmScript || {});
156
156
 
157
157
  // src/version-bump.ts
158
158
  init_esm_shims();
159
+ var import_log_symbols = __toESM(require_log_symbols());
159
160
  import * as ezSpawn3 from "@jsdevtools/ez-spawn";
161
+ import { bold as bold2, cyan, green as green2 } from "chalk";
162
+ import prompts2 from "prompts";
160
163
 
161
164
  // src/get-new-version.ts
162
165
  init_esm_shims();
163
166
  import { bold, green } from "chalk";
164
167
  import prompts from "prompts";
165
- import { valid as isValidVersion, clean as cleanVersion } from "semver";
166
- import semver, { SemVer } from "semver";
168
+ import semver, { SemVer, clean as cleanVersion, valid as isValidVersion } from "semver";
167
169
  async function getNewVersion(operation) {
168
- let { release } = operation.options;
169
- let { oldVersion } = operation.state;
170
+ const { release } = operation.options;
171
+ const { oldVersion } = operation.state;
170
172
  switch (release.type) {
171
173
  case "prompt":
172
174
  return promptForNewVersion(operation);
173
175
  case "version":
174
- let newSemVer = new SemVer(release.version, true);
175
176
  return operation.update({
176
- newVersion: newSemVer.version
177
+ newVersion: new SemVer(release.version, true).version
177
178
  });
178
179
  default:
179
180
  return operation.update({
@@ -183,8 +184,8 @@ async function getNewVersion(operation) {
183
184
  }
184
185
  }
185
186
  function getNextVersion(oldVersion, bump) {
186
- let oldSemVer = new SemVer(oldVersion);
187
- let newSemVer = oldSemVer.inc(bump.type, bump.preid);
187
+ const oldSemVer = new SemVer(oldVersion);
188
+ const newSemVer = oldSemVer.inc(bump.type, bump.preid);
188
189
  if (isPrerelease(bump.type) && newSemVer.prerelease.length === 2 && newSemVer.prerelease[0] === bump.preid && String(newSemVer.prerelease[1]) === "0") {
189
190
  newSemVer.prerelease[1] = "1";
190
191
  newSemVer.format();
@@ -193,36 +194,34 @@ function getNextVersion(oldVersion, bump) {
193
194
  }
194
195
  function getNextVersions(oldVersion, preid) {
195
196
  var _a;
196
- let next = {};
197
+ const next = {};
197
198
  const parse = semver.parse(oldVersion);
198
- if (typeof (parse == null ? void 0 : parse.prerelease[0]) === "string") {
199
+ if (typeof (parse == null ? void 0 : parse.prerelease[0]) === "string")
199
200
  preid = (parse == null ? void 0 : parse.prerelease[0]) || "preid";
200
- }
201
- for (let type of releaseTypes) {
201
+ for (const type of releaseTypes)
202
202
  next[type] = semver.inc(oldVersion, type, preid);
203
- }
204
203
  next.next = ((_a = parse == null ? void 0 : parse.prerelease) == null ? void 0 : _a.length) ? semver.inc(oldVersion, "prerelease", preid) : semver.inc(oldVersion, "patch");
205
204
  return next;
206
205
  }
207
206
  async function promptForNewVersion(operation) {
208
- let { oldVersion } = operation.state;
209
- let release = operation.options.release;
210
- let next = getNextVersions(oldVersion, release.preid);
211
- let answers;
212
- answers = await prompts([
207
+ const { oldVersion } = operation.state;
208
+ const release = operation.options.release;
209
+ const next = getNextVersions(oldVersion, release.preid);
210
+ const PADDING = 13;
211
+ const answers = await prompts([
213
212
  {
214
213
  type: "autocomplete",
215
214
  name: "release",
216
- message: `Current version: ${green(oldVersion)}`,
215
+ message: `Current version ${green(oldVersion)}`,
217
216
  initial: "next",
218
217
  choices: [
219
- { value: "major", title: "major - " + bold(next.major) },
220
- { value: "minor", title: "minor - " + bold(next.minor) },
221
- { value: "patch", title: "patch - " + bold(next.patch) },
222
- { value: "next", title: "next - " + bold(next.next) },
223
- { value: "prerelease", title: "pre-release - " + bold(next.prerelease) },
224
- { value: "none", title: "as-is - " + bold(oldVersion) },
225
- { value: "custom", title: "custom..." }
218
+ { value: "major", title: `${"major".padStart(PADDING, " ")} ${bold(next.major)}` },
219
+ { value: "minor", title: `${"minor".padStart(PADDING, " ")} ${bold(next.minor)}` },
220
+ { value: "patch", title: `${"patch".padStart(PADDING, " ")} ${bold(next.patch)}` },
221
+ { value: "next", title: `${"next".padStart(PADDING, " ")} ${bold(next.next)}` },
222
+ { value: "prerelease", title: `${"pre-release".padStart(PADDING, " ")} ${bold(next.prerelease)}` },
223
+ { value: "none", title: `${"as-is".padStart(PADDING, " ")} ${bold(oldVersion)}` },
224
+ { value: "custom", title: "custom ...".padStart(PADDING + 4, " ") }
226
225
  ]
227
226
  },
228
227
  {
@@ -236,11 +235,11 @@ async function promptForNewVersion(operation) {
236
235
  }
237
236
  ]);
238
237
  const newVersion = answers.release === "none" ? oldVersion : answers.release === "custom" ? cleanVersion(answers.custom) : next[answers.release];
239
- if (!newVersion) {
238
+ if (!newVersion)
240
239
  process.exit(1);
241
- }
242
240
  switch (answers.release) {
243
241
  case "custom":
242
+ case "next":
244
243
  case "none":
245
244
  return operation.update({ newVersion });
246
245
  default:
@@ -254,6 +253,8 @@ import { valid as isValidVersion2 } from "semver";
254
253
 
255
254
  // src/fs.ts
256
255
  init_esm_shims();
256
+ import fs from "fs";
257
+ import path from "path";
257
258
 
258
259
  // node_modules/.pnpm/detect-indent@7.0.0/node_modules/detect-indent/index.js
259
260
  init_esm_shims();
@@ -355,25 +356,22 @@ function detectIndent(string) {
355
356
 
356
357
  // src/fs.ts
357
358
  var import_detect_newline = __toESM(require_detect_newline());
358
- import fs from "fs";
359
- import path from "path";
360
359
  async function readJsonFile(name, cwd) {
361
- let file = await readTextFile(name, cwd);
362
- let data = JSON.parse(file.data);
363
- let indent = detectIndent(file.data).indent;
364
- let newline = (0, import_detect_newline.default)(file.data);
360
+ const file = await readTextFile(name, cwd);
361
+ const data = JSON.parse(file.data);
362
+ const indent = detectIndent(file.data).indent;
363
+ const newline = (0, import_detect_newline.default)(file.data);
365
364
  return __spreadProps(__spreadValues({}, file), { data, indent, newline });
366
365
  }
367
366
  async function writeJsonFile(file) {
368
367
  let json = JSON.stringify(file.data, void 0, file.indent);
369
- if (file.newline) {
368
+ if (file.newline)
370
369
  json += file.newline;
371
- }
372
370
  return writeTextFile(__spreadProps(__spreadValues({}, file), { data: json }));
373
371
  }
374
372
  function readTextFile(name, cwd) {
375
373
  return new Promise((resolve, reject) => {
376
- let filePath = path.join(cwd, name);
374
+ const filePath = path.join(cwd, name);
377
375
  fs.readFile(filePath, "utf8", (err, text) => {
378
376
  if (err) {
379
377
  reject(err);
@@ -389,11 +387,10 @@ function readTextFile(name, cwd) {
389
387
  function writeTextFile(file) {
390
388
  return new Promise((resolve, reject) => {
391
389
  fs.writeFile(file.path, file.data, (err) => {
392
- if (err) {
390
+ if (err)
393
391
  reject(err);
394
- } else {
392
+ else
395
393
  resolve();
396
- }
397
394
  });
398
395
  });
399
396
  }
@@ -404,19 +401,18 @@ function isManifest(obj) {
404
401
  return obj && typeof obj === "object" && isOptionalString(obj.name) && isOptionalString(obj.version) && isOptionalString(obj.description);
405
402
  }
406
403
  function isOptionalString(value) {
407
- let type = typeof value;
404
+ const type = typeof value;
408
405
  return value === null || type === "undefined" || type === "string";
409
406
  }
410
407
 
411
408
  // src/get-old-version.ts
412
409
  async function getOldVersion(operation) {
413
- let { cwd, files } = operation.options;
414
- let filesToCheck = files.filter((file) => file.endsWith(".json"));
415
- if (!filesToCheck.includes("package.json")) {
410
+ const { cwd, files } = operation.options;
411
+ const filesToCheck = files.filter((file) => file.endsWith(".json"));
412
+ if (!filesToCheck.includes("package.json"))
416
413
  filesToCheck.push("package.json");
417
- }
418
- for (let file of filesToCheck) {
419
- let version = await readVersion(file, cwd);
414
+ for (const file of filesToCheck) {
415
+ const version = await readVersion(file, cwd);
420
416
  if (version) {
421
417
  return operation.update({
422
418
  oldVersionSource: file,
@@ -428,11 +424,10 @@ async function getOldVersion(operation) {
428
424
  }
429
425
  async function readVersion(file, cwd) {
430
426
  try {
431
- let { data: manifest } = await readJsonFile(file, cwd);
427
+ const { data: manifest } = await readJsonFile(file, cwd);
432
428
  if (isManifest(manifest)) {
433
- if (isValidVersion2(manifest.version)) {
429
+ if (isValidVersion2(manifest.version))
434
430
  return manifest.version;
435
- }
436
431
  }
437
432
  } catch (error) {
438
433
  return void 0;
@@ -443,11 +438,10 @@ async function readVersion(file, cwd) {
443
438
  init_esm_shims();
444
439
  import * as ezSpawn from "@jsdevtools/ez-spawn";
445
440
  async function gitCommit(operation) {
446
- if (!operation.options.commit) {
441
+ if (!operation.options.commit)
447
442
  return operation;
448
- }
449
- let { all, noVerify, message } = operation.options.commit;
450
- let { updatedFiles, newVersion } = operation.state;
443
+ const { all, noVerify, message } = operation.options.commit;
444
+ const { updatedFiles, newVersion } = operation.state;
451
445
  let args = [];
452
446
  if (all) {
453
447
  args.push("--all");
@@ -455,34 +449,31 @@ async function gitCommit(operation) {
455
449
  if (noVerify) {
456
450
  args.push("--no-verify");
457
451
  }
458
- let commitMessage = formatVersionString(message, newVersion);
452
+ const commitMessage = formatVersionString(message, newVersion);
459
453
  args.push("--message", commitMessage);
460
- if (!all) {
454
+ if (!all)
461
455
  args = args.concat(updatedFiles);
462
- }
463
456
  await ezSpawn.async("git", ["commit", ...args]);
464
457
  return operation.update({ event: "git commit" /* GitCommit */, commitMessage });
465
458
  }
466
459
  async function gitTag(operation) {
467
- if (!operation.options.tag) {
460
+ if (!operation.options.tag)
468
461
  return operation;
469
- }
470
- let { commit, tag } = operation.options;
471
- let { newVersion } = operation.state;
472
- let args = [
462
+ const { commit, tag } = operation.options;
463
+ const { newVersion } = operation.state;
464
+ const args = [
473
465
  "--annotate",
474
466
  "--message",
475
467
  formatVersionString(commit.message, newVersion)
476
468
  ];
477
- let tagName = formatVersionString(tag.name, newVersion);
469
+ const tagName = formatVersionString(tag.name, newVersion);
478
470
  args.push(tagName);
479
471
  await ezSpawn.async("git", ["tag", ...args]);
480
472
  return operation.update({ event: "git tag" /* GitTag */, tagName });
481
473
  }
482
474
  async function gitPush(operation) {
483
- if (!operation.options.push) {
475
+ if (!operation.options.push)
484
476
  return operation;
485
- }
486
477
  await ezSpawn.async("git", "push");
487
478
  if (operation.options.tag) {
488
479
  await ezSpawn.async("git", ["push", "--tags"]);
@@ -490,11 +481,10 @@ async function gitPush(operation) {
490
481
  return operation.update({ event: "git push" /* GitPush */ });
491
482
  }
492
483
  function formatVersionString(template, newVersion) {
493
- if (template.includes("%s")) {
484
+ if (template.includes("%s"))
494
485
  return template.replace(/%s/g, newVersion);
495
- } else {
486
+ else
496
487
  return template + newVersion;
497
- }
498
488
  }
499
489
 
500
490
  // src/operation.ts
@@ -502,36 +492,32 @@ init_esm_shims();
502
492
 
503
493
  // src/normalize-options.ts
504
494
  init_esm_shims();
505
- import globby from "globby";
506
- import { hasMagic } from "globby";
495
+ import globby, { hasMagic } from "globby";
507
496
  async function normalizeOptions(raw) {
508
- let preid = typeof raw.preid === "string" ? raw.preid : "beta";
509
- let push = Boolean(raw.push);
510
- let all = Boolean(raw.all);
511
- let noVerify = Boolean(raw.noVerify);
512
- let cwd = raw.cwd || process.cwd();
513
- let ignoreScripts = Boolean(raw.ignoreScripts);
514
- let execute = raw.execute;
497
+ const preid = typeof raw.preid === "string" ? raw.preid : "beta";
498
+ const push = Boolean(raw.push);
499
+ const all = Boolean(raw.all);
500
+ const noVerify = Boolean(raw.noVerify);
501
+ const cwd = raw.cwd || process.cwd();
502
+ const ignoreScripts = Boolean(raw.ignoreScripts);
503
+ const execute = raw.execute;
515
504
  let release;
516
- if (!raw.release || raw.release === "prompt") {
505
+ if (!raw.release || raw.release === "prompt")
517
506
  release = { type: "prompt", preid };
518
- } else if (isReleaseType(raw.release)) {
507
+ else if (isReleaseType(raw.release))
519
508
  release = { type: raw.release, preid };
520
- } else {
509
+ else
521
510
  release = { type: "version", version: raw.release };
522
- }
523
511
  let tag;
524
- if (typeof raw.tag === "string") {
512
+ if (typeof raw.tag === "string")
525
513
  tag = { name: raw.tag };
526
- } else if (raw.tag) {
514
+ else if (raw.tag)
527
515
  tag = { name: "v" };
528
- }
529
516
  let commit;
530
- if (typeof raw.commit === "string") {
517
+ if (typeof raw.commit === "string")
531
518
  commit = { all, noVerify, message: raw.commit };
532
- } else if (raw.commit || tag || push) {
533
- commit = { all, noVerify, message: "release v" };
534
- }
519
+ else if (raw.commit || tag || push)
520
+ commit = { all, noVerify, message: "chore: release v" };
535
521
  let files;
536
522
  if (Array.isArray(raw.files) && raw.files.length > 0) {
537
523
  files = await strictGlobMatches(raw.files, { cwd });
@@ -545,37 +531,32 @@ async function normalizeOptions(raw) {
545
531
  ui = { input: process.stdin, output: process.stdout };
546
532
  } else {
547
533
  let _a = raw.interface, { input, output } = _a, other = __objRest(_a, ["input", "output"]);
548
- if (input === true || input !== false && !input) {
534
+ if (input === true || input !== false && !input)
549
535
  input = process.stdin;
550
- }
551
- if (output === true || output !== false && !output) {
536
+ if (output === true || output !== false && !output)
552
537
  output = process.stdout;
553
- }
554
538
  ui = __spreadValues({ input, output }, other);
555
539
  }
556
- if (release.type === "prompt" && !(ui.input && ui.output)) {
540
+ if (release.type === "prompt" && !(ui.input && ui.output))
557
541
  throw new Error("Cannot prompt for the version number because input or output has been disabled.");
558
- }
559
542
  return { release, commit, tag, push, files, cwd, interface: ui, ignoreScripts, execute };
560
543
  }
561
544
  async function strictGlobMatches(files, options) {
562
- let matches = await Promise.all(files.map((file) => strictGlobMatch(file, options)));
563
- let matchedFiles = /* @__PURE__ */ new Set();
564
- for (let match of matches) {
565
- for (let file of match) {
545
+ const matches = await Promise.all(files.map((file) => strictGlobMatch(file, options)));
546
+ const matchedFiles = /* @__PURE__ */ new Set();
547
+ for (const match of matches) {
548
+ for (const file of match)
566
549
  matchedFiles.add(file);
567
- }
568
550
  }
569
551
  return [...matchedFiles];
570
552
  }
571
553
  async function strictGlobMatch(file, options) {
572
- let matches = await globby(file, options);
554
+ const matches = await globby(file, options);
573
555
  if (matches.length === 0) {
574
- if (hasMagic(file)) {
556
+ if (hasMagic(file))
575
557
  throw new Error(`Could not find any files matching "${file}".`);
576
- } else {
558
+ else
577
559
  throw new Error(`Could not find file: ${file}.`);
578
- }
579
560
  }
580
561
  return matches.sort();
581
562
  }
@@ -597,8 +578,8 @@ var Operation = class {
597
578
  this._progress = progress;
598
579
  }
599
580
  get results() {
600
- let options = this.options;
601
- let state = this.state;
581
+ const options = this.options;
582
+ const state = this.state;
602
583
  return {
603
584
  release: state.release,
604
585
  oldVersion: state.oldVersion,
@@ -610,7 +591,7 @@ var Operation = class {
610
591
  };
611
592
  }
612
593
  static async start(input) {
613
- let options = await normalizeOptions(input);
594
+ const options = await normalizeOptions(input);
614
595
  return new Operation(options, input.progress);
615
596
  }
616
597
  update(_a) {
@@ -627,9 +608,9 @@ var Operation = class {
627
608
  init_esm_shims();
628
609
  import * as ezSpawn2 from "@jsdevtools/ez-spawn";
629
610
  async function runNpmScript(script, operation) {
630
- let { cwd, ignoreScripts } = operation.options;
611
+ const { cwd, ignoreScripts } = operation.options;
631
612
  if (!ignoreScripts) {
632
- let { data: manifest } = await readJsonFile("package.json", cwd);
613
+ const { data: manifest } = await readJsonFile("package.json", cwd);
633
614
  if (isManifest(manifest) && hasScript(manifest, script)) {
634
615
  await ezSpawn2.async("npm", ["run", script, "--silent"], { stdio: "inherit" });
635
616
  operation.update({ event: "npm script" /* NpmScript */, script });
@@ -638,10 +619,9 @@ async function runNpmScript(script, operation) {
638
619
  return operation;
639
620
  }
640
621
  function hasScript(manifest, script) {
641
- let scripts = manifest.scripts;
642
- if (scripts && typeof scripts === "object") {
622
+ const scripts = manifest.scripts;
623
+ if (scripts && typeof scripts === "object")
643
624
  return Boolean(scripts[script]);
644
- }
645
625
  return false;
646
626
  }
647
627
 
@@ -649,9 +629,9 @@ function hasScript(manifest, script) {
649
629
  init_esm_shims();
650
630
  import * as path2 from "path";
651
631
  async function updateFiles(operation) {
652
- let { files } = operation.options;
653
- for (let relPath of files) {
654
- let modified = await updateFile(relPath, operation);
632
+ const { files } = operation.options;
633
+ for (const relPath of files) {
634
+ const modified = await updateFile(relPath, operation);
655
635
  if (modified) {
656
636
  operation.update({
657
637
  event: "file updated" /* FileUpdated */,
@@ -667,7 +647,7 @@ async function updateFiles(operation) {
667
647
  return operation;
668
648
  }
669
649
  async function updateFile(relPath, operation) {
670
- let name = path2.basename(relPath).trim().toLowerCase();
650
+ const name = path2.basename(relPath).trim().toLowerCase();
671
651
  switch (name) {
672
652
  case "package.json":
673
653
  case "package-lock.json":
@@ -679,10 +659,10 @@ async function updateFile(relPath, operation) {
679
659
  }
680
660
  }
681
661
  async function updateManifestFile(relPath, operation) {
682
- let { cwd } = operation.options;
683
- let { newVersion } = operation.state;
662
+ const { cwd } = operation.options;
663
+ const { newVersion } = operation.state;
684
664
  let modified = false;
685
- let file = await readJsonFile(relPath, cwd);
665
+ const file = await readJsonFile(relPath, cwd);
686
666
  if (isManifest(file.data) && file.data.version !== newVersion) {
687
667
  file.data.version = newVersion;
688
668
  await writeJsonFile(file);
@@ -691,14 +671,14 @@ async function updateManifestFile(relPath, operation) {
691
671
  return modified;
692
672
  }
693
673
  async function updateTextFile(relPath, operation) {
694
- let { cwd } = operation.options;
695
- let { oldVersion, newVersion } = operation.state;
696
- let modified = false;
697
- let file = await readTextFile(relPath, cwd);
674
+ const { cwd } = operation.options;
675
+ const { oldVersion, newVersion } = operation.state;
676
+ const modified = false;
677
+ const file = await readTextFile(relPath, cwd);
698
678
  if (file.data.includes(oldVersion)) {
699
- let sanitizedVersion = oldVersion.replace(/(\W)/g, "\\$1");
700
- let replacePattern = new RegExp("(\\b|v)" + sanitizedVersion + "\\b", "g");
701
- file.data = file.data.replace(replacePattern, "$1" + newVersion);
679
+ const sanitizedVersion = oldVersion.replace(/(\W)/g, "\\$1");
680
+ const replacePattern = new RegExp(`(\\b|v)${sanitizedVersion}\\b`, "g");
681
+ file.data = file.data.replace(replacePattern, `$1${newVersion}`);
702
682
  await writeTextFile(file);
703
683
  return true;
704
684
  }
@@ -706,14 +686,34 @@ async function updateTextFile(relPath, operation) {
706
686
  }
707
687
 
708
688
  // src/version-bump.ts
709
- var import_log_symbols = __toESM(require_log_symbols());
710
689
  async function versionBump(arg = {}) {
711
- if (typeof arg === "string") {
690
+ if (typeof arg === "string")
712
691
  arg = { release: arg };
713
- }
714
- let operation = await Operation.start(arg);
692
+ const operation = await Operation.start(arg);
715
693
  await getOldVersion(operation);
716
694
  await getNewVersion(operation);
695
+ if (arg.confirm) {
696
+ console.log();
697
+ console.log(` files ${operation.options.files.map((i) => bold2(i)).join(", ")}`);
698
+ if (operation.options.commit)
699
+ console.log(` commit ${bold2(formatVersionString(operation.options.commit.message, operation.state.newVersion))}`);
700
+ if (operation.options.tag)
701
+ console.log(` tag ${bold2(formatVersionString(operation.options.tag.name, operation.state.newVersion))}`);
702
+ if (operation.options.execute)
703
+ console.log(` execute ${bold2(operation.options.execute)}`);
704
+ if (operation.options.push)
705
+ console.log(` push ${cyan(bold2("yes"))}`);
706
+ console.log();
707
+ console.log(` from ${bold2(operation.state.oldVersion)}`);
708
+ console.log(` to ${green2(bold2(operation.state.newVersion))}`);
709
+ console.log();
710
+ if (!await prompts2({
711
+ name: "yes",
712
+ type: "confirm",
713
+ message: "Bump"
714
+ }).then((r) => r.yes))
715
+ return;
716
+ }
717
717
  await runNpmScript("preversion" /* PreVersion */, operation);
718
718
  await updateFiles(operation);
719
719
  if (operation.options.execute) {
@@ -732,10 +732,10 @@ async function versionBump(arg = {}) {
732
732
  export {
733
733
  __toESM,
734
734
  init_esm_shims,
735
+ require_log_symbols,
735
736
  ReleaseType,
736
737
  isReleaseType,
737
738
  ProgressEvent,
738
739
  NpmScript,
739
- require_log_symbols,
740
740
  versionBump
741
741
  };