Skip to content

Commit

Permalink
docs: add publish & --skip-npm-publish
Browse files Browse the repository at this point in the history
  • Loading branch information
a145789 committed Jan 22, 2024
1 parent c6eff81 commit 4b18237
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 5 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ npx vr changelog --file changelog.md

# Lint commit message
npx vr lint-commit -p .git/COMMIT_EDITMSG

# Publish to npm, which can be called in the ci environment
npx vr publish
```

### Configuration
Expand All @@ -71,6 +74,7 @@ npx vr lint-commit -p .git/COMMIT_EDITMSG
| Params | Instructions |
| ----------------------------------- | -------------------------- |
| -f --file \<filename\> | Specify changelog filename |
| -s --skip-npm-publish | Skip npm publish |
| -rc --releaseCount \<releaseCount\> | Release count |

#### lint-commit
Expand All @@ -82,6 +86,12 @@ npx vr lint-commit -p .git/COMMIT_EDITMSG
| -e --errorMessage \<message\> | Validation failed to display error messages |
| -w --warningMessage \<message\> | Validation failed to display warning messages |

#### publish

```shell
vr publish
```

### Custom Handle

#### Example
Expand Down Expand Up @@ -109,8 +119,11 @@ release({ task })
#### Types

```ts
function publish(preRelease: boolean | undefined): Promise<void>
function updateVersion(version: string): void
interface ReleaseCommandOptions {
remote?: string
skipNpmPublish?: boolean
task?(): Promise<void>
}
function release(options: ReleaseCommandOptions): Promise<void>
Expand All @@ -121,6 +134,9 @@ interface ChangelogCommandOptions {
}
function changelog({ releaseCount, file }?: ChangelogCommandOptions): Promise<void>

const COMMIT_MESSAGE_RE: RegExp
function isVersionCommitMessage(message: string): string | false | null
function getCommitMessage(commitMessagePath: string): string
interface CommitLintCommandOptions {
commitMessagePath: string
commitMessageRe?: string | RegExp
Expand Down
16 changes: 16 additions & 0 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ npx vr changelog --file changelog.md

# 检测 commit message
npx vr lint-commit -p .git/COMMIT_EDITMSG

# 发布到 npm,可以在 ci 中执行
npx vr publish
```

### 配置
Expand All @@ -71,6 +74,7 @@ npx vr lint-commit -p .git/COMMIT_EDITMSG
| 参数 | 说明 |
| ----------------------------------- | ------------------ |
| -f --file \<filename\> | 指定变更日志文件名 |
| -s --skip-npm-publish | 跳过 npm 发布 |
| -rc --releaseCount \<releaseCount\> | 发布数量 |

#### lint-commit
Expand All @@ -82,6 +86,12 @@ npx vr lint-commit -p .git/COMMIT_EDITMSG
| -e --errorMessage \<message\> | 验证失败展示的错误信息 |
| -w --warningMessage \<message\> | 验证失败展示的提示信息 |

#### publish

```shell
vr publish
```

### 自定义处理

#### 示例
Expand Down Expand Up @@ -109,8 +119,11 @@ release({ task })
#### 类型

```ts
function publish(preRelease: boolean | undefined): Promise<void>
function updateVersion(version: string): void
interface ReleaseCommandOptions {
remote?: string
skipNpmPublish?: boolean
task?(): Promise<void>
}
function release(options: ReleaseCommandOptions): Promise<void>
Expand All @@ -121,6 +134,9 @@ interface ChangelogCommandOptions {
}
function changelog({ releaseCount, file }?: ChangelogCommandOptions): Promise<void>

const COMMIT_MESSAGE_RE: RegExp
function isVersionCommitMessage(message: string): string | false | null
function getCommitMessage(commitMessagePath: string): string
interface CommitLintCommandOptions {
commitMessagePath: string
commitMessageRe?: string | RegExp
Expand Down
5 changes: 0 additions & 5 deletions src/release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ async function isWorktreeEmpty() {
}

export async function publish(preRelease: boolean | undefined) {
if (preRelease == null) {
const config = readJSONSync(resolve(cwd, 'package.json'))
preRelease = config.version.includes('alpha.') as boolean
}

const s = createSpinner('Publishing all packages').start()
const args = ['-r', 'publish', '--no-git-checks', '--access', 'public']

Expand Down

0 comments on commit 4b18237

Please sign in to comment.