cross-release-cli 0.2.0 → 0.2.2

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/app.d.ts CHANGED
@@ -1,30 +1,28 @@
1
- import { ReleaseOptions } from "./types.d-PDBL5zNm.js";
1
+ import { ReleaseOptions } from "./types-D4PQyQEq.js";
2
2
  import { ProjectFile } from "cross-bump";
3
3
 
4
4
  //#region src/app.d.ts
5
5
  declare class App {
6
- #private;
7
- private _currentVersion;
8
- private _modifiedFiles;
9
- private _nextVersion;
10
- private _options;
11
- private _projectFiles;
12
- private _taskQueue;
13
- private _taskStatus;
14
- constructor(argv?: string[]);
15
- checkGitClean(): void;
16
- confirmReleaseOptions(): Promise<void>;
17
- executeTasks(): Promise<void>;
18
- resolveExecutes(): void;
19
- resolveNextVersion(): Promise<void>;
20
- resolveProjectFiles(): void;
21
- resolveProjects(): void;
22
- run(): Promise<void>;
23
- get currentVersion(): string;
24
- get nextVersion(): string;
25
- get options(): ReleaseOptions;
26
- get projectFiles(): ProjectFile[];
27
- }
28
-
29
- //#endregion
6
+ #private;
7
+ private _currentVersion;
8
+ private _modifiedFiles;
9
+ private _nextVersion;
10
+ private _options;
11
+ private _projectFiles;
12
+ private _taskQueue;
13
+ private _taskStatus;
14
+ constructor(argv?: string[]);
15
+ checkGitClean(): void;
16
+ confirmReleaseOptions(): Promise<void>;
17
+ executeTasks(): Promise<void>;
18
+ resolveExecutes(): void;
19
+ resolveNextVersion(): Promise<void>;
20
+ resolveProjectFiles(): void;
21
+ resolveProjects(): void;
22
+ run(): Promise<void>;
23
+ get currentVersion(): string;
24
+ get nextVersion(): string;
25
+ get options(): ReleaseOptions;
26
+ get projectFiles(): ProjectFile[];
27
+ } //#endregion
30
28
  export { App as default };
package/dist/app.js CHANGED
@@ -150,13 +150,13 @@ const cliOptions = z.object({
150
150
 
151
151
  //#endregion
152
152
  //#region package.json
153
- var version = "0.1.0";
153
+ var version = "0.2.1";
154
154
 
155
155
  //#endregion
156
156
  //#region src/cli.ts
157
157
  const debug$3 = createDebug("cli");
158
158
  function createCliProgram(argv) {
159
- const cli = cac("cross-release").usage("A release tool that support multi programming language").version(version).usage("[version] [options]").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", "Pushing Commit with signoff").option("--commit.stageAll", "Stage all changes before pushing").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").option("-h, --help", "Display this message").help();
159
+ const cli = cac("cross-release").usage("A release tool that support multi programming language").version(version).usage("[version] [options]").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", "Pushing Commit with signoff").option("--commit.stageAll", "Stage all changes before pushing").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
160
  return cli.parse(argv);
161
161
  }
162
162
  function argvToReleaseOptions(cli) {
@@ -323,14 +323,9 @@ function gitAdd(options = {}) {
323
323
  }
324
324
  function isGitClean(options = {}) {
325
325
  const { cwd = process.cwd() } = options;
326
- const args = [
327
- "diff-index",
328
- "--quiet",
329
- "HEAD",
330
- "--"
331
- ];
332
- const { failed, message: message$1 } = execa("git", args, { cwd });
333
- if (message$1?.includes("bad revision")) return true;
326
+ const args = ["status", "--porcelain"];
327
+ const { all, failed } = execa("git", args, { cwd });
328
+ if (all) return false;
334
329
  return !failed;
335
330
  }
336
331
  /**
@@ -456,6 +451,7 @@ var App = class {
456
451
  _taskStatus = "pending";
457
452
  constructor(argv = process.argv) {
458
453
  const cli = createCliProgram(argv);
454
+ if (cli.options.help) process.exit(ExitCode.Success);
459
455
  const opts = resolveAppOptions(cli);
460
456
  this._options = opts;
461
457
  }
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { DefineConfigOptions } from "./types.d-PDBL5zNm.js";
1
+ import { DefineConfigOptions } from "./types-D4PQyQEq.js";
2
2
 
3
3
  //#region src/index.d.ts
4
4
  declare function defineConfig(config: DefineConfigOptions): DefineConfigOptions;
@@ -0,0 +1,112 @@
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 };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cross-release-cli",
3
3
  "type": "module",
4
- "version": "0.2.0",
4
+ "version": "0.2.2",
5
5
  "description": "command line app for cross language bump utility",
6
6
  "author": {
7
7
  "name": "rainbowatcher",
@@ -31,14 +31,14 @@
31
31
  "@rainbowatcher/fs-extra": "^0.7.0",
32
32
  "@rainbowatcher/path-extra": "^0.7.0",
33
33
  "cac": "^6.7.14",
34
- "debug": "^4.4.0",
34
+ "debug": "^4.4.1",
35
35
  "defu": "^6.1.4",
36
- "execa": "^9.5.2",
36
+ "execa": "^9.5.3",
37
37
  "is-unicode-supported": "^2.1.0",
38
38
  "picocolors": "^1.1.1",
39
- "unconfig": "^7.3.1",
40
- "zod": "^3.24.3",
41
- "cross-bump": "0.2.0"
39
+ "unconfig": "^7.3.2",
40
+ "zod": "^3.24.4",
41
+ "cross-bump": "0.2.2"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@rainbowatcher/maybe": "^0.7.0"
@@ -1,114 +0,0 @@
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
-
113
- //#endregion
114
- export { DefineConfigOptions, ReleaseOptions };