bumpp 10.4.1 → 11.0.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.
package/dist/index.d.mts CHANGED
@@ -1,32 +1,35 @@
1
- import _semver, { ReleaseType as ReleaseType$1 } from 'semver';
1
+ import * as semver$1 from "semver";
2
+ import semver, { ReleaseType as ReleaseType$1 } from "semver";
2
3
 
4
+ //#region src/release-type.d.ts
3
5
  type ReleaseType = ReleaseType$1 | 'next' | 'conventional';
4
-
6
+ //#endregion
7
+ //#region src/normalize-options.d.ts
5
8
  interface Interface {
6
- input?: NodeJS.ReadableStream | NodeJS.ReadStream | false;
7
- output?: NodeJS.WritableStream | NodeJS.WriteStream | false;
8
- [key: string]: unknown;
9
+ input?: NodeJS.ReadableStream | NodeJS.ReadStream | false;
10
+ output?: NodeJS.WritableStream | NodeJS.WriteStream | false;
11
+ [key: string]: unknown;
9
12
  }
10
13
  /**
11
14
  * A specific version release.
12
15
  */
13
16
  interface VersionRelease {
14
- type: 'version';
15
- version: string;
17
+ type: 'version';
18
+ version: string;
16
19
  }
17
20
  /**
18
21
  * Prompt the user for the release number.
19
22
  */
20
23
  interface PromptRelease {
21
- type: 'prompt';
22
- preid: string;
24
+ type: 'prompt';
25
+ preid: string;
23
26
  }
24
27
  /**
25
28
  * A bump release, relative to the current version number.
26
29
  */
27
30
  interface BumpRelease {
28
- type: ReleaseType;
29
- preid: string;
31
+ type: ReleaseType;
32
+ preid: string;
30
33
  }
31
34
  /**
32
35
  * One of the possible Release types.
@@ -36,76 +39,78 @@ type Release = VersionRelease | PromptRelease | BumpRelease;
36
39
  * Normalized and sanitized options
37
40
  */
38
41
  interface NormalizedOptions {
39
- release: Release;
40
- commit?: {
41
- message: string;
42
- noVerify: boolean;
43
- all: boolean;
44
- };
45
- tag?: {
46
- name: string;
47
- };
48
- sign?: boolean;
49
- push: boolean;
50
- files: string[];
51
- cwd: string;
52
- install: boolean;
53
- interface: Interface;
54
- ignoreScripts: boolean;
55
- execute?: string | ((config: Operation) => void | PromiseLike<void>);
56
- printCommits?: boolean;
57
- customVersion?: VersionBumpOptions['customVersion'];
58
- currentVersion?: string;
42
+ release: Release;
43
+ commit?: {
44
+ message: string;
45
+ noVerify: boolean;
46
+ all: boolean;
47
+ };
48
+ tag?: {
49
+ name: string;
50
+ };
51
+ sign?: boolean;
52
+ push: boolean;
53
+ files: string[];
54
+ cwd: string;
55
+ install: boolean;
56
+ interface: Interface;
57
+ ignoreScripts: boolean;
58
+ execute?: string | ((config: Operation) => void | PromiseLike<void>);
59
+ printCommits?: boolean;
60
+ customVersion?: VersionBumpOptions['customVersion'];
61
+ currentVersion?: string;
59
62
  }
60
-
63
+ //#endregion
64
+ //#region src/types/version-bump-results.d.ts
61
65
  /**
62
66
  * Information about the work that was performed by the `versionBump()` function.
63
67
  */
64
68
  interface VersionBumpResults {
65
- /**
66
- * The release type that was used, or `undefined` if an explicit version number was used.
67
- */
68
- release?: ReleaseType;
69
- /**
70
- * The previous version number in package.json.
71
- */
72
- currentVersion: string;
73
- /**
74
- * The new version number.
75
- */
76
- newVersion: string;
77
- /**
78
- * The commit message that was used for the git commit, or `false` if no git commit was created.
79
- *
80
- * NOTE: This will never be an empty string. It will always contain at least the new version number.
81
- */
82
- commit: string | false;
83
- /**
84
- * The tag name that was used for the git tag, or `false` if no git tag was created.
85
- *
86
- * NOTE: This will never be an empty string. It will always contain at least the new version number.
87
- */
88
- tag: string | false;
89
- /**
90
- * The files that were actually modified.
91
- */
92
- updatedFiles: string[];
93
- /**
94
- * The files that were not updated because they did not contain the old version number.
95
- */
96
- skippedFiles: string[];
69
+ /**
70
+ * The release type that was used, or `undefined` if an explicit version number was used.
71
+ */
72
+ release?: ReleaseType;
73
+ /**
74
+ * The previous version number in package.json.
75
+ */
76
+ currentVersion: string;
77
+ /**
78
+ * The new version number.
79
+ */
80
+ newVersion: string;
81
+ /**
82
+ * The commit message that was used for the git commit, or `false` if no git commit was created.
83
+ *
84
+ * NOTE: This will never be an empty string. It will always contain at least the new version number.
85
+ */
86
+ commit: string | false;
87
+ /**
88
+ * The tag name that was used for the git tag, or `false` if no git tag was created.
89
+ *
90
+ * NOTE: This will never be an empty string. It will always contain at least the new version number.
91
+ */
92
+ tag: string | false;
93
+ /**
94
+ * The files that were actually modified.
95
+ */
96
+ updatedFiles: string[];
97
+ /**
98
+ * The files that were not updated because they did not contain the old version number.
99
+ */
100
+ skippedFiles: string[];
97
101
  }
98
-
102
+ //#endregion
103
+ //#region src/types/version-bump-progress.d.ts
99
104
  /**
100
105
  * Progress events that indicate the progress of the `versionBump()` function.
101
106
  */
102
107
  declare const enum ProgressEvent {
103
- FileUpdated = "file updated",
104
- FileSkipped = "file skipped",
105
- GitCommit = "git commit",
106
- GitTag = "git tag",
107
- GitPush = "git push",
108
- NpmScript = "npm script"
108
+ FileUpdated = "file updated",
109
+ FileSkipped = "file skipped",
110
+ GitCommit = "git commit",
111
+ GitTag = "git tag",
112
+ GitPush = "git push",
113
+ NpmScript = "npm script"
109
114
  }
110
115
  /**
111
116
  * The NPM version scripts
@@ -113,244 +118,251 @@ declare const enum ProgressEvent {
113
118
  * @see https://docs.npmjs.com/cli/version.html
114
119
  */
115
120
  declare const enum NpmScript {
116
- PreVersion = "preversion",
117
- Version = "version",
118
- PostVersion = "postversion"
121
+ PreVersion = "preversion",
122
+ Version = "version",
123
+ PostVersion = "postversion"
119
124
  }
120
125
  /**
121
126
  * Information about the progress of the `versionBump()` function.
122
127
  */
123
128
  interface VersionBumpProgress extends VersionBumpResults {
124
- event: ProgressEvent;
125
- script?: NpmScript;
129
+ event: ProgressEvent;
130
+ script?: NpmScript;
126
131
  }
127
-
132
+ //#endregion
133
+ //#region src/operation.d.ts
128
134
  interface OperationState {
129
- release: ReleaseType | undefined;
130
- currentVersionSource: string;
131
- currentVersion: string;
132
- newVersion: string;
133
- commitMessage: string;
134
- tagName: string;
135
- updatedFiles: string[];
136
- skippedFiles: string[];
135
+ release: ReleaseType | undefined;
136
+ currentVersionSource: string;
137
+ currentVersion: string;
138
+ newVersion: string;
139
+ commitMessage: string;
140
+ tagName: string;
141
+ updatedFiles: string[];
142
+ skippedFiles: string[];
137
143
  }
138
144
  interface UpdateOperationState extends Partial<OperationState> {
139
- event?: ProgressEvent;
140
- script?: NpmScript;
145
+ event?: ProgressEvent;
146
+ script?: NpmScript;
141
147
  }
142
148
  /**
143
149
  * All of the inputs, outputs, and state of a single `versionBump()` call.
144
150
  */
145
151
  declare class Operation {
146
- /**
147
- * The options for this operation.
148
- */
149
- options: NormalizedOptions;
150
- /**
151
- * The current state of the operation.
152
- */
153
- readonly state: Readonly<OperationState>;
154
- /**
155
- * The results of the operation.
156
- */
157
- get results(): VersionBumpResults;
158
- /**
159
- * The callback that's used to report the progress of the operation.
160
- */
161
- private readonly _progress?;
162
- /**
163
- * Private constructor. Use the `Operation.start()` static method instead.
164
- */
165
- private constructor();
166
- /**
167
- * Starts a new `versionBump()` operation.
168
- */
169
- static start(input: VersionBumpOptions): Promise<Operation>;
170
- /**
171
- * Updates the operation state and results, and reports the updated progress to the user.
172
- */
173
- update({ event, script, ...newState }: UpdateOperationState): this;
152
+ /**
153
+ * The options for this operation.
154
+ */
155
+ options: NormalizedOptions;
156
+ /**
157
+ * The current state of the operation.
158
+ */
159
+ readonly state: Readonly<OperationState>;
160
+ /**
161
+ * The results of the operation.
162
+ */
163
+ get results(): VersionBumpResults;
164
+ /**
165
+ * The callback that's used to report the progress of the operation.
166
+ */
167
+ private readonly _progress?;
168
+ /**
169
+ * Private constructor. Use the `Operation.start()` static method instead.
170
+ */
171
+ private constructor();
172
+ /**
173
+ * Starts a new `versionBump()` operation.
174
+ */
175
+ static start(input: VersionBumpOptions): Promise<Operation>;
176
+ /**
177
+ * Updates the operation state and results, and reports the updated progress to the user.
178
+ */
179
+ update({
180
+ event,
181
+ script,
182
+ ...newState
183
+ }: UpdateOperationState): this;
174
184
  }
175
-
185
+ //#endregion
186
+ //#region src/types/version-bump-options.d.ts
176
187
  /**
177
188
  * Options for the `versionBump()` function.
178
189
  */
179
190
  interface VersionBumpOptions {
180
- /**
181
- * The release version or type. Can be one of the following:
182
- *
183
- * - The new version number (e.g. "1.23.456")
184
- * - A release type (e.g. "major", "minor", "patch", "prerelease", etc.)
185
- * - "prompt" to prompt the user for the version number
186
- *
187
- * Defaults to "prompt".
188
- */
189
- release?: string;
190
- /**
191
- * The current version number to be bumpped.
192
- * If not provide, it will be read from the first file in the `files` array.
193
- */
194
- currentVersion?: string;
195
- /**
196
- * The prerelease type (e.g. "alpha", "beta", "next").
197
- *
198
- * Defaults to "beta".
199
- */
200
- preid?: string;
201
- /**
202
- * Indicates whether to create a git commit. Can be set to a custom commit message string
203
- * or `true` to use "release v". Any `%s` placeholders in the message string will be replaced
204
- * with the new version number. If the message string does _not_ contain any `%s` placeholders,
205
- * then the new version number will be appended to the message.
206
- *
207
- * Defaults to `true`.
208
- */
209
- commit?: boolean | string;
210
- /**
211
- * Indicates whether to tag the git commit. Can be set to a custom tag string
212
- * or `true` to use "v". Any `%s` placeholders in the tag string will be replaced
213
- * with the new version number. If the tag string does _not_ contain any `%s` placeholders,
214
- * then the new version number will be appended to the tag.
215
- *
216
- * Defaults to `true`.
217
- */
218
- tag?: boolean | string;
219
- /**
220
- * Sign the git commit and tag with a configured key (GPG/SSH).
221
- *
222
- * Defaults to `false`.
223
- */
224
- sign?: boolean;
225
- /**
226
- * Indicates whether to push the git commit and tag.
227
- *
228
- * Defaults to `true`.
229
- */
230
- push?: boolean;
231
- /**
232
- * Run `npm install` after bumping the version number.
233
- *
234
- * Defaults to `false`.
235
- */
236
- install?: boolean;
237
- /**
238
- * Indicates whether the git commit should include ALL files (`git commit --all`)
239
- * rather than just the files that were modified by `versionBump()`.
240
- *
241
- * Defaults to `false`.
242
- */
243
- all?: boolean;
244
- /**
245
- * Indicates whether the git working tree needs to be cleared before bumping.
246
- *
247
- * Defaults to `true`.
248
- */
249
- noGitCheck?: boolean;
250
- /**
251
- * Prompt for confirmation
252
- *
253
- * @default true
254
- */
255
- confirm?: boolean;
256
- /**
257
- * Indicates whether to bypass git commit hooks (`git commit --no-verify`).
258
- *
259
- * Defaults to `false`.
260
- */
261
- noVerify?: boolean;
262
- /**
263
- * The files to be updated. For certain known files ("package.json", "bower.json", etc.)
264
- * `versionBump()` will explicitly update the file's version number. For other files
265
- * (ReadMe files, config files, source code, etc.) it will simply do a global replacement
266
- * of the old version number with the new version number.
267
- *
268
- * Defaults to ["package.json", "package-lock.json", "jsr.json", "jsr.jsonc", "deno.json", "deno.jsonc"].
269
- */
270
- files?: string[];
271
- /**
272
- * The working directory, which is used as the basis for locating all files.
273
- *
274
- * Defaults to `process.cwd()`
275
- */
276
- cwd?: string;
277
- /**
278
- * Options for the command-line interface. Can be one of the following:
279
- *
280
- * - `true` - To default to `process.stdin` and `process.stdout`.
281
- * - `false` - To disable all CLI output. Cannot be used when `release` is "prompt".
282
- * - An object that will be passed to `readline.createInterface()`.
283
- *
284
- * Defaults to `true`.
285
- */
286
- interface?: boolean | InterfaceOptions;
287
- /**
288
- * Indicates whether to ignore version scripts.
289
- *
290
- * Defaults to `false`.
291
- */
292
- ignoreScripts?: boolean;
293
- /**
294
- * A callback that is provides information about the progress of the `versionBump()` function.
295
- */
296
- progress?: (progress: VersionBumpProgress) => void;
297
- /**
298
- * Execute additional command after bumping and before committing
299
- */
300
- execute?: string | ((config: Operation) => void | PromiseLike<void>);
301
- /**
302
- * Bump the files recursively for monorepo. Only works without `files` option.
303
- *
304
- * @default false
305
- */
306
- recursive?: boolean;
307
- /**
308
- * Print recent commits
309
- */
310
- printCommits?: boolean;
311
- /**
312
- * The path to the config file
313
- * If not provided, it will be inferred from the current working directory.
314
- * @default undefined
315
- */
316
- configFilePath?: string;
317
- /**
318
- * Custom function to provide the version number
319
- */
320
- customVersion?: (currentVersion: string, semver: typeof _semver) => Promise<string | void> | string | void;
191
+ /**
192
+ * The release version or type. Can be one of the following:
193
+ *
194
+ * - The new version number (e.g. "1.23.456")
195
+ * - A release type (e.g. "major", "minor", "patch", "prerelease", etc.)
196
+ * - "prompt" to prompt the user for the version number
197
+ *
198
+ * Defaults to "prompt".
199
+ */
200
+ release?: string;
201
+ /**
202
+ * The current version number to be bumpped.
203
+ * If not provide, it will be read from the first file in the `files` array.
204
+ */
205
+ currentVersion?: string;
206
+ /**
207
+ * The prerelease type (e.g. "alpha", "beta", "next").
208
+ *
209
+ * Defaults to "beta".
210
+ */
211
+ preid?: string;
212
+ /**
213
+ * Indicates whether to create a git commit. Can be set to a custom commit message string
214
+ * or `true` to use "release v". Any `%s` placeholders in the message string will be replaced
215
+ * with the new version number. If the message string does _not_ contain any `%s` placeholders,
216
+ * then the new version number will be appended to the message.
217
+ *
218
+ * Defaults to `true`.
219
+ */
220
+ commit?: boolean | string;
221
+ /**
222
+ * Indicates whether to tag the git commit. Can be set to a custom tag string
223
+ * or `true` to use "v". Any `%s` placeholders in the tag string will be replaced
224
+ * with the new version number. If the tag string does _not_ contain any `%s` placeholders,
225
+ * then the new version number will be appended to the tag.
226
+ *
227
+ * Defaults to `true`.
228
+ */
229
+ tag?: boolean | string;
230
+ /**
231
+ * Sign the git commit and tag with a configured key (GPG/SSH).
232
+ *
233
+ * Defaults to `false`.
234
+ */
235
+ sign?: boolean;
236
+ /**
237
+ * Indicates whether to push the git commit and tag.
238
+ *
239
+ * Defaults to `true`.
240
+ */
241
+ push?: boolean;
242
+ /**
243
+ * Run `npm install` after bumping the version number.
244
+ *
245
+ * Defaults to `false`.
246
+ */
247
+ install?: boolean;
248
+ /**
249
+ * Indicates whether the git commit should include ALL files (`git commit --all`)
250
+ * rather than just the files that were modified by `versionBump()`.
251
+ *
252
+ * Defaults to `false`.
253
+ */
254
+ all?: boolean;
255
+ /**
256
+ * Indicates whether the git working tree needs to be cleared before bumping.
257
+ *
258
+ * Defaults to `true`.
259
+ */
260
+ noGitCheck?: boolean;
261
+ /**
262
+ * Prompt for confirmation
263
+ *
264
+ * @default true
265
+ */
266
+ confirm?: boolean;
267
+ /**
268
+ * Indicates whether to bypass git commit hooks (`git commit --no-verify`).
269
+ *
270
+ * Defaults to `false`.
271
+ */
272
+ noVerify?: boolean;
273
+ /**
274
+ * The files to be updated. For certain known files ("package.json", "bower.json", etc.)
275
+ * `versionBump()` will explicitly update the file's version number. For other files
276
+ * (ReadMe files, config files, source code, etc.) it will simply do a global replacement
277
+ * of the old version number with the new version number.
278
+ *
279
+ * Defaults to ["package.json", "package-lock.json", "jsr.json", "jsr.jsonc", "deno.json", "deno.jsonc"].
280
+ */
281
+ files?: string[];
282
+ /**
283
+ * The working directory, which is used as the basis for locating all files.
284
+ *
285
+ * Defaults to `process.cwd()`
286
+ */
287
+ cwd?: string;
288
+ /**
289
+ * Options for the command-line interface. Can be one of the following:
290
+ *
291
+ * - `true` - To default to `process.stdin` and `process.stdout`.
292
+ * - `false` - To disable all CLI output. Cannot be used when `release` is "prompt".
293
+ * - An object that will be passed to `readline.createInterface()`.
294
+ *
295
+ * Defaults to `true`.
296
+ */
297
+ interface?: boolean | InterfaceOptions;
298
+ /**
299
+ * Indicates whether to ignore version scripts.
300
+ *
301
+ * Defaults to `false`.
302
+ */
303
+ ignoreScripts?: boolean;
304
+ /**
305
+ * A callback that is provides information about the progress of the `versionBump()` function.
306
+ */
307
+ progress?: (progress: VersionBumpProgress) => void;
308
+ /**
309
+ * Execute additional command after bumping and before committing
310
+ */
311
+ execute?: string | ((config: Operation) => void | PromiseLike<void>);
312
+ /**
313
+ * Bump the files recursively for monorepo. Only works without `files` option.
314
+ *
315
+ * @default false
316
+ */
317
+ recursive?: boolean;
318
+ /**
319
+ * Print recent commits
320
+ */
321
+ printCommits?: boolean;
322
+ /**
323
+ * The path to the config file
324
+ * If not provided, it will be inferred from the current working directory.
325
+ * @default undefined
326
+ */
327
+ configFilePath?: string;
328
+ /**
329
+ * Custom function to provide the version number
330
+ */
331
+ customVersion?: (currentVersion: string, semver: typeof semver) => Promise<string | void> | string | void;
321
332
  }
322
333
  /**
323
334
  * Options for the command-line interface.
324
335
  */
325
336
  interface InterfaceOptions {
326
- /**
327
- * The stream that will be used to read user input. Can be one of the following:
328
- *
329
- * - `true` - To default to `process.stdin`
330
- * - `false` - To disable all CLI input
331
- * - Any readable stream
332
- *
333
- * Defaults to `true`.
334
- */
335
- input?: NodeJS.ReadableStream | NodeJS.ReadStream | boolean;
336
- /**
337
- * The stream that will be used to write output, such as prompts and progress.
338
- * Can be one of the following:
339
- *
340
- * - `true` - To default to `process.stdout`
341
- * - `false` - To disable all CLI output
342
- * - Any writable stream
343
- *
344
- * Defaults to `true`.
345
- */
346
- output?: NodeJS.WritableStream | NodeJS.WriteStream | boolean;
347
- /**
348
- * Any other properties will be passed directly to `readline.createInterface()`.
349
- * See the `ReadLineOptions` interface for possible options.
350
- */
351
- [key: string]: unknown;
337
+ /**
338
+ * The stream that will be used to read user input. Can be one of the following:
339
+ *
340
+ * - `true` - To default to `process.stdin`
341
+ * - `false` - To disable all CLI input
342
+ * - Any readable stream
343
+ *
344
+ * Defaults to `true`.
345
+ */
346
+ input?: NodeJS.ReadableStream | NodeJS.ReadStream | boolean;
347
+ /**
348
+ * The stream that will be used to write output, such as prompts and progress.
349
+ * Can be one of the following:
350
+ *
351
+ * - `true` - To default to `process.stdout`
352
+ * - `false` - To disable all CLI output
353
+ * - Any writable stream
354
+ *
355
+ * Defaults to `true`.
356
+ */
357
+ output?: NodeJS.WritableStream | NodeJS.WriteStream | boolean;
358
+ /**
359
+ * Any other properties will be passed directly to `readline.createInterface()`.
360
+ * See the `ReadLineOptions` interface for possible options.
361
+ */
362
+ [key: string]: unknown;
352
363
  }
353
-
364
+ //#endregion
365
+ //#region src/version-bump.d.ts
354
366
  /**
355
367
  * Prompts the user for a version number and updates package.json and package-lock.json.
356
368
  *
@@ -377,10 +389,33 @@ declare function versionBump(options: VersionBumpOptions): Promise<VersionBumpRe
377
389
  * Bumps the version number in one or more files, prompting users if necessary.
378
390
  */
379
391
  declare function versionBumpInfo(arg?: VersionBumpOptions | string): Promise<Operation>;
380
-
392
+ //#endregion
393
+ //#region src/config.d.ts
381
394
  declare const bumpConfigDefaults: VersionBumpOptions;
382
- declare function loadBumpConfig(overrides?: Partial<VersionBumpOptions>, cwd?: string): Promise<VersionBumpOptions>;
395
+ declare function loadBumpConfig(overrides?: Partial<VersionBumpOptions>, cwd?: string): Promise<{
396
+ release?: string | undefined;
397
+ currentVersion?: string | undefined;
398
+ preid?: string | undefined;
399
+ commit?: string | boolean | undefined;
400
+ tag?: string | boolean | undefined;
401
+ sign?: boolean | undefined;
402
+ push?: boolean | undefined;
403
+ install?: boolean | undefined;
404
+ all?: boolean | undefined;
405
+ noGitCheck?: boolean | undefined;
406
+ confirm?: boolean | undefined;
407
+ noVerify?: boolean | undefined;
408
+ files?: string[] | undefined;
409
+ cwd?: string | undefined;
410
+ interface?: boolean | InterfaceOptions | undefined;
411
+ ignoreScripts?: boolean | undefined;
412
+ progress?: ((progress: VersionBumpProgress) => void) | undefined;
413
+ execute?: string | ((config: Operation) => void | PromiseLike<void>) | undefined;
414
+ recursive?: boolean | undefined;
415
+ printCommits?: boolean | undefined;
416
+ configFilePath?: string | undefined;
417
+ customVersion?: ((currentVersion: string, semver: typeof semver$1) => void | string | Promise<void | string>) | undefined;
418
+ }>;
383
419
  declare function defineConfig(config: Partial<VersionBumpOptions>): Partial<VersionBumpOptions>;
384
-
385
- export { NpmScript, ProgressEvent, bumpConfigDefaults, versionBump as default, defineConfig, loadBumpConfig, versionBump, versionBumpInfo };
386
- export type { InterfaceOptions, ReleaseType, VersionBumpOptions, VersionBumpProgress, VersionBumpResults };
420
+ //#endregion
421
+ export { InterfaceOptions, NpmScript, ProgressEvent, type ReleaseType, VersionBumpOptions, VersionBumpProgress, VersionBumpResults, bumpConfigDefaults, versionBump as default, versionBump, defineConfig, loadBumpConfig, versionBumpInfo };