bumpp 7.0.0 → 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 +0 -0
- package/dist/{chunk-TILHCTE7.mjs → chunk-2TP63A7S.mjs} +291 -192
- package/dist/cli/index.d.ts +8 -0
- package/dist/cli/index.js +783 -40
- package/dist/cli/index.mjs +44 -33
- package/dist/index.d.ts +219 -4
- package/dist/index.js +751 -6
- package/dist/index.mjs +11 -4
- package/package.json +27 -27
- package/dist/chunk-KWGIMQJU.js +0 -642
package/dist/cli/index.mjs
CHANGED
|
@@ -1,24 +1,34 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ProgressEvent,
|
|
3
|
+
__toESM,
|
|
4
|
+
init_esm_shims,
|
|
3
5
|
isReleaseType,
|
|
4
|
-
|
|
6
|
+
require_log_symbols,
|
|
5
7
|
versionBump
|
|
6
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-2TP63A7S.mjs";
|
|
7
9
|
|
|
8
10
|
// src/cli/index.ts
|
|
9
|
-
|
|
11
|
+
init_esm_shims();
|
|
12
|
+
var import_log_symbols = __toESM(require_log_symbols());
|
|
13
|
+
|
|
14
|
+
// package.json
|
|
15
|
+
var name = "bumpp";
|
|
16
|
+
var version = "7.2.0";
|
|
17
|
+
var description = "Automatically (or with prompts) bump your version number, commit changes, tag, and push to Git";
|
|
10
18
|
|
|
11
19
|
// src/cli/exit-code.ts
|
|
12
|
-
|
|
13
|
-
(
|
|
20
|
+
init_esm_shims();
|
|
21
|
+
var ExitCode = /* @__PURE__ */ ((ExitCode2) => {
|
|
14
22
|
ExitCode2[ExitCode2["Success"] = 0] = "Success";
|
|
15
23
|
ExitCode2[ExitCode2["FatalError"] = 1] = "FatalError";
|
|
16
24
|
ExitCode2[ExitCode2["InvalidArgument"] = 9] = "InvalidArgument";
|
|
17
|
-
|
|
25
|
+
return ExitCode2;
|
|
26
|
+
})(ExitCode || {});
|
|
18
27
|
|
|
19
28
|
// src/cli/help.ts
|
|
29
|
+
init_esm_shims();
|
|
20
30
|
var usageText = `
|
|
21
|
-
Usage:
|
|
31
|
+
Usage: bumpp [release] [options] [files...]
|
|
22
32
|
|
|
23
33
|
release:
|
|
24
34
|
The release version or type. Can be one of the following:
|
|
@@ -67,34 +77,35 @@ files...
|
|
|
67
77
|
|
|
68
78
|
Examples:
|
|
69
79
|
|
|
70
|
-
|
|
80
|
+
bumpp patch
|
|
71
81
|
|
|
72
82
|
Bumps the patch version number in package.json and package-lock.json.
|
|
73
83
|
Nothing is committed to git.
|
|
74
84
|
|
|
75
|
-
|
|
85
|
+
bumpp major --commit
|
|
76
86
|
|
|
77
87
|
Bumps the major version number in package.json and package-lock.json.
|
|
78
88
|
Commits package.json and package-lock.json to git, but does not tag the commit.
|
|
79
89
|
|
|
80
|
-
|
|
90
|
+
bumpp -tpa README.md
|
|
81
91
|
|
|
82
92
|
Prompts for the new version number and updates package.json, package-lock.json, and README.md.
|
|
83
93
|
Commits ALL modified files to git, tags the commit, and pushes the commit.
|
|
84
94
|
|
|
85
|
-
|
|
95
|
+
bumpp 4.27.9934 --tag "Version " bower.json docs/**/*.md
|
|
86
96
|
|
|
87
97
|
Sets the version number to 4.27.9934 in package.json, package-lock.json, bower.json,
|
|
88
98
|
and all markdown files in the "docs" directory. Commits the updated files to git,
|
|
89
99
|
and tags the commit as "Version 4.27.9934".
|
|
90
100
|
`;
|
|
91
101
|
var helpText = `
|
|
92
|
-
${
|
|
102
|
+
${name} v${version} - ${description}
|
|
93
103
|
${usageText}`;
|
|
94
104
|
|
|
95
105
|
// src/cli/parse-args.ts
|
|
106
|
+
init_esm_shims();
|
|
96
107
|
import commandLineArgs from "command-line-args";
|
|
97
|
-
import
|
|
108
|
+
import { valid as isValidVersion } from "semver";
|
|
98
109
|
function parseArgs(argv) {
|
|
99
110
|
try {
|
|
100
111
|
let args = commandLineArgs([
|
|
@@ -138,7 +149,7 @@ function parseArgs(argv) {
|
|
|
138
149
|
}
|
|
139
150
|
if (parsedArgs.options.files && parsedArgs.options.files.length > 0) {
|
|
140
151
|
let firstArg = parsedArgs.options.files[0];
|
|
141
|
-
if (firstArg === "prompt" || isReleaseType(firstArg) ||
|
|
152
|
+
if (firstArg === "prompt" || isReleaseType(firstArg) || isValidVersion(firstArg)) {
|
|
142
153
|
parsedArgs.options.release = firstArg;
|
|
143
154
|
parsedArgs.options.files.shift();
|
|
144
155
|
}
|
|
@@ -151,7 +162,7 @@ function parseArgs(argv) {
|
|
|
151
162
|
function errorHandler(error) {
|
|
152
163
|
console.error(error.message);
|
|
153
164
|
console.error(usageText);
|
|
154
|
-
return process.exit(
|
|
165
|
+
return process.exit(9 /* InvalidArgument */);
|
|
155
166
|
}
|
|
156
167
|
|
|
157
168
|
// src/cli/index.ts
|
|
@@ -159,13 +170,13 @@ async function main(args) {
|
|
|
159
170
|
try {
|
|
160
171
|
process.on("uncaughtException", errorHandler2);
|
|
161
172
|
process.on("unhandledRejection", errorHandler2);
|
|
162
|
-
let { help, version, quiet, options } = parseArgs(args);
|
|
173
|
+
let { help, version: version2, quiet, options } = parseArgs(args);
|
|
163
174
|
if (help) {
|
|
164
175
|
console.log(helpText);
|
|
165
|
-
process.exit(
|
|
166
|
-
} else if (
|
|
167
|
-
console.log(
|
|
168
|
-
process.exit(
|
|
176
|
+
process.exit(0 /* Success */);
|
|
177
|
+
} else if (version2) {
|
|
178
|
+
console.log(version);
|
|
179
|
+
process.exit(0 /* Success */);
|
|
169
180
|
} else {
|
|
170
181
|
if (!quiet) {
|
|
171
182
|
options.progress = progress;
|
|
@@ -178,23 +189,23 @@ async function main(args) {
|
|
|
178
189
|
}
|
|
179
190
|
function progress({ event, script, updatedFiles, skippedFiles, newVersion }) {
|
|
180
191
|
switch (event) {
|
|
181
|
-
case
|
|
182
|
-
console.log(success, `Updated ${updatedFiles.pop()} to ${newVersion}`);
|
|
192
|
+
case "file updated" /* FileUpdated */:
|
|
193
|
+
console.log(import_log_symbols.success, `Updated ${updatedFiles.pop()} to ${newVersion}`);
|
|
183
194
|
break;
|
|
184
|
-
case
|
|
185
|
-
console.log(info, `${skippedFiles.pop()} did not need to be updated`);
|
|
195
|
+
case "file skipped" /* FileSkipped */:
|
|
196
|
+
console.log(import_log_symbols.info, `${skippedFiles.pop()} did not need to be updated`);
|
|
186
197
|
break;
|
|
187
|
-
case
|
|
188
|
-
console.log(success, "Git commit");
|
|
198
|
+
case "git commit" /* GitCommit */:
|
|
199
|
+
console.log(import_log_symbols.success, "Git commit");
|
|
189
200
|
break;
|
|
190
|
-
case
|
|
191
|
-
console.log(success, "Git tag");
|
|
201
|
+
case "git tag" /* GitTag */:
|
|
202
|
+
console.log(import_log_symbols.success, "Git tag");
|
|
192
203
|
break;
|
|
193
|
-
case
|
|
194
|
-
console.log(success, "Git push");
|
|
204
|
+
case "git push" /* GitPush */:
|
|
205
|
+
console.log(import_log_symbols.success, "Git push");
|
|
195
206
|
break;
|
|
196
|
-
case
|
|
197
|
-
console.log(success, `Npm run ${script}`);
|
|
207
|
+
case "npm script" /* NpmScript */:
|
|
208
|
+
console.log(import_log_symbols.success, `Npm run ${script}`);
|
|
198
209
|
break;
|
|
199
210
|
}
|
|
200
211
|
}
|
|
@@ -204,7 +215,7 @@ function errorHandler2(error) {
|
|
|
204
215
|
message = error.stack || message;
|
|
205
216
|
}
|
|
206
217
|
console.error(message);
|
|
207
|
-
process.exit(
|
|
218
|
+
process.exit(1 /* FatalError */);
|
|
208
219
|
}
|
|
209
220
|
export {
|
|
210
221
|
main
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,223 @@
|
|
|
1
|
+
import { ReleaseType } from 'semver';
|
|
2
|
+
export { ReleaseType } from 'semver';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Information about the work that was performed by the `versionBump()` function.
|
|
6
|
+
*/
|
|
7
|
+
interface VersionBumpResults {
|
|
8
|
+
/**
|
|
9
|
+
* The release type that was used, or `undefined` if an explicit version number was used.
|
|
10
|
+
*/
|
|
11
|
+
release?: ReleaseType;
|
|
12
|
+
/**
|
|
13
|
+
* The previous version number in package.json.
|
|
14
|
+
*/
|
|
15
|
+
oldVersion: string;
|
|
16
|
+
/**
|
|
17
|
+
* The new version number.
|
|
18
|
+
*/
|
|
19
|
+
newVersion: string;
|
|
20
|
+
/**
|
|
21
|
+
* The commit message that was used for the git commit, or `false` if no git commit was created.
|
|
22
|
+
*
|
|
23
|
+
* NOTE: This will never be an empty string. It will always contain at least the new version number.
|
|
24
|
+
*/
|
|
25
|
+
commit: string | false;
|
|
26
|
+
/**
|
|
27
|
+
* The tag name that was used for the git tag, or `false` if no git tag was created.
|
|
28
|
+
*
|
|
29
|
+
* NOTE: This will never be an empty string. It will always contain at least the new version number.
|
|
30
|
+
*/
|
|
31
|
+
tag: string | false;
|
|
32
|
+
/**
|
|
33
|
+
* The files that were actually modified.
|
|
34
|
+
*/
|
|
35
|
+
updatedFiles: string[];
|
|
36
|
+
/**
|
|
37
|
+
* The files that were not updated because they did not contain the old version number.
|
|
38
|
+
*/
|
|
39
|
+
skippedFiles: string[];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Progress events that indicate the progress of the `versionBump()` function.
|
|
44
|
+
*/
|
|
45
|
+
declare const enum ProgressEvent {
|
|
46
|
+
FileUpdated = "file updated",
|
|
47
|
+
FileSkipped = "file skipped",
|
|
48
|
+
GitCommit = "git commit",
|
|
49
|
+
GitTag = "git tag",
|
|
50
|
+
GitPush = "git push",
|
|
51
|
+
NpmScript = "npm script"
|
|
52
|
+
}
|
|
1
53
|
/**
|
|
2
|
-
* The
|
|
54
|
+
* The NPM version scripts
|
|
3
55
|
*
|
|
4
|
-
* @
|
|
56
|
+
* @see https://docs.npmjs.com/cli/version.html
|
|
57
|
+
*/
|
|
58
|
+
declare const enum NpmScript {
|
|
59
|
+
PreVersion = "preversion",
|
|
60
|
+
Version = "version",
|
|
61
|
+
PostVersion = "postversion"
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Information about the progress of the `versionBump()` function.
|
|
65
|
+
*/
|
|
66
|
+
interface VersionBumpProgress extends VersionBumpResults {
|
|
67
|
+
event: ProgressEvent;
|
|
68
|
+
script?: NpmScript;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Options for the `versionBump()` function.
|
|
73
|
+
*/
|
|
74
|
+
interface VersionBumpOptions {
|
|
75
|
+
/**
|
|
76
|
+
* The release version or type. Can be one of the following:
|
|
77
|
+
*
|
|
78
|
+
* - The new version number (e.g. "1.23.456")
|
|
79
|
+
* - A release type (e.g. "major", "minor", "patch", "prerelease", etc.)
|
|
80
|
+
* - "prompt" to prompt the user for the version number
|
|
81
|
+
*
|
|
82
|
+
* Defaults to "prompt".
|
|
83
|
+
*/
|
|
84
|
+
release?: string;
|
|
85
|
+
/**
|
|
86
|
+
* The prerelease type (e.g. "alpha", "beta", "next").
|
|
87
|
+
*
|
|
88
|
+
* Defaults to "beta".
|
|
89
|
+
*/
|
|
90
|
+
preid?: string;
|
|
91
|
+
/**
|
|
92
|
+
* Indicates whether to create a git commit. Can be set to a custom commit message string
|
|
93
|
+
* or `true` to use "release v". Any `%s` placeholders in the message string will be replaced
|
|
94
|
+
* with the new version number. If the message string does _not_ contain any `%s` placeholders,
|
|
95
|
+
* then the new version number will be appended to the message.
|
|
96
|
+
*
|
|
97
|
+
* Defaults to `false`.
|
|
98
|
+
*/
|
|
99
|
+
commit?: boolean | string;
|
|
100
|
+
/**
|
|
101
|
+
* Indicates whether to tag the git commit. Can be set to a custom tag string
|
|
102
|
+
* or `true` to use "v". Any `%s` placeholders in the tag string will be replaced
|
|
103
|
+
* with the new version number. If the tag string does _not_ contain any `%s` placeholders,
|
|
104
|
+
* then the new version number will be appended to the tag.
|
|
105
|
+
*
|
|
106
|
+
* Defaults to `false`.
|
|
107
|
+
*/
|
|
108
|
+
tag?: boolean | string;
|
|
109
|
+
/**
|
|
110
|
+
* Indicates whether to push the git commit and tag.
|
|
111
|
+
*
|
|
112
|
+
* Defaults to `false`.
|
|
113
|
+
*/
|
|
114
|
+
push?: boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Indicates whether the git commit should include ALL files (`git commit --all`)
|
|
117
|
+
* rather than just the files that were modified by `versionBump()`.
|
|
118
|
+
*
|
|
119
|
+
* Defaults to `false`.
|
|
120
|
+
*/
|
|
121
|
+
all?: boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Indicates whether to bypass git commit hooks (`git commit --no-verify`).
|
|
124
|
+
*
|
|
125
|
+
* Defaults to `false`.
|
|
126
|
+
*/
|
|
127
|
+
noVerify?: boolean;
|
|
128
|
+
/**
|
|
129
|
+
* The files to be updated. For certain known files ("package.json", "bower.json", etc.)
|
|
130
|
+
* `versionBump()` will explicitly update the file's version number. For other files
|
|
131
|
+
* (ReadMe files, config files, source code, etc.) it will simply do a global replacement
|
|
132
|
+
* of the old version number with the new version number.
|
|
133
|
+
*
|
|
134
|
+
* Defaults to ["package.json", "package-lock.json"]
|
|
135
|
+
*/
|
|
136
|
+
files?: string[];
|
|
137
|
+
/**
|
|
138
|
+
* The working directory, which is used as the basis for locating all files.
|
|
139
|
+
*
|
|
140
|
+
* Defaults to `process.cwd()`
|
|
141
|
+
*/
|
|
142
|
+
cwd?: string;
|
|
143
|
+
/**
|
|
144
|
+
* Options for the command-line interface. Can be one of the following:
|
|
145
|
+
*
|
|
146
|
+
* - `true` - To default to `process.stdin` and `process.stdout`.
|
|
147
|
+
* - `false` - To disable all CLI output. Cannot be used when `release` is "prompt".
|
|
148
|
+
* - An object that will be passed to `readline.createInterface()`.
|
|
149
|
+
*
|
|
150
|
+
* Defaults to `true`.
|
|
151
|
+
*/
|
|
152
|
+
interface?: boolean | InterfaceOptions;
|
|
153
|
+
/**
|
|
154
|
+
* Indicates whether to ignore version scripts.
|
|
155
|
+
*
|
|
156
|
+
* Defaults to `false`.
|
|
157
|
+
*/
|
|
158
|
+
ignoreScripts?: boolean;
|
|
159
|
+
/**
|
|
160
|
+
* A callback that is provides information about the progress of the `versionBump()` function.
|
|
161
|
+
*/
|
|
162
|
+
progress?(progress: VersionBumpProgress): void;
|
|
163
|
+
/**
|
|
164
|
+
* Excute additional command after bumping and before commiting
|
|
165
|
+
*/
|
|
166
|
+
execute?: string;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Options for the command-line interface.
|
|
170
|
+
*/
|
|
171
|
+
interface InterfaceOptions {
|
|
172
|
+
/**
|
|
173
|
+
* The stream that will be used to read user input. Can be one of the following:
|
|
174
|
+
*
|
|
175
|
+
* - `true` - To default to `process.stdin`
|
|
176
|
+
* - `false` - To disable all CLI input
|
|
177
|
+
* - Any readable stream
|
|
178
|
+
*
|
|
179
|
+
* Defaults to `true`.
|
|
180
|
+
*/
|
|
181
|
+
input?: NodeJS.ReadableStream | NodeJS.ReadStream | boolean;
|
|
182
|
+
/**
|
|
183
|
+
* The stream that will be used to write output, such as prompts and progress.
|
|
184
|
+
* Can be one of the following:
|
|
185
|
+
*
|
|
186
|
+
* - `true` - To default to `process.stdout`
|
|
187
|
+
* - `false` - To disable all CLI output
|
|
188
|
+
* - Any writable stream
|
|
189
|
+
*
|
|
190
|
+
* Defaults to `true`.
|
|
191
|
+
*/
|
|
192
|
+
output?: NodeJS.WritableStream | NodeJS.WriteStream | boolean;
|
|
193
|
+
/**
|
|
194
|
+
* Any other properties will be passed directly to `readline.createInterface()`.
|
|
195
|
+
* See the `ReadLineOptions` interface for possible options.
|
|
196
|
+
*/
|
|
197
|
+
[key: string]: unknown;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Prompts the user for a version number and updates package.json and package-lock.json.
|
|
202
|
+
*
|
|
203
|
+
* @returns - The new version number
|
|
204
|
+
*/
|
|
205
|
+
declare function versionBump(): Promise<VersionBumpResults>;
|
|
206
|
+
/**
|
|
207
|
+
* Bumps the version number in package.json, package-lock.json.
|
|
208
|
+
*
|
|
209
|
+
* @param release
|
|
210
|
+
* The release version or type. Can be one of the following:
|
|
211
|
+
*
|
|
212
|
+
* - The new version number (e.g. "1.23.456")
|
|
213
|
+
* - A release type (e.g. "major", "minor", "patch", "prerelease", etc.)
|
|
214
|
+
* - "prompt" to prompt the user for the version number
|
|
215
|
+
*/
|
|
216
|
+
declare function versionBump(release: string): Promise<VersionBumpResults>;
|
|
217
|
+
/**
|
|
218
|
+
* Bumps the version number in one or more files, prompting the user if necessary.
|
|
219
|
+
* Optionally also commits, tags, and pushes to git.
|
|
5
220
|
*/
|
|
6
|
-
declare function
|
|
221
|
+
declare function versionBump(options: VersionBumpOptions): Promise<VersionBumpResults>;
|
|
7
222
|
|
|
8
|
-
export {
|
|
223
|
+
export { InterfaceOptions, NpmScript, ProgressEvent, VersionBumpOptions, VersionBumpProgress, VersionBumpResults, versionBump as default, versionBump };
|