bumpp 7.1.1 → 7.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.
package/bin/bumpp.js CHANGED
File without changes
@@ -22,11 +22,13 @@ var __spreadValues = (a, b) => {
22
22
  };
23
23
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
24
  var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
25
- var __require = (x) => {
25
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
26
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
27
+ }) : x)(function(x) {
26
28
  if (typeof require !== "undefined")
27
- return require(x);
29
+ return require.apply(this, arguments);
28
30
  throw new Error('Dynamic require of "' + x + '" is not supported');
29
- };
31
+ });
30
32
  var __objRest = (source, exclude) => {
31
33
  var target = {};
32
34
  for (var prop in source)
@@ -39,25 +41,35 @@ var __objRest = (source, exclude) => {
39
41
  }
40
42
  return target;
41
43
  };
44
+ var __esm = (fn, res) => function __init() {
45
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
46
+ };
42
47
  var __commonJS = (cb, mod) => function __require2() {
43
- return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
48
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
44
49
  };
45
- var __reExport = (target, module, desc) => {
50
+ var __reExport = (target, module, copyDefault, desc) => {
46
51
  if (module && typeof module === "object" || typeof module === "function") {
47
52
  for (let key of __getOwnPropNames(module))
48
- if (!__hasOwnProp.call(target, key) && key !== "default")
53
+ if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
49
54
  __defProp(target, key, { get: () => module[key], enumerable: !(desc = __getOwnPropDesc(module, key)) || desc.enumerable });
50
55
  }
51
56
  return target;
52
57
  };
53
- var __toModule = (module) => {
54
- return __reExport(__markAsModule(__defProp(module != null ? __create(__getProtoOf(module)) : {}, "default", module && module.__esModule && "default" in module ? { get: () => module.default, enumerable: true } : { value: module, enumerable: true })), module);
58
+ var __toESM = (module, isNodeMode) => {
59
+ return __reExport(__markAsModule(__defProp(module != null ? __create(__getProtoOf(module)) : {}, "default", !isNodeMode && module && module.__esModule ? { get: () => module.default, enumerable: true } : { value: module, enumerable: true })), module);
55
60
  };
56
61
 
57
- // node_modules/is-unicode-supported/index.js
62
+ // node_modules/.pnpm/tsup@5.11.9_typescript@4.5.4/node_modules/tsup/assets/esm_shims.js
63
+ var init_esm_shims = __esm({
64
+ "node_modules/.pnpm/tsup@5.11.9_typescript@4.5.4/node_modules/tsup/assets/esm_shims.js"() {
65
+ }
66
+ });
67
+
68
+ // node_modules/.pnpm/is-unicode-supported@0.1.0/node_modules/is-unicode-supported/index.js
58
69
  var require_is_unicode_supported = __commonJS({
59
- "node_modules/is-unicode-supported/index.js"(exports, module) {
70
+ "node_modules/.pnpm/is-unicode-supported@0.1.0/node_modules/is-unicode-supported/index.js"(exports, module) {
60
71
  "use strict";
72
+ init_esm_shims();
61
73
  module.exports = () => {
62
74
  if (process.platform !== "win32") {
63
75
  return true;
@@ -67,10 +79,11 @@ var require_is_unicode_supported = __commonJS({
67
79
  }
68
80
  });
69
81
 
70
- // node_modules/log-symbols/index.js
82
+ // node_modules/.pnpm/log-symbols@4.1.0/node_modules/log-symbols/index.js
71
83
  var require_log_symbols = __commonJS({
72
- "node_modules/log-symbols/index.js"(exports, module) {
84
+ "node_modules/.pnpm/log-symbols@4.1.0/node_modules/log-symbols/index.js"(exports, module) {
73
85
  "use strict";
86
+ init_esm_shims();
74
87
  var chalk = __require("chalk");
75
88
  var isUnicodeSupported = require_is_unicode_supported();
76
89
  var main = {
@@ -89,10 +102,11 @@ var require_log_symbols = __commonJS({
89
102
  }
90
103
  });
91
104
 
92
- // node_modules/detect-newline/index.js
105
+ // node_modules/.pnpm/detect-newline@3.1.0/node_modules/detect-newline/index.js
93
106
  var require_detect_newline = __commonJS({
94
- "node_modules/detect-newline/index.js"(exports, module) {
107
+ "node_modules/.pnpm/detect-newline@3.1.0/node_modules/detect-newline/index.js"(exports, module) {
95
108
  "use strict";
109
+ init_esm_shims();
96
110
  var detectNewline2 = (string) => {
97
111
  if (typeof string !== "string") {
98
112
  throw new TypeError("Expected a string");
@@ -111,8 +125,9 @@ var require_detect_newline = __commonJS({
111
125
  });
112
126
 
113
127
  // src/release-type.ts
128
+ init_esm_shims();
114
129
  import { ReleaseType } from "semver";
115
- var prereleaseTypes = ["premajor", "preminor", "prepatch", "prerelease"];
130
+ var prereleaseTypes = ["prerelease"];
116
131
  var releaseTypes = prereleaseTypes.concat(["major", "minor", "patch"]);
117
132
  function isPrerelease(value) {
118
133
  return prereleaseTypes.includes(value);
@@ -122,32 +137,33 @@ function isReleaseType(value) {
122
137
  }
123
138
 
124
139
  // src/types/version-bump-progress.ts
125
- var ProgressEvent;
126
- (function(ProgressEvent2) {
140
+ init_esm_shims();
141
+ var ProgressEvent = /* @__PURE__ */ ((ProgressEvent2) => {
127
142
  ProgressEvent2["FileUpdated"] = "file updated";
128
143
  ProgressEvent2["FileSkipped"] = "file skipped";
129
144
  ProgressEvent2["GitCommit"] = "git commit";
130
145
  ProgressEvent2["GitTag"] = "git tag";
131
146
  ProgressEvent2["GitPush"] = "git push";
132
147
  ProgressEvent2["NpmScript"] = "npm script";
133
- })(ProgressEvent || (ProgressEvent = {}));
134
- var NpmScript;
135
- (function(NpmScript3) {
148
+ return ProgressEvent2;
149
+ })(ProgressEvent || {});
150
+ var NpmScript = /* @__PURE__ */ ((NpmScript3) => {
136
151
  NpmScript3["PreVersion"] = "preversion";
137
152
  NpmScript3["Version"] = "version";
138
153
  NpmScript3["PostVersion"] = "postversion";
139
- })(NpmScript || (NpmScript = {}));
154
+ return NpmScript3;
155
+ })(NpmScript || {});
140
156
 
141
157
  // src/version-bump.ts
142
- import {
143
- async as async3
144
- } from "@jsdevtools/ez-spawn";
158
+ init_esm_shims();
159
+ import * as ezSpawn3 from "@jsdevtools/ez-spawn";
145
160
 
146
161
  // src/get-new-version.ts
162
+ init_esm_shims();
147
163
  import { bold, green } from "chalk";
148
164
  import prompts from "prompts";
149
165
  import { valid as isValidVersion, clean as cleanVersion } from "semver";
150
- import { SemVer } from "semver";
166
+ import semver, { SemVer } from "semver";
151
167
  async function getNewVersion(operation) {
152
168
  let { release } = operation.options;
153
169
  let { oldVersion } = operation.state;
@@ -176,10 +192,16 @@ function getNextVersion(oldVersion, bump) {
176
192
  return newSemVer.version;
177
193
  }
178
194
  function getNextVersions(oldVersion, preid) {
195
+ var _a;
179
196
  let next = {};
197
+ const parse = semver.parse(oldVersion);
198
+ if (typeof (parse == null ? void 0 : parse.prerelease[0]) === "string") {
199
+ preid = (parse == null ? void 0 : parse.prerelease[0]) || "preid";
200
+ }
180
201
  for (let type of releaseTypes) {
181
- next[type] = getNextVersion(oldVersion, { type, preid });
202
+ next[type] = semver.inc(oldVersion, type, preid);
182
203
  }
204
+ next.next = ((_a = parse == null ? void 0 : parse.prerelease) == null ? void 0 : _a.length) ? semver.inc(oldVersion, "prerelease", preid) : semver.inc(oldVersion, "patch");
183
205
  return next;
184
206
  }
185
207
  async function promptForNewVersion(operation) {
@@ -192,16 +214,14 @@ async function promptForNewVersion(operation) {
192
214
  type: "autocomplete",
193
215
  name: "release",
194
216
  message: `Current version: ${green(oldVersion)}`,
195
- initial: "patch",
217
+ initial: "next",
196
218
  choices: [
197
219
  { value: "major", title: "major - " + bold(next.major) },
198
220
  { value: "minor", title: "minor - " + bold(next.minor) },
199
221
  { value: "patch", title: "patch - " + bold(next.patch) },
200
- { value: "premajor", title: "pre-release major - " + bold(next.premajor) },
201
- { value: "preminor", title: "pre-release minor - " + bold(next.preminor) },
202
- { value: "prepatch", title: "pre-release patch - " + bold(next.prepatch) },
222
+ { value: "next", title: "next - " + bold(next.next) },
203
223
  { value: "prerelease", title: "pre-release - " + bold(next.prerelease) },
204
- { value: "none", title: "leave as-is - " + bold(oldVersion) },
224
+ { value: "none", title: "as-is - " + bold(oldVersion) },
205
225
  { value: "custom", title: "custom..." }
206
226
  ]
207
227
  },
@@ -229,14 +249,19 @@ async function promptForNewVersion(operation) {
229
249
  }
230
250
 
231
251
  // src/get-old-version.ts
252
+ init_esm_shims();
232
253
  import { valid as isValidVersion2 } from "semver";
233
254
 
234
- // node_modules/detect-indent/index.js
255
+ // src/fs.ts
256
+ init_esm_shims();
257
+
258
+ // node_modules/.pnpm/detect-indent@7.0.0/node_modules/detect-indent/index.js
259
+ init_esm_shims();
235
260
  var INDENT_REGEX = /^(?:( )+|\t+)/;
236
261
  var INDENT_TYPE_SPACE = "space";
237
262
  var INDENT_TYPE_TAB = "tab";
238
263
  function makeIndentsMap(string, ignoreSingleSpaces) {
239
- const indents = new Map();
264
+ const indents = /* @__PURE__ */ new Map();
240
265
  let previousSize = 0;
241
266
  let previousIndentType;
242
267
  let key;
@@ -329,7 +354,7 @@ function detectIndent(string) {
329
354
  }
330
355
 
331
356
  // src/fs.ts
332
- var import_detect_newline = __toModule(require_detect_newline());
357
+ var import_detect_newline = __toESM(require_detect_newline());
333
358
  import fs from "fs";
334
359
  import path from "path";
335
360
  async function readJsonFile(name, cwd) {
@@ -374,6 +399,7 @@ function writeTextFile(file) {
374
399
  }
375
400
 
376
401
  // src/manifest.ts
402
+ init_esm_shims();
377
403
  function isManifest(obj) {
378
404
  return obj && typeof obj === "object" && isOptionalString(obj.name) && isOptionalString(obj.version) && isOptionalString(obj.description);
379
405
  }
@@ -414,9 +440,8 @@ async function readVersion(file, cwd) {
414
440
  }
415
441
 
416
442
  // src/git.ts
417
- import {
418
- async
419
- } from "@jsdevtools/ez-spawn";
443
+ init_esm_shims();
444
+ import * as ezSpawn from "@jsdevtools/ez-spawn";
420
445
  async function gitCommit(operation) {
421
446
  if (!operation.options.commit) {
422
447
  return operation;
@@ -435,8 +460,8 @@ async function gitCommit(operation) {
435
460
  if (!all) {
436
461
  args = args.concat(updatedFiles);
437
462
  }
438
- await async("git", ["commit", ...args]);
439
- return operation.update({ event: ProgressEvent.GitCommit, commitMessage });
463
+ await ezSpawn.async("git", ["commit", ...args]);
464
+ return operation.update({ event: "git commit" /* GitCommit */, commitMessage });
440
465
  }
441
466
  async function gitTag(operation) {
442
467
  if (!operation.options.tag) {
@@ -451,18 +476,18 @@ async function gitTag(operation) {
451
476
  ];
452
477
  let tagName = formatVersionString(tag.name, newVersion);
453
478
  args.push(tagName);
454
- await async("git", ["tag", ...args]);
455
- return operation.update({ event: ProgressEvent.GitTag, tagName });
479
+ await ezSpawn.async("git", ["tag", ...args]);
480
+ return operation.update({ event: "git tag" /* GitTag */, tagName });
456
481
  }
457
482
  async function gitPush(operation) {
458
483
  if (!operation.options.push) {
459
484
  return operation;
460
485
  }
461
- await async("git", "push");
486
+ await ezSpawn.async("git", "push");
462
487
  if (operation.options.tag) {
463
- await async("git", ["push", "--tags"]);
488
+ await ezSpawn.async("git", ["push", "--tags"]);
464
489
  }
465
- return operation.update({ event: ProgressEvent.GitPush });
490
+ return operation.update({ event: "git push" /* GitPush */ });
466
491
  }
467
492
  function formatVersionString(template, newVersion) {
468
493
  if (template.includes("%s")) {
@@ -472,7 +497,11 @@ function formatVersionString(template, newVersion) {
472
497
  }
473
498
  }
474
499
 
500
+ // src/operation.ts
501
+ init_esm_shims();
502
+
475
503
  // src/normalize-options.ts
504
+ init_esm_shims();
476
505
  import globby from "globby";
477
506
  import { hasMagic } from "globby";
478
507
  async function normalizeOptions(raw) {
@@ -531,7 +560,7 @@ async function normalizeOptions(raw) {
531
560
  }
532
561
  async function strictGlobMatches(files, options) {
533
562
  let matches = await Promise.all(files.map((file) => strictGlobMatch(file, options)));
534
- let matchedFiles = new Set();
563
+ let matchedFiles = /* @__PURE__ */ new Set();
535
564
  for (let match of matches) {
536
565
  for (let file of match) {
537
566
  matchedFiles.add(file);
@@ -595,16 +624,15 @@ var Operation = class {
595
624
  };
596
625
 
597
626
  // src/run-npm-script.ts
598
- import {
599
- async as async2
600
- } from "@jsdevtools/ez-spawn";
627
+ init_esm_shims();
628
+ import * as ezSpawn2 from "@jsdevtools/ez-spawn";
601
629
  async function runNpmScript(script, operation) {
602
630
  let { cwd, ignoreScripts } = operation.options;
603
631
  if (!ignoreScripts) {
604
632
  let { data: manifest } = await readJsonFile("package.json", cwd);
605
633
  if (isManifest(manifest) && hasScript(manifest, script)) {
606
- await async2("npm", ["run", script, "--silent"], { stdio: "inherit" });
607
- operation.update({ event: ProgressEvent.NpmScript, script });
634
+ await ezSpawn2.async("npm", ["run", script, "--silent"], { stdio: "inherit" });
635
+ operation.update({ event: "npm script" /* NpmScript */, script });
608
636
  }
609
637
  }
610
638
  return operation;
@@ -618,21 +646,20 @@ function hasScript(manifest, script) {
618
646
  }
619
647
 
620
648
  // src/update-files.ts
621
- import {
622
- basename
623
- } from "path";
649
+ init_esm_shims();
650
+ import * as path2 from "path";
624
651
  async function updateFiles(operation) {
625
652
  let { files } = operation.options;
626
653
  for (let relPath of files) {
627
654
  let modified = await updateFile(relPath, operation);
628
655
  if (modified) {
629
656
  operation.update({
630
- event: ProgressEvent.FileUpdated,
657
+ event: "file updated" /* FileUpdated */,
631
658
  updatedFiles: operation.state.updatedFiles.concat(relPath)
632
659
  });
633
660
  } else {
634
661
  operation.update({
635
- event: ProgressEvent.FileSkipped,
662
+ event: "file skipped" /* FileSkipped */,
636
663
  skippedFiles: operation.state.skippedFiles.concat(relPath)
637
664
  });
638
665
  }
@@ -640,7 +667,7 @@ async function updateFiles(operation) {
640
667
  return operation;
641
668
  }
642
669
  async function updateFile(relPath, operation) {
643
- let name = basename(relPath).trim().toLowerCase();
670
+ let name = path2.basename(relPath).trim().toLowerCase();
644
671
  switch (name) {
645
672
  case "package.json":
646
673
  case "package-lock.json":
@@ -679,7 +706,7 @@ async function updateTextFile(relPath, operation) {
679
706
  }
680
707
 
681
708
  // src/version-bump.ts
682
- var import_log_symbols = __toModule(require_log_symbols());
709
+ var import_log_symbols = __toESM(require_log_symbols());
683
710
  async function versionBump(arg = {}) {
684
711
  if (typeof arg === "string") {
685
712
  arg = { release: arg };
@@ -687,23 +714,24 @@ async function versionBump(arg = {}) {
687
714
  let operation = await Operation.start(arg);
688
715
  await getOldVersion(operation);
689
716
  await getNewVersion(operation);
690
- await runNpmScript(NpmScript.PreVersion, operation);
717
+ await runNpmScript("preversion" /* PreVersion */, operation);
691
718
  await updateFiles(operation);
692
719
  if (operation.options.execute) {
693
720
  console.log(import_log_symbols.info, "Executing script", operation.options.execute);
694
- await async3(operation.options.execute, { stdio: "inherit" });
721
+ await ezSpawn3.async(operation.options.execute, { stdio: "inherit" });
695
722
  console.log(import_log_symbols.success, "Script finished");
696
723
  }
697
- await runNpmScript(NpmScript.Version, operation);
724
+ await runNpmScript("version" /* Version */, operation);
698
725
  await gitCommit(operation);
699
726
  await gitTag(operation);
700
- await runNpmScript(NpmScript.PostVersion, operation);
727
+ await runNpmScript("postversion" /* PostVersion */, operation);
701
728
  await gitPush(operation);
702
729
  return operation.results;
703
730
  }
704
731
 
705
732
  export {
706
- __toModule,
733
+ __toESM,
734
+ init_esm_shims,
707
735
  ReleaseType,
708
736
  isReleaseType,
709
737
  ProgressEvent,
@@ -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(args: string[]): Promise<void>;
7
+
8
+ export { main };