Skip to content

Commit ace1508

Browse files
committed
feat: add check
1 parent 05947b4 commit ace1508

9 files changed

Lines changed: 475 additions & 16 deletions

File tree

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,11 @@
4747
"dayjs": "^1.11.10",
4848
"execa": "^8.0.1",
4949
"inquirer": "^9.2.20",
50+
"is-subdir": "^1.2.0",
5051
"log-symbols": "^6.0.0",
5152
"meow": "^13.2.0",
5253
"ora": "^8.0.1",
54+
"publint": "^0.2.7",
5355
"semver": "^7.6.0",
5456
"strip-ansi": "^7.1.0"
5557
},

pnpm-lock.yaml

Lines changed: 107 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/cli.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,14 @@ Usage
1616
1717
Options
1818
--cwd <cwd> The current working directory (default: ".")
19+
--any-branch Allow publishing from any branch (default: false)
20+
--branch Name of the release branch (default: main | master)
1921
--preid Specify the pre-release identifier, allowed values are ${joinArray(PRERELEASE_VERSIONS)}.
2022
If type is "prerelease", "prepatch", "preminor", "premajor",
2123
the preid will be used as the pre-release identifier (default: "alpha").
2224
If type is "patch", "minor", "major", the preid will be ignored.
2325
--tag <tag> Publish under a given dist-tag (default: "latest")
26+
--strict Strict mode, will make some checks more strict (default: false)
2427
--verbose Display verbose output
2528
-h, --help Display this message
2629
-v, --version Display version number
@@ -33,12 +36,23 @@ Options
3336
type: 'string',
3437
default: process.env.RC_CWD || '.',
3538
},
39+
anyBranch: {
40+
type: 'boolean',
41+
default: false,
42+
},
43+
branch: {
44+
type: 'string',
45+
},
3646
preid: {
3747
type: 'string',
3848
},
3949
tag: {
4050
type: 'string',
4151
},
52+
strict: {
53+
type: 'boolean',
54+
default: false,
55+
},
4256
verbose: {
4357
type: 'boolean',
4458
default: isDev,

src/error.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
export enum ReleaseErrorCode {
2-
ERROR = 0,
3-
WARNING = 1,
4-
ROLLBACK = 2,
2+
EXIT = 0,
3+
ERROR = 1,
4+
WARNING = 2,
5+
ROLLBACK = 3,
56
}
67

78
export class ReleaseError extends Error {
@@ -23,6 +24,10 @@ export class ReleaseError extends Error {
2324
throw new ReleaseError(msg, ReleaseErrorCode.ERROR);
2425
}
2526

27+
static exit(msg?: string) {
28+
throw new ReleaseError(msg || '', ReleaseErrorCode.EXIT);
29+
}
30+
2631
static warning(msg: string) {
2732
throw new ReleaseError(msg, ReleaseErrorCode.WARNING);
2833
}

0 commit comments

Comments
 (0)