Skip to content

Commit b3800da

Browse files
committed
feat: add --no-git-check
1 parent caddcb1 commit b3800da

5 files changed

Lines changed: 13 additions & 8 deletions

File tree

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ npm add @tomjs/release-cli -D
3636
## Usage
3737

3838
```bash
39-
$ rc --help
39+
$ rc -h
4040

4141
A CLI tool to automatically publish npm packages.
4242

@@ -52,6 +52,7 @@ Options
5252
If type is "prerelease", "prepatch", "preminor", "premajor",
5353
the preid will be used as the pre-release identifier (default: "alpha").
5454
If type is "patch", "minor", "major", the preid will be ignored.
55+
--no-git-check Skips checking git status (default: false)
5556
--any-branch Allow publishing from any branch (default: false)
5657
--branch Name of the release branch (default: main | master)
5758
--tag <tag> Publish under a given dist-tag (default: "latest")

README.zh_CN.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ npm add @tomjs/release-cli -D
3636
## 使用
3737

3838
```bash
39-
$ rc --help
39+
$ rc -h
4040

4141
A CLI tool to automatically publish npm packages.
4242

@@ -52,6 +52,7 @@ Options
5252
If type is "prerelease", "prepatch", "preminor", "premajor",
5353
the preid will be used as the pre-release identifier (default: "alpha").
5454
If type is "patch", "minor", "major", the preid will be ignored.
55+
--no-git-check Skips checking git status (default: false)
5556
--any-branch Allow publishing from any branch (default: false)
5657
--branch Name of the release branch (default: main | master)
5758
--tag <tag> Publish under a given dist-tag (default: "latest")

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"engines": {
2626
"node": ">=18"
2727
},
28+
"packageManager": "pnpm@9.1.0",
2829
"publishConfig": {
2930
"access": "public",
3031
"registry": "https://registry.npmjs.org/"
@@ -82,6 +83,5 @@
8283
"type-fest": "^4.18.2",
8384
"typescript": "^5.4.5",
8485
"vitest": "^1.5.3"
85-
},
86-
"packageManager": "pnpm@9.1.0"
86+
}
8787
}

src/cli.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Options
2525
If type is "prerelease", "prepatch", "preminor", "premajor",
2626
the preid will be used as the pre-release identifier (default: "alpha").
2727
If type is "patch", "minor", "major", the preid will be ignored.
28+
--no-git-check Skips checking git status (default: false)
2829
--any-branch Allow publishing from any branch (default: false)
2930
--branch Name of the release branch (default: main | master)
3031
--tag <tag> Publish under a given dist-tag (default: "latest")

src/options.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,13 @@ async function checkCLIOptions(opts: ReleaseCLIOptions) {
8585
throw new Error(`[${chalk.yellow('--cwd')}] Directory "${chalk.red(cwd)}" does not exist.`);
8686
}
8787

88-
await checkGitRepo();
89-
await checkWorkStatus();
88+
if (opts.gitCheck) {
89+
await checkGitRepo();
90+
await checkWorkStatus();
9091

91-
if (!opts.anyBranch) {
92-
opts.branch = await checkBranch(opts.branch);
92+
if (!opts.anyBranch) {
93+
opts.branch = await checkBranch(opts.branch);
94+
}
9395
}
9496
}
9597

0 commit comments

Comments
 (0)