cross-release-cli 0.3.0 → 0.5.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/README.md CHANGED
@@ -13,7 +13,8 @@ pnpm i -D cross-release
13
13
  ```json
14
14
  {
15
15
  "scripts": {
16
- "release": "cross-release"
16
+ "release": "cross-release -ax 'pnpm changelog' && pnpm build && pnpm -r publish",
17
+ "changelog": "conventional-changelog -si CHANGELOG.md",
17
18
  }
18
19
  }
19
20
  ```
@@ -26,23 +27,34 @@ pnpm run release
26
27
 
27
28
  ## Command line
28
29
 
29
- | short | long | description | default |
30
- | ----- | ---------------------- | --------------------------------------------------- | ----------------------------------------------- |
31
- | -V | --version | output the version number | false |
32
- | -a | --all | Add all changed files to staged | false |
33
- | -c | --config [file] | Config file | auto detect |
34
- | -D | --dry | Dry run | false |
35
- | -d | --debug | Enable debug mode | false |
36
- | -e | --exclude [dir] | Folders to exclude from search | ["node_modules",".git","target","build","dist"] |
37
- | -m | --main | Base project language [e.g. java, rust, javascript] | "javascript" |
38
- | -r | --recursive | Run the command for each project in the workspace | false |
39
- | -x | --execute [command...] | Execute the command | [] |
40
- | -y | --yes | Answer yes to all prompts | false |
41
- | | --cwd [dir] | Set working directory | process.cwd() |
42
- | -c | --no-commit | Skip committing changes | false |
43
- | -p | --no-push | Skip pushing | false |
44
- | -t | --no-tag | Skip tagging | false |
45
- | -h | --help | Display this message | false |
30
+ ```
31
+ Usage:
32
+ $ cross-release [version] [options]
33
+
34
+ Options:
35
+ -v, --version Display version number
36
+ -a, --all shortcut for --commit.stageAll
37
+ -c, --config [file] Config file (auto detect by default)
38
+ -D, --dry Dry run
39
+ -d, --debug Enable debug mode
40
+ -e, --exclude [dir...] Folders to exclude from search
41
+ -m, --main [lang] Base project language [e.g. java, rust, javascript]
42
+ -r, --recursive Run the command for each project in the workspace
43
+ -x, --execute [command...] Execute the command
44
+ -y, --yes Answer yes to all prompts
45
+ --cwd [dir] Set working directory
46
+ --commit Committing changes
47
+ --commit.signoff Commit with signoff
48
+ --commit.stageAll Stage all changes before commit
49
+ --commit.template <template> Template for commit message
50
+ --commit.verify Verify commit message
51
+ --push Pushing Commit to remote
52
+ --push.followTags Pushing with follow tags
53
+ --push.branch <branch> Branch name to push
54
+ --tag Tagging for release
55
+ --tag.template <template> Template for tag message
56
+ -h, --help Display this message
57
+ ```
46
58
 
47
59
  ## Configuration
48
60
 
@@ -65,6 +77,7 @@ export default {
65
77
  "cross-release": {
66
78
  // "commit": false,
67
79
  commit: {
80
+ signoff: true,
68
81
  // Whether to stage all un-staged files or stage only changed files
69
82
  stageAll: false,
70
83
  // the symbol '%s' will be replace to the version number that you specified
@@ -76,6 +89,8 @@ export default {
76
89
  dry: false,
77
90
  // Your config will be append within default exclude folders
78
91
  excludes: ["path/to/exclude"],
92
+ // use for read current version number
93
+ main: "javascript",
79
94
  // "push": false,
80
95
  push: {
81
96
  branch: false,
@@ -2,6 +2,6 @@
2
2
 
3
3
  "use strict"
4
4
 
5
- const App = await import("../dist/app.js")
5
+ const App = await import("../dist/app.mjs")
6
6
  const app = new App.default()
7
7
  void app.run()
@@ -1,4 +1,4 @@
1
- import { ReleaseOptions } from "./types-D4PQyQEq.js";
1
+ import { n as ReleaseOptions } from "./types-CSTfUwO2.mjs";
2
2
  import { ProjectFile } from "cross-bump";
3
3
 
4
4
  //#region src/app.d.ts
@@ -13,6 +13,7 @@ declare class App {
13
13
  private _taskStatus;
14
14
  constructor(argv?: string[]);
15
15
  checkGitClean(): void;
16
+ checkGitRemote(): void;
16
17
  confirmReleaseOptions(): Promise<void>;
17
18
  executeTasks(): Promise<void>;
18
19
  resolveExecutes(): void;
@@ -24,5 +25,6 @@ declare class App {
24
25
  get nextVersion(): string;
25
26
  get options(): ReleaseOptions;
26
27
  get projectFiles(): ProjectFile[];
27
- } //#endregion
28
+ }
29
+ //#endregion
28
30
  export { App as default };
@@ -45,8 +45,8 @@ function loadDefaultConfigFile(cwd = process.cwd()) {
45
45
  sources: [{ files: "cross-release.config" }, {
46
46
  extensions: ["json"],
47
47
  files: "package",
48
- rewrite(config$1) {
49
- return config$1["cross-release"];
48
+ rewrite(config) {
49
+ return config["cross-release"];
50
50
  }
51
51
  }]
52
52
  }) ?? {};
@@ -68,13 +68,14 @@ function loadUserConfig(opts) {
68
68
  *
69
69
  * @see https://nodejs.org/api/process.html#process_exit_codes
70
70
  */
71
- let ExitCode = /* @__PURE__ */ function(ExitCode$1) {
72
- ExitCode$1[ExitCode$1["Canceled"] = 2] = "Canceled";
73
- ExitCode$1[ExitCode$1["FatalError"] = 1] = "FatalError";
74
- ExitCode$1[ExitCode$1["GitDirty"] = 3] = "GitDirty";
75
- ExitCode$1[ExitCode$1["InvalidArgument"] = 9] = "InvalidArgument";
76
- ExitCode$1[ExitCode$1["Success"] = 0] = "Success";
77
- return ExitCode$1;
71
+ let ExitCode = /* @__PURE__ */ function(ExitCode) {
72
+ ExitCode[ExitCode["Canceled"] = 2] = "Canceled";
73
+ ExitCode[ExitCode["FatalError"] = 1] = "FatalError";
74
+ ExitCode[ExitCode["GitDirty"] = 3] = "GitDirty";
75
+ ExitCode[ExitCode["GitUnreachable"] = 4] = "GitUnreachable";
76
+ ExitCode[ExitCode["InvalidArgument"] = 9] = "InvalidArgument";
77
+ ExitCode[ExitCode["Success"] = 0] = "Success";
78
+ return ExitCode;
78
79
  }({});
79
80
  const CONFIG_DEFAULT = {
80
81
  commit: {
@@ -150,14 +151,13 @@ const cliOptions = z.object({
150
151
 
151
152
  //#endregion
152
153
  //#region package.json
153
- var version = "0.2.2";
154
+ var version = "0.4.0";
154
155
 
155
156
  //#endregion
156
157
  //#region src/cli.ts
157
158
  const debug$3 = createDebug("cli");
158
159
  function createCliProgram(argv) {
159
- const cli = cac("cross-release").usage("A release tool that support multi programming language").version(version).usage("[version] [options]").option("-a, --all", "shortcut for --commit.stageAll").option("-c, --config [file]", "Config file (auto detect by default)").option("-D, --dry", "Dry run").option("-d, --debug", "Enable debug mode").option("-e, --exclude [dir...]", "Folders to exclude from search").option("-m, --main [lang]", "Base project language [e.g. java, rust, javascript]").option("-r, --recursive", "Run the command for each project in the workspace").option("-x, --execute [command...]", "Execute the command").option("-y, --yes", "Answer yes to all prompts").option("--cwd [dir]", "Set working directory").option("--commit", "Committing changes").option("--commit.signoff", "Commit with signoff").option("--commit.stageAll", "Stage all changes before commit").option("--commit.template <template>", "Template for commit message").option("--commit.verify", "Verify commit message").option("--push", "Pushing Commit to remote").option("--push.followTags", "Pushing with follow tags").option("--push.branch <branch>", "Branch name to push").option("--push.followTags", "pushing with follow tags").option("--tag", "Tagging for release").option("--tag.template <template>", "Template for tag message").help();
160
- return cli.parse(argv);
160
+ return cac("cross-release").usage("A release tool that support multi programming language").version(version).usage("[version] [options]").option("-a, --all", "shortcut for --commit.stageAll").option("-c, --config [file]", "Config file (auto detect by default)").option("-D, --dry", "Dry run").option("-d, --debug", "Enable debug mode").option("-e, --exclude [dir...]", "Folders to exclude from search").option("-m, --main [lang]", "Base project language [e.g. java, rust, javascript]").option("-r, --recursive", "Run the command for each project in the workspace").option("-x, --execute [command...]", "Execute the command").option("-y, --yes", "Answer yes to all prompts").option("--cwd [dir]", "Set working directory").option("--commit", "Committing changes").option("--commit.signoff", "Commit with signoff").option("--commit.stageAll", "Stage all changes before commit").option("--commit.template <template>", "Template for commit message").option("--commit.verify", "Verify commit message").option("--push", "Pushing Commit to remote").option("--push.followTags", "Pushing with follow tags").option("--push.branch <branch>", "Branch name to push").option("--tag", "Tagging for release").option("--tag.template <template>", "Template for tag message").help().parse(argv);
161
161
  }
162
162
  function argvToReleaseOptions(cli) {
163
163
  const { args, options } = cli;
@@ -181,8 +181,7 @@ function argvToReleaseOptions(cli) {
181
181
  return opts;
182
182
  }
183
183
  function pathToAbs(opts) {
184
- const shouldBeAbsolute = ["cwd", "config"];
185
- for (const key of shouldBeAbsolute) {
184
+ for (const key of ["cwd", "config"]) {
186
185
  if (!opts[key]) continue;
187
186
  if (key === "cwd") opts.cwd = toAbsolute(opts.cwd);
188
187
  opts[key] = path.resolve(opts.cwd, opts[key]);
@@ -208,8 +207,7 @@ function validateOptions(cli) {
208
207
  }
209
208
  function resolveAppOptions(cli) {
210
209
  const opts = argvToReleaseOptions(cli);
211
- const userConfig = loadUserConfig(opts);
212
- const crOptions = merge(CONFIG_DEFAULT, userConfig, opts);
210
+ const crOptions = merge(CONFIG_DEFAULT, loadUserConfig(opts), opts);
213
211
  validateOptions(crOptions);
214
212
  setupDebug(crOptions);
215
213
  resolveGitIgnore(crOptions);
@@ -225,30 +223,43 @@ const execa = execaSync({
225
223
  all: true,
226
224
  reject: false
227
225
  });
226
+ function gitLsRemote(options) {
227
+ const { cwd = process.cwd(), dry = false, mode = "branches", pattern, remote, repository = "origin" } = options;
228
+ const s = spinner();
229
+ s.start("listing remote...");
230
+ const args = [];
231
+ if (remote) args.push(remote);
232
+ if (mode) args.push(`--${mode}`);
233
+ args.push(repository);
234
+ if (pattern) args.push(pattern);
235
+ debug$2(`command: git ls-remote ${args.join(" ")}`);
236
+ if (!dry) {
237
+ const { all, failed, shortMessage } = execa("git", ["ls-remote", ...args], { cwd });
238
+ debug$2("git ls-remote stdout:", all);
239
+ if (failed) {
240
+ s.error(shortMessage);
241
+ return false;
242
+ }
243
+ }
244
+ s.stop(`listed remote`);
245
+ return true;
246
+ }
228
247
  function gitTag(options) {
229
- const { cwd = process.cwd(), del = false, dry = false, force = false, message: message$1, tagName: name } = options ?? {};
248
+ const { cwd = process.cwd(), del = false, dry = false, force = false, message, tagName: name } = options ?? {};
230
249
  const s = spinner();
231
250
  s.start("creating tag...");
232
251
  const args = [];
233
252
  if (del) args.push("--delete");
234
- else if (!message$1 || message$1?.length === 0) log.warn("no message provided, is recommended to provide a message for create an annotated tag");
235
- else args.push(
236
- // Create an annotated tag, which is recommended for releases.
237
- // See https://git-scm.com/docs/git-tag
238
- "--annotate",
239
- // Use the same commit message for the tag
240
- "--message",
241
- // formatMessageString(template, nextVersion),
242
- message$1
243
- );
253
+ else if (!message || message?.length === 0) log.warn("no message provided, is recommended to provide a message for create an annotated tag");
254
+ else args.push("--annotate", "--message", message);
244
255
  if (force) args.push("--force");
245
256
  args.push(name);
246
257
  debug$2(`command: git tag ${args.join(" ")}`);
247
258
  if (!dry) {
248
- const { all, exitCode, failed, shortMessage } = execa("git", ["tag", ...args], { cwd });
259
+ const { all, failed, shortMessage } = execa("git", ["tag", ...args], { cwd });
249
260
  debug$2("git tag stdout:", all);
250
261
  if (failed) {
251
- s.stop(color.red(shortMessage), exitCode);
262
+ s.error(shortMessage);
252
263
  return false;
253
264
  }
254
265
  }
@@ -256,25 +267,25 @@ function gitTag(options) {
256
267
  return true;
257
268
  }
258
269
  function gitCommit(options) {
259
- const { cwd = process.cwd(), dry = false, message: message$1, modifiedFiles = [], signoff, stageAll, verify } = options ?? {};
270
+ const { cwd = process.cwd(), dry = false, message, modifiedFiles = [], signoff, stageAll, verify } = options ?? {};
260
271
  const s = spinner();
261
272
  s.start("committing...");
262
273
  const args = [];
263
- args.push("--message", message$1);
274
+ args.push("--message", message);
264
275
  !verify && args.push("--no-verify");
265
276
  if (!stageAll && modifiedFiles.length > 0) args.push("--", ...modifiedFiles);
266
277
  else args.push("--all");
267
278
  if (signoff) args.push("--signoff");
268
279
  debug$2(`command: git commit ${args.join(" ")}`);
269
280
  if (!dry) {
270
- const { all, exitCode, failed, shortMessage } = execa("git", ["commit", ...args], { cwd });
281
+ const { all, failed, shortMessage } = execa("git", ["commit", ...args], { cwd });
271
282
  debug$2("git commit stdout: %s", all);
272
283
  if (failed) {
273
- s.stop(color.red(shortMessage), exitCode);
284
+ s.error(shortMessage);
274
285
  return false;
275
286
  }
276
287
  }
277
- s.stop(`commit message: ${color.green(message$1)}`);
288
+ s.stop(`commit message: ${color.green(message)}`);
278
289
  return true;
279
290
  }
280
291
  function gitPush(options = {}) {
@@ -289,10 +300,10 @@ function gitPush(options = {}) {
289
300
  followTags && args.push("--follow-tags");
290
301
  debug$2(`command: git push ${args.join(" ")}`);
291
302
  if (!dry) {
292
- const { all, exitCode, failed, shortMessage } = execa("git", ["push", ...args], { cwd });
303
+ const { all, failed, shortMessage } = execa("git", ["push", ...args], { cwd });
293
304
  debug$2("git push stdout: %s", all);
294
305
  if (failed) {
295
- s.stop(color.red(shortMessage), exitCode);
306
+ s.error(shortMessage);
296
307
  return false;
297
308
  }
298
309
  }
@@ -301,12 +312,11 @@ function gitPush(options = {}) {
301
312
  return true;
302
313
  }
303
314
  function gitOriginUrl() {
304
- const command = execa("git", [
315
+ return execa("git", [
305
316
  "remote",
306
317
  "get-url",
307
318
  "origin"
308
- ]);
309
- return command.stdout.trim();
319
+ ]).stdout.trim();
310
320
  }
311
321
  function gitAdd(options = {}) {
312
322
  const { all = false, cwd = process.cwd(), dry = false, files = [] } = options;
@@ -315,16 +325,15 @@ function gitAdd(options = {}) {
315
325
  else if (files.length > 0) args.push("--", ...files);
316
326
  debug$2("command: git add", args.join(" "));
317
327
  if (!dry) {
318
- const { all: all$1, failed } = execa("git", ["add", ...args], { cwd });
319
- debug$2("git add stdout:", all$1);
328
+ const { all, failed } = execa("git", ["add", ...args], { cwd });
329
+ debug$2("git add stdout:", all);
320
330
  if (failed) return false;
321
331
  }
322
332
  return true;
323
333
  }
324
334
  function isGitClean(options = {}) {
325
335
  const { cwd = process.cwd() } = options;
326
- const args = ["status", "--porcelain"];
327
- const { all, failed } = execa("git", args, { cwd });
336
+ const { all, failed } = execa("git", ["status", "--porcelain"], { cwd });
328
337
  if (all) return false;
329
338
  return !failed;
330
339
  }
@@ -357,8 +366,7 @@ function getStagedFiles(opts = {}) {
357
366
  * @return The chosen version.
358
367
  */
359
368
  async function chooseVersion(currentVersion) {
360
- const versionObj = parseVersion(currentVersion);
361
- const { nextMajor, nextMinor, nextPatch, nextPreMajor, nextPreMinor, nextPrePatch, nextRelease } = getNextVersions(versionObj ?? void 0);
369
+ const { nextMajor, nextMinor, nextPatch, nextPreMajor, nextPreMinor, nextPrePatch, nextRelease } = getNextVersions(parseVersion(currentVersion) ?? void 0);
362
370
  const C_CUSTOM = "custom";
363
371
  const versions = [
364
372
  {
@@ -452,8 +460,7 @@ var App = class {
452
460
  constructor(argv = process.argv) {
453
461
  const cli = createCliProgram(argv);
454
462
  if (cli.options.help) process.exit(ExitCode.Success);
455
- const opts = resolveAppOptions(cli);
456
- this._options = opts;
463
+ this._options = resolveAppOptions(cli);
457
464
  }
458
465
  #addTask(task, idx) {
459
466
  const expect = this._taskQueue.length + 1;
@@ -489,21 +496,31 @@ var App = class {
489
496
  checkGitClean() {
490
497
  const { cwd } = this._options;
491
498
  const commit = resolveAltOptions(this._options, "commit");
492
- const isClean = isGitClean({ cwd });
493
- if (!isClean && !commit.stageAll) {
494
- log.warn("git is not clean, please commit or stash your changes before release");
499
+ if (!isGitClean({ cwd }) && !commit.stageAll) {
500
+ log.warn("git is not clean, please commit or stash your changes");
495
501
  this.#done();
496
502
  process.exit(ExitCode.GitDirty);
497
503
  }
498
504
  }
505
+ checkGitRemote() {
506
+ const { cwd, debug, dry } = this._options;
507
+ if (!gitLsRemote({
508
+ cwd,
509
+ dry: dry || debug
510
+ })) {
511
+ log.warn("git remote not found, please add remote or check your network");
512
+ this.#done();
513
+ process.exit(ExitCode.GitUnreachable);
514
+ }
515
+ }
499
516
  async confirmReleaseOptions() {
500
517
  const { cwd, dry, yes } = this._options;
501
- const confirmTask = async (name, message$1, exec) => {
518
+ const confirmTask = async (name, message, exec) => {
502
519
  if (yes) {
503
520
  if (!this._options[name]) return;
504
521
  this._options[name] = true;
505
522
  } else if (this._options[name]) {
506
- const confirmation = await confirm({ message: message$1 });
523
+ const confirmation = await confirm({ message });
507
524
  this._options[name] = handleUserCancel(confirmation);
508
525
  }
509
526
  if (this._options[name]) this.#addTask({
@@ -598,18 +615,14 @@ var App = class {
598
615
  }
599
616
  }
600
617
  async resolveNextVersion() {
601
- const { main, version: version$1 } = this._options;
618
+ const { main, version } = this._options;
602
619
  const mainProjectFile = this._projectFiles.find((file) => file.category === main);
603
620
  if (!mainProjectFile) throw new Error(`can't found ${main} project file in the project root`);
604
- const projectVersion = await getProjectVersion(mainProjectFile);
605
- this._currentVersion = projectVersion ?? "";
606
- if (isVersionValid(version$1)) {
607
- this._nextVersion = version$1;
621
+ this._currentVersion = await getProjectVersion(mainProjectFile) ?? "";
622
+ if (isVersionValid(version)) {
623
+ this._nextVersion = version;
608
624
  log.info(`current version: ${this._currentVersion}, next version: ${color.blue(this._nextVersion)}`);
609
- } else {
610
- const nextVersion = await chooseVersion(this._currentVersion);
611
- this._nextVersion = handleUserCancel(nextVersion);
612
- }
625
+ } else this._nextVersion = handleUserCancel(await chooseVersion(this._currentVersion));
613
626
  }
614
627
  resolveProjectFiles() {
615
628
  const { cwd, exclude, recursive } = this._options;
@@ -643,6 +656,7 @@ var App = class {
643
656
  async run() {
644
657
  this.#start();
645
658
  this.checkGitClean();
659
+ this.checkGitRemote();
646
660
  this.resolveProjectFiles();
647
661
  await this.resolveNextVersion();
648
662
  this.resolveProjects();
@@ -664,7 +678,6 @@ var App = class {
664
678
  return this._projectFiles;
665
679
  }
666
680
  };
667
- var app_default = App;
668
681
 
669
682
  //#endregion
670
- export { app_default as default };
683
+ export { App as default };
@@ -1,7 +1,6 @@
1
- import { DefineConfigOptions } from "./types-D4PQyQEq.js";
1
+ import { t as DefineConfigOptions } from "./types-CSTfUwO2.mjs";
2
2
 
3
3
  //#region src/index.d.ts
4
4
  declare function defineConfig(config: DefineConfigOptions): DefineConfigOptions;
5
-
6
5
  //#endregion
7
6
  export { defineConfig };
@@ -0,0 +1,113 @@
1
+ import { ProjectCategory } from "cross-bump";
2
+ import "cac";
3
+
4
+ //#region src/types.d.ts
5
+ type DefineConfigOptions = Partial<Omit<ReleaseOptions, "config">>;
6
+ type ReleaseOptions = {
7
+ /**
8
+ * Indicates whether to commit the changes.
9
+ */
10
+ commit: boolean | CommitOptions;
11
+ /**
12
+ * Specifies the path to the configuration file.
13
+ */
14
+ config: string;
15
+ /**
16
+ * The directory path where the operation will be performed.
17
+ * @default process.cwd()
18
+ */
19
+ cwd: string;
20
+ /**
21
+ * Enable debug log
22
+ */
23
+ debug: boolean;
24
+ /**
25
+ * Whether the operation is being run in a dry-run mode (simulated execution).
26
+ */
27
+ dry: boolean;
28
+ /**
29
+ * The list of directories to exclude from the search.
30
+ * @default ["node_modules", ".git", "target", "build", "dist"]
31
+ */
32
+ exclude: string[];
33
+ /**
34
+ * The command to execute before pushing.
35
+ */
36
+ execute: string[];
37
+ /**
38
+ * Specifies the main project category.
39
+ */
40
+ main: ProjectCategory;
41
+ /**
42
+ * Whether push changes to remote and push options
43
+ * @default false
44
+ */
45
+ push: boolean | PushOptions;
46
+ /**
47
+ * Specifies whether the operation should be performed recursively.
48
+ * @default false
49
+ */
50
+ recursive: boolean;
51
+ /**
52
+ * Indicates whether to create a tag for a release.
53
+ * @default false
54
+ */
55
+ tag: boolean | TagOptions;
56
+ /**
57
+ * The version string associated with the command or operation.
58
+ */
59
+ version: string;
60
+ /**
61
+ * Whether all prompts requiring user input will be answered with "yes".
62
+ * @default false
63
+ */
64
+ yes: boolean;
65
+ };
66
+ type CommitOptions = {
67
+ /**
68
+ * Whether to sign the commit.
69
+ * @default true
70
+ */
71
+ signoff?: true;
72
+ /**
73
+ * Whether to stage all files or only modified files.
74
+ * @default false
75
+ */
76
+ stageAll?: boolean;
77
+ /**
78
+ * The template string for the commit message. if the template contains any "%s" placeholders,
79
+ * then they are replaced with the version number;
80
+ * @default "chore: release v%s"
81
+ */
82
+ template?: string;
83
+ /**
84
+ * Whether to enable git pre-commit and commit-msg hook.
85
+ * @default true
86
+ */
87
+ verify?: boolean;
88
+ };
89
+ type PushOptions = {
90
+ /**
91
+ * The branch name, Use the same branch name as the local if not specified.
92
+ */
93
+ branch?: string;
94
+ /**
95
+ * Whether to follow tags
96
+ * @default true
97
+ */
98
+ followTags?: boolean;
99
+ /**
100
+ * The remote name, defaults to the upstream defined in the Git repository if not specified.
101
+ */
102
+ remote?: string;
103
+ };
104
+ type TagOptions = {
105
+ /**
106
+ * The template for tag name, same as @type {CommitOptions.template}
107
+ * if the template contains any "%s" placeholders,
108
+ * then they are replaced with the version number;
109
+ */
110
+ template?: string;
111
+ };
112
+ //#endregion
113
+ export { ReleaseOptions as n, DefineConfigOptions as t };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cross-release-cli",
3
3
  "type": "module",
4
- "version": "0.3.0",
4
+ "version": "0.5.0",
5
5
  "description": "command line app for cross language bump utility",
6
6
  "author": {
7
7
  "name": "rainbowatcher",
@@ -17,7 +17,8 @@
17
17
  "bugs": {
18
18
  "url": "https://github.com/rainbowatcher/cross-release/issues"
19
19
  },
20
- "main": "dist/index.js",
20
+ "main": "dist/index.mjs",
21
+ "types": "./dist/index.d.mts",
21
22
  "bin": {
22
23
  "cross-release": "./bin/cross-release.js"
23
24
  },
@@ -26,19 +27,19 @@
26
27
  "dist"
27
28
  ],
28
29
  "dependencies": {
29
- "@clack/prompts": "^0.10.1",
30
+ "@clack/prompts": "^1.0.0",
30
31
  "@rainbowatcher/common": "^0.7.0",
31
32
  "@rainbowatcher/fs-extra": "^0.7.0",
32
33
  "@rainbowatcher/path-extra": "^0.7.0",
33
34
  "cac": "^6.7.14",
34
- "debug": "^4.4.1",
35
+ "debug": "^4.4.3",
35
36
  "defu": "^6.1.4",
36
- "execa": "^9.5.3",
37
+ "execa": "^9.6.1",
37
38
  "is-unicode-supported": "^2.1.0",
38
39
  "picocolors": "^1.1.1",
39
- "unconfig": "^7.3.2",
40
- "zod": "^3.24.4",
41
- "cross-bump": "0.3.0"
40
+ "unconfig": "^7.4.2",
41
+ "zod": "^4.3.6",
42
+ "cross-bump": "0.5.0"
42
43
  },
43
44
  "devDependencies": {
44
45
  "@rainbowatcher/maybe": "^0.7.0"
@@ -1,112 +0,0 @@
1
- import { ProjectCategory } from "cross-bump";
2
-
3
- //#region src/types.d.ts
4
-
5
- type DefineConfigOptions = Partial<Omit<ReleaseOptions, "config">>;
6
- type ReleaseOptions = {
7
- /**
8
- * Indicates whether to commit the changes.
9
- */
10
- commit: boolean | CommitOptions;
11
- /**
12
- * Specifies the path to the configuration file.
13
- */
14
- config: string;
15
- /**
16
- * The directory path where the operation will be performed.
17
- * @default process.cwd()
18
- */
19
- cwd: string;
20
- /**
21
- * Enable debug log
22
- */
23
- debug: boolean;
24
- /**
25
- * Whether the operation is being run in a dry-run mode (simulated execution).
26
- */
27
- dry: boolean;
28
- /**
29
- * The list of directories to exclude from the search.
30
- * @default ["node_modules", ".git", "target", "build", "dist"]
31
- */
32
- exclude: string[];
33
- /**
34
- * The command to execute before pushing.
35
- */
36
- execute: string[];
37
- /**
38
- * Specifies the main project category.
39
- */
40
- main: ProjectCategory;
41
- /**
42
- * Whether push changes to remote and push options
43
- * @default false
44
- */
45
- push: boolean | PushOptions;
46
- /**
47
- * Specifies whether the operation should be performed recursively.
48
- * @default false
49
- */
50
- recursive: boolean;
51
- /**
52
- * Indicates whether to create a tag for a release.
53
- * @default false
54
- */
55
- tag: boolean | TagOptions;
56
- /**
57
- * The version string associated with the command or operation.
58
- */
59
- version: string;
60
- /**
61
- * Whether all prompts requiring user input will be answered with "yes".
62
- * @default false
63
- */
64
- yes: boolean;
65
- };
66
- type CommitOptions = {
67
- /**
68
- * Whether to sign the commit.
69
- * @default true
70
- */
71
- signoff?: true;
72
- /**
73
- * Whether to stage all files or only modified files.
74
- * @default false
75
- */
76
- stageAll?: boolean;
77
- /**
78
- * The template string for the commit message. if the template contains any "%s" placeholders,
79
- * then they are replaced with the version number;
80
- * @default "chore: release v%s"
81
- */
82
- template?: string;
83
- /**
84
- * Whether to enable git pre-commit and commit-msg hook.
85
- * @default true
86
- */
87
- verify?: boolean;
88
- };
89
- type PushOptions = {
90
- /**
91
- * The branch name, Use the same branch name as the local if not specified.
92
- */
93
- branch?: string;
94
- /**
95
- * Whether to follow tags
96
- * @default true
97
- */
98
- followTags?: boolean;
99
- /**
100
- * The remote name, defaults to the upstream defined in the Git repository if not specified.
101
- */
102
- remote?: string;
103
- };
104
- type TagOptions = {
105
- /**
106
- * The template for tag name, same as @type {CommitOptions.template}
107
- * if the template contains any "%s" placeholders,
108
- * then they are replaced with the version number;
109
- */
110
- template?: string;
111
- }; //#endregion
112
- export { DefineConfigOptions, ReleaseOptions };
File without changes