bumpp 7.2.0 → 8.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/LICENSE +1 -0
- package/README.md +7 -276
- package/bin/bumpp.js +3 -3
- package/dist/chunk-DW6HTJ47.mjs +2281 -0
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +1716 -286
- package/dist/cli/index.mjs +18 -119
- package/dist/index.d.ts +110 -1
- package/dist/index.js +1718 -177
- package/dist/index.mjs +5 -3
- package/package.json +36 -39
- package/dist/chunk-2TP63A7S.mjs +0 -741
package/dist/cli/index.mjs
CHANGED
|
@@ -5,16 +5,14 @@ import {
|
|
|
5
5
|
isReleaseType,
|
|
6
6
|
require_log_symbols,
|
|
7
7
|
versionBump
|
|
8
|
-
} from "../chunk-
|
|
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
|
|
16
|
-
var version = "7.2.0";
|
|
17
|
-
var description = "Automatically (or with prompts) bump your version number, commit changes, tag, and push to Git";
|
|
15
|
+
var version = "8.2.0";
|
|
18
16
|
|
|
19
17
|
// src/cli/exit-code.ts
|
|
20
18
|
init_esm_shims();
|
|
@@ -25,104 +23,17 @@ 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
|
-
import commandLineArgs from "command-line-args";
|
|
108
28
|
import { valid as isValidVersion } from "semver";
|
|
109
|
-
|
|
29
|
+
import cac from "cac";
|
|
30
|
+
function parseArgs() {
|
|
110
31
|
try {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
{ name: "all", alias: "a", type: Boolean },
|
|
117
|
-
{ name: "no-verify", type: Boolean },
|
|
118
|
-
{ name: "quiet", alias: "q", type: Boolean },
|
|
119
|
-
{ name: "version", alias: "v", type: Boolean },
|
|
120
|
-
{ name: "help", alias: "h", type: Boolean },
|
|
121
|
-
{ name: "ignore-scripts", type: Boolean },
|
|
122
|
-
{ name: "execute", alias: "x", type: String },
|
|
123
|
-
{ name: "files", type: String, multiple: true, defaultOption: true }
|
|
124
|
-
], { argv });
|
|
125
|
-
let parsedArgs = {
|
|
32
|
+
const cli = cac("bumpp");
|
|
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();
|
|
34
|
+
const result = cli.parse();
|
|
35
|
+
const args = result.options;
|
|
36
|
+
const parsedArgs = {
|
|
126
37
|
help: args.help,
|
|
127
38
|
version: args.version,
|
|
128
39
|
quiet: args.quiet,
|
|
@@ -132,23 +43,15 @@ function parseArgs(argv) {
|
|
|
132
43
|
tag: args.tag,
|
|
133
44
|
push: args.push,
|
|
134
45
|
all: args.all,
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
46
|
+
confirm: !args.yes,
|
|
47
|
+
noVerify: !args.verify,
|
|
48
|
+
files: args["--"],
|
|
49
|
+
ignoreScripts: args.ignoreScripts,
|
|
138
50
|
execute: args.execute
|
|
139
51
|
}
|
|
140
52
|
};
|
|
141
|
-
if (args.preid === null) {
|
|
142
|
-
throw new Error('The --preid option requires a value, such as "alpha", "beta", etc.');
|
|
143
|
-
}
|
|
144
|
-
if (args.commit === null) {
|
|
145
|
-
parsedArgs.options.commit = true;
|
|
146
|
-
}
|
|
147
|
-
if (args.tag === null) {
|
|
148
|
-
parsedArgs.options.tag = true;
|
|
149
|
-
}
|
|
150
53
|
if (parsedArgs.options.files && parsedArgs.options.files.length > 0) {
|
|
151
|
-
|
|
54
|
+
const firstArg = parsedArgs.options.files[0];
|
|
152
55
|
if (firstArg === "prompt" || isReleaseType(firstArg) || isValidVersion(firstArg)) {
|
|
153
56
|
parsedArgs.options.release = firstArg;
|
|
154
57
|
parsedArgs.options.files.shift();
|
|
@@ -161,26 +64,23 @@ function parseArgs(argv) {
|
|
|
161
64
|
}
|
|
162
65
|
function errorHandler(error) {
|
|
163
66
|
console.error(error.message);
|
|
164
|
-
console.error(usageText);
|
|
165
67
|
return process.exit(9 /* InvalidArgument */);
|
|
166
68
|
}
|
|
167
69
|
|
|
168
70
|
// src/cli/index.ts
|
|
169
|
-
async function main(
|
|
71
|
+
async function main() {
|
|
170
72
|
try {
|
|
171
73
|
process.on("uncaughtException", errorHandler2);
|
|
172
74
|
process.on("unhandledRejection", errorHandler2);
|
|
173
|
-
|
|
75
|
+
const { help, version: version2, quiet, options } = parseArgs();
|
|
174
76
|
if (help) {
|
|
175
|
-
console.log(helpText);
|
|
176
77
|
process.exit(0 /* Success */);
|
|
177
78
|
} else if (version2) {
|
|
178
79
|
console.log(version);
|
|
179
80
|
process.exit(0 /* Success */);
|
|
180
81
|
} else {
|
|
181
|
-
if (!quiet)
|
|
82
|
+
if (!quiet)
|
|
182
83
|
options.progress = progress;
|
|
183
|
-
}
|
|
184
84
|
await versionBump(options);
|
|
185
85
|
}
|
|
186
86
|
} catch (error) {
|
|
@@ -211,9 +111,8 @@ function progress({ event, script, updatedFiles, skippedFiles, newVersion }) {
|
|
|
211
111
|
}
|
|
212
112
|
function errorHandler2(error) {
|
|
213
113
|
let message = error.message || String(error);
|
|
214
|
-
if (process.env.DEBUG || process.env.NODE_ENV === "development")
|
|
114
|
+
if (process.env.DEBUG || process.env.NODE_ENV === "development")
|
|
215
115
|
message = error.stack || message;
|
|
216
|
-
}
|
|
217
116
|
console.error(message);
|
|
218
117
|
process.exit(1 /* FatalError */);
|
|
219
118
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -119,6 +119,12 @@ interface VersionBumpOptions {
|
|
|
119
119
|
* Defaults to `false`.
|
|
120
120
|
*/
|
|
121
121
|
all?: boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Prompt for confirmation
|
|
124
|
+
*
|
|
125
|
+
* @default false
|
|
126
|
+
*/
|
|
127
|
+
confirm?: boolean;
|
|
122
128
|
/**
|
|
123
129
|
* Indicates whether to bypass git commit hooks (`git commit --no-verify`).
|
|
124
130
|
*
|
|
@@ -197,6 +203,105 @@ interface InterfaceOptions {
|
|
|
197
203
|
[key: string]: unknown;
|
|
198
204
|
}
|
|
199
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
|
+
|
|
200
305
|
/**
|
|
201
306
|
* Prompts the user for a version number and updates package.json and package-lock.json.
|
|
202
307
|
*
|
|
@@ -219,5 +324,9 @@ declare function versionBump(release: string): Promise<VersionBumpResults>;
|
|
|
219
324
|
* Optionally also commits, tags, and pushes to git.
|
|
220
325
|
*/
|
|
221
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>;
|
|
222
331
|
|
|
223
|
-
export { InterfaceOptions, NpmScript, ProgressEvent, VersionBumpOptions, VersionBumpProgress, VersionBumpResults, versionBump as default, versionBump };
|
|
332
|
+
export { InterfaceOptions, NpmScript, ProgressEvent, VersionBumpOptions, VersionBumpProgress, VersionBumpResults, versionBump as default, versionBump, versionBumpInfo };
|