bumpp 8.0.0 → 8.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,16 +5,14 @@ import {
5
5
  isReleaseType,
6
6
  require_log_symbols,
7
7
  versionBump
8
- } from "../chunk-HM6FRF4P.mjs";
8
+ } from "../chunk-DW6HTJ47.mjs";
9
9
 
10
10
  // src/cli/index.ts
11
11
  init_esm_shims();
12
12
  var import_log_symbols = __toESM(require_log_symbols());
13
13
 
14
14
  // package.json
15
- var name = "bumpp";
16
- var version = "8.0.0";
17
- var description = "Automatically (or with prompts) bump your version number, commit changes, tag, and push to Git";
15
+ var version = "8.2.1";
18
16
 
19
17
  // src/cli/exit-code.ts
20
18
  init_esm_shims();
@@ -25,92 +23,16 @@ var ExitCode = /* @__PURE__ */ ((ExitCode2) => {
25
23
  return ExitCode2;
26
24
  })(ExitCode || {});
27
25
 
28
- // src/cli/help.ts
29
- init_esm_shims();
30
- var usageText = `
31
- Usage: bumpp [release] [options] [files...]
32
-
33
- release:
34
- The release version or type. Can be one of the following:
35
- - A semver version number (ex: 1.23.456)
36
- - prompt: Prompt for the version number (this is the default)
37
- - major: Increase major version
38
- - minor: Increase minor version
39
- - patch: Increase patch version
40
- - premajor: Increase major version, pre-release
41
- - preminor: Increase preminor version, pre-release
42
- - prepatch: Increase prepatch version, pre-release
43
- - prerelease: Increase prerelease version
44
-
45
- options:
46
- --preid <name> The identifier for prerelease versions.
47
- Defaults to "beta".
48
-
49
- -c, --commit [message] Commit changed files to Git.
50
- Defaults to "release vX.X.X".
51
-
52
- -t, --tag [tag] Tag the commit in Git.
53
- The Default tag is "vX.X.X"
54
-
55
- -p, --push Push the Git commit.
56
-
57
- -a, --all Commit/tag/push ALL pending files,
58
- not just the ones that were bumped.
59
- (same as "git commit -a")
60
-
61
- --no-verify Bypass Git commit hooks
62
- (same as "git commit --no-verify")
63
-
64
- -v, --version Show the version number
65
-
66
- -x, --execute Excute additional command after bumping and before commiting
67
-
68
- -q, --quiet Suppress unnecessary output
69
-
70
- -h, --help Show usage information
71
-
72
- --ignore-scripts Bypass version scripts
73
-
74
- files...
75
- One or more files and/or globs to bump (ex: README.md *.txt docs/**/*).
76
- Defaults to package.json and package-lock.json.
77
-
78
- Examples:
79
-
80
- bumpp patch
81
-
82
- Bumps the patch version number in package.json and package-lock.json.
83
- Nothing is committed to git.
84
-
85
- bumpp major --commit
86
-
87
- Bumps the major version number in package.json and package-lock.json.
88
- Commits package.json and package-lock.json to git, but does not tag the commit.
89
-
90
- bumpp -tpa README.md
91
-
92
- Prompts for the new version number and updates package.json, package-lock.json, and README.md.
93
- Commits ALL modified files to git, tags the commit, and pushes the commit.
94
-
95
- bumpp 4.27.9934 --tag "Version " bower.json docs/**/*.md
96
-
97
- Sets the version number to 4.27.9934 in package.json, package-lock.json, bower.json,
98
- and all markdown files in the "docs" directory. Commits the updated files to git,
99
- and tags the commit as "Version 4.27.9934".
100
- `;
101
- var helpText = `
102
- ${name} v${version} - ${description}
103
- ${usageText}`;
104
-
105
26
  // src/cli/parse-args.ts
106
27
  init_esm_shims();
107
28
  import { valid as isValidVersion } from "semver";
108
29
  import cac from "cac";
109
- function parseArgs(argv) {
30
+ function parseArgs() {
110
31
  try {
111
32
  const cli = cac("bumpp");
112
33
  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();
113
- const args = cli.parse(argv).options;
34
+ const result = cli.parse();
35
+ const args = result.options;
114
36
  const parsedArgs = {
115
37
  help: args.help,
116
38
  version: args.version,
@@ -123,7 +45,7 @@ function parseArgs(argv) {
123
45
  all: args.all,
124
46
  confirm: !args.yes,
125
47
  noVerify: !args.verify,
126
- files: args["--"],
48
+ files: [...args["--"] || [], ...result.args],
127
49
  ignoreScripts: args.ignoreScripts,
128
50
  execute: args.execute
129
51
  }
@@ -142,18 +64,16 @@ function parseArgs(argv) {
142
64
  }
143
65
  function errorHandler(error) {
144
66
  console.error(error.message);
145
- console.error(usageText);
146
67
  return process.exit(9 /* InvalidArgument */);
147
68
  }
148
69
 
149
70
  // src/cli/index.ts
150
- async function main(args) {
71
+ async function main() {
151
72
  try {
152
73
  process.on("uncaughtException", errorHandler2);
153
74
  process.on("unhandledRejection", errorHandler2);
154
- const { help, version: version2, quiet, options } = parseArgs(args);
75
+ const { help, version: version2, quiet, options } = parseArgs();
155
76
  if (help) {
156
- console.log(helpText);
157
77
  process.exit(0 /* Success */);
158
78
  } else if (version2) {
159
79
  console.log(version);
package/dist/index.d.ts CHANGED
@@ -203,6 +203,105 @@ interface InterfaceOptions {
203
203
  [key: string]: unknown;
204
204
  }
205
205
 
206
+ interface Interface {
207
+ input?: NodeJS.ReadableStream | NodeJS.ReadStream | false;
208
+ output?: NodeJS.WritableStream | NodeJS.WriteStream | false;
209
+ [key: string]: unknown;
210
+ }
211
+ /**
212
+ * A specific version release.
213
+ */
214
+ interface VersionRelease {
215
+ type: 'version';
216
+ version: string;
217
+ }
218
+ /**
219
+ * Prompt the user for the release number.
220
+ */
221
+ interface PromptRelease {
222
+ type: 'prompt';
223
+ preid: string;
224
+ }
225
+ /**
226
+ * A bump release, relative to the current version number.
227
+ */
228
+ interface BumpRelease {
229
+ type: ReleaseType;
230
+ preid: string;
231
+ }
232
+ /**
233
+ * One of the possible Release types.
234
+ */
235
+ declare type Release = VersionRelease | PromptRelease | BumpRelease;
236
+ /**
237
+ * Normalized and sanitized options
238
+ */
239
+ interface NormalizedOptions {
240
+ release: Release;
241
+ commit?: {
242
+ message: string;
243
+ noVerify: boolean;
244
+ all: boolean;
245
+ };
246
+ tag?: {
247
+ name: string;
248
+ };
249
+ push: boolean;
250
+ files: string[];
251
+ cwd: string;
252
+ interface: Interface;
253
+ ignoreScripts: boolean;
254
+ execute?: string;
255
+ }
256
+
257
+ interface OperationState {
258
+ release: ReleaseType | undefined;
259
+ oldVersionSource: string;
260
+ oldVersion: string;
261
+ newVersion: string;
262
+ commitMessage: string;
263
+ tagName: string;
264
+ updatedFiles: string[];
265
+ skippedFiles: string[];
266
+ }
267
+ interface UpdateOperationState extends Partial<OperationState> {
268
+ event?: ProgressEvent;
269
+ script?: NpmScript;
270
+ }
271
+ /**
272
+ * All of the inputs, outputs, and state of a single `versionBump()` call.
273
+ */
274
+ declare class Operation {
275
+ /**
276
+ * The options for this operation.
277
+ */
278
+ options: NormalizedOptions;
279
+ /**
280
+ * The current state of the operation.
281
+ */
282
+ readonly state: Readonly<OperationState>;
283
+ /**
284
+ * The results of the operation.
285
+ */
286
+ get results(): VersionBumpResults;
287
+ /**
288
+ * The callback that's used to report the progress of the operation.
289
+ */
290
+ private readonly _progress?;
291
+ /**
292
+ * Private constructor. Use the `Operation.start()` static method instead.
293
+ */
294
+ private constructor();
295
+ /**
296
+ * Starts a new `versionBump()` operation.
297
+ */
298
+ static start(input: VersionBumpOptions): Promise<Operation>;
299
+ /**
300
+ * Updates the operation state and results, and reports the updated progress to the user.
301
+ */
302
+ update({ event, script, ...newState }: UpdateOperationState): this;
303
+ }
304
+
206
305
  /**
207
306
  * Prompts the user for a version number and updates package.json and package-lock.json.
208
307
  *
@@ -225,5 +324,9 @@ declare function versionBump(release: string): Promise<VersionBumpResults>;
225
324
  * Optionally also commits, tags, and pushes to git.
226
325
  */
227
326
  declare function versionBump(options: VersionBumpOptions): Promise<VersionBumpResults>;
327
+ /**
328
+ * Bumps the version number in one or more files, prompting users if necessary.
329
+ */
330
+ declare function versionBumpInfo(arg?: VersionBumpOptions | string): Promise<Operation>;
228
331
 
229
- export { InterfaceOptions, NpmScript, ProgressEvent, VersionBumpOptions, VersionBumpProgress, VersionBumpResults, versionBump as default, versionBump };
332
+ export { InterfaceOptions, NpmScript, ProgressEvent, VersionBumpOptions, VersionBumpProgress, VersionBumpResults, versionBump as default, versionBump, versionBumpInfo };