bumpp 8.2.1 → 9.1.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.
@@ -1,43 +1,32 @@
1
1
  import {
2
- ProgressEvent,
3
2
  __toESM,
4
- init_esm_shims,
3
+ bumpConfigDefaults,
5
4
  isReleaseType,
6
- require_log_symbols,
5
+ loadBumpConfig,
6
+ log_symbols_default,
7
+ require_picocolors,
7
8
  versionBump
8
- } from "../chunk-DW6HTJ47.mjs";
9
-
10
- // src/cli/index.ts
11
- init_esm_shims();
12
- var import_log_symbols = __toESM(require_log_symbols());
9
+ } from "../chunk-L3LY4KGC.mjs";
13
10
 
14
11
  // package.json
15
- var version = "8.2.1";
16
-
17
- // src/cli/exit-code.ts
18
- init_esm_shims();
19
- var ExitCode = /* @__PURE__ */ ((ExitCode2) => {
20
- ExitCode2[ExitCode2["Success"] = 0] = "Success";
21
- ExitCode2[ExitCode2["FatalError"] = 1] = "FatalError";
22
- ExitCode2[ExitCode2["InvalidArgument"] = 9] = "InvalidArgument";
23
- return ExitCode2;
24
- })(ExitCode || {});
12
+ var version = "9.1.0";
25
13
 
26
14
  // src/cli/parse-args.ts
27
- init_esm_shims();
15
+ var import_picocolors = __toESM(require_picocolors());
28
16
  import { valid as isValidVersion } from "semver";
29
17
  import cac from "cac";
30
- function parseArgs() {
18
+ async function parseArgs() {
19
+ var _a;
31
20
  try {
32
21
  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();
22
+ cli.version(version).usage("[...files]").option("--preid <preid>", "ID for prerelease").option("--all", `Include all files (default: ${bumpConfigDefaults.all})`).option("-c, --commit [msg]", `Commit message (default: ${bumpConfigDefaults.commit})`).option("-t, --tag [tag]", `Tag name (default: ${bumpConfigDefaults.tag})`).option("-p, --push", `Push to remote (default: ${bumpConfigDefaults.push})`).option("-y, --yes", `Skip confirmation (default: ${!bumpConfigDefaults.confirm})`).option("-r, --recursive", `Bump package.json files recursively (default: ${bumpConfigDefaults.recursive})`).option("--no-verify", "Skip git verification").option("--ignore-scripts", `Ignore scripts (default: ${bumpConfigDefaults.ignoreScripts})`).option("-q, --quiet", "Quiet mode").option("-v, --version <version>", "Tagert version").option("-x, --execute <command>", "Commands to execute after version bumps").help();
34
23
  const result = cli.parse();
35
24
  const args = result.options;
36
25
  const parsedArgs = {
37
26
  help: args.help,
38
27
  version: args.version,
39
28
  quiet: args.quiet,
40
- options: {
29
+ options: await loadBumpConfig({
41
30
  preid: args.preid,
42
31
  commit: args.commit,
43
32
  tag: args.tag,
@@ -47,8 +36,9 @@ function parseArgs() {
47
36
  noVerify: !args.verify,
48
37
  files: [...args["--"] || [], ...result.args],
49
38
  ignoreScripts: args.ignoreScripts,
50
- execute: args.execute
51
- }
39
+ execute: args.execute,
40
+ recursive: !!args.recursive
41
+ })
52
42
  };
53
43
  if (parsedArgs.options.files && parsedArgs.options.files.length > 0) {
54
44
  const firstArg = parsedArgs.options.files[0];
@@ -57,6 +47,12 @@ function parseArgs() {
57
47
  parsedArgs.options.files.shift();
58
48
  }
59
49
  }
50
+ if (parsedArgs.options.recursive) {
51
+ if ((_a = parsedArgs.options.files) == null ? void 0 : _a.length)
52
+ console.log(import_picocolors.default.yellow("The --recursive option is ignored when files are specified"));
53
+ else
54
+ parsedArgs.options.files = ["package.json", "package-lock.json", "packages/**/package.json"];
55
+ }
60
56
  return parsedArgs;
61
57
  } catch (error) {
62
58
  return errorHandler(error);
@@ -72,7 +68,7 @@ async function main() {
72
68
  try {
73
69
  process.on("uncaughtException", errorHandler2);
74
70
  process.on("unhandledRejection", errorHandler2);
75
- const { help, version: version2, quiet, options } = parseArgs();
71
+ const { help, version: version2, quiet, options } = await parseArgs();
76
72
  if (help) {
77
73
  process.exit(0 /* Success */);
78
74
  } else if (version2) {
@@ -80,7 +76,7 @@ async function main() {
80
76
  process.exit(0 /* Success */);
81
77
  } else {
82
78
  if (!quiet)
83
- options.progress = progress;
79
+ options.progress = options.progress ? options.progress : progress;
84
80
  await versionBump(options);
85
81
  }
86
82
  } catch (error) {
@@ -90,22 +86,22 @@ async function main() {
90
86
  function progress({ event, script, updatedFiles, skippedFiles, newVersion }) {
91
87
  switch (event) {
92
88
  case "file updated" /* FileUpdated */:
93
- console.log(import_log_symbols.success, `Updated ${updatedFiles.pop()} to ${newVersion}`);
89
+ console.log(log_symbols_default.success, `Updated ${updatedFiles.pop()} to ${newVersion}`);
94
90
  break;
95
91
  case "file skipped" /* FileSkipped */:
96
- console.log(import_log_symbols.info, `${skippedFiles.pop()} did not need to be updated`);
92
+ console.log(log_symbols_default.info, `${skippedFiles.pop()} did not need to be updated`);
97
93
  break;
98
94
  case "git commit" /* GitCommit */:
99
- console.log(import_log_symbols.success, "Git commit");
95
+ console.log(log_symbols_default.success, "Git commit");
100
96
  break;
101
97
  case "git tag" /* GitTag */:
102
- console.log(import_log_symbols.success, "Git tag");
98
+ console.log(log_symbols_default.success, "Git tag");
103
99
  break;
104
100
  case "git push" /* GitPush */:
105
- console.log(import_log_symbols.success, "Git push");
101
+ console.log(log_symbols_default.success, "Git push");
106
102
  break;
107
103
  case "npm script" /* NpmScript */:
108
- console.log(import_log_symbols.success, `Npm run ${script}`);
104
+ console.log(log_symbols_default.success, `Npm run ${script}`);
109
105
  break;
110
106
  }
111
107
  }
package/dist/index.d.ts CHANGED
@@ -170,6 +170,12 @@ interface VersionBumpOptions {
170
170
  * Excute additional command after bumping and before commiting
171
171
  */
172
172
  execute?: string;
173
+ /**
174
+ * Bump the files recursively for monorepo. Only works without `files` option.
175
+ *
176
+ * @default false
177
+ */
178
+ recursive?: boolean;
173
179
  }
174
180
  /**
175
181
  * Options for the command-line interface.
@@ -232,7 +238,7 @@ interface BumpRelease {
232
238
  /**
233
239
  * One of the possible Release types.
234
240
  */
235
- declare type Release = VersionRelease | PromptRelease | BumpRelease;
241
+ type Release = VersionRelease | PromptRelease | BumpRelease;
236
242
  /**
237
243
  * Normalized and sanitized options
238
244
  */
@@ -329,4 +335,8 @@ declare function versionBump(options: VersionBumpOptions): Promise<VersionBumpRe
329
335
  */
330
336
  declare function versionBumpInfo(arg?: VersionBumpOptions | string): Promise<Operation>;
331
337
 
332
- export { InterfaceOptions, NpmScript, ProgressEvent, VersionBumpOptions, VersionBumpProgress, VersionBumpResults, versionBump as default, versionBump, versionBumpInfo };
338
+ declare const bumpConfigDefaults: VersionBumpOptions;
339
+ declare function loadBumpConfig(overrides?: Partial<VersionBumpOptions>, cwd?: string): Promise<VersionBumpOptions>;
340
+ declare function defineConfig(config: Partial<VersionBumpOptions>): Partial<VersionBumpOptions>;
341
+
342
+ export { InterfaceOptions, NpmScript, ProgressEvent, VersionBumpOptions, VersionBumpProgress, VersionBumpResults, bumpConfigDefaults, versionBump as default, defineConfig, loadBumpConfig, versionBump, versionBumpInfo };