0.2.10 • Published 15 days ago

@varlet/release v0.2.10

Weekly downloads
-
License
MIT
Repository
github
Last release
15 days ago

介绍

Varlet Release 是一个用于发布所有包、生成变更日志和检测 commit message 的工具,依赖于 pnpm

安装

pnpm add @varlet/release -D

使用

使用命令

# 发布所有包并生成变更日志
npx vr release

# 指定远程仓库名称
npx vr release -r https://github.com/varletjs/varlet-release
# or
npx vr release --remote https://github.com/varletjs/varlet-release

# 仅生成变更日志
npx vr changelog

# 指定变更日志文件名
npx vr changelog -f changelog.md
# or
npx vr changelog --file changelog.md

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

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

配置

release

参数说明
-r --remote \<remote>指定远程仓库名称
-s --skip-npm-publish跳过 npm 发布
-c --check-remote-version检测 npm 包的远程版本是否与要在本地发布的包版本相同,如果是,则停止执行
-sc --skip-changelog跳过生成变更日志
-sgt --skip-git-tag跳过 git tag
-nt --npm-tag \<npmTag>npm tag

changelog

参数说明
-f --file \<filename>指定变更日志文件名
-rc --releaseCount \<releaseCount>发布数量

lint-commit

参数说明
-p --commitMessagePath \<path>提交 git message 的临时文件路径。git 钩子 commit-msg 会传递这个参数。
-r --commitMessageRe \<reg>验证 commit message 是否通过的正则
-e --errorMessage \<message>验证失败展示的错误信息
-w --warningMessage \<message>验证失败展示的提示信息

publish

参数说明
-c --check-remote-version检测npm包的远程版本是否与要在本地发布的包版本相同,如果是,则跳过发布
-nt --npm-tag \<npmTag>npm tag

自定义处理

示例

import { release, changelog } from '@varlet/release'

// Do what you want to do...
release()

你可以传入一个 task,在包版本更改后,在发布之前会调用 task

import { release, changelog } from '@varlet/release'

async function task() {
  await doSomething1()
  await doSomething2()
}

release({ task })

类型

interface PublishCommandOptions {
  preRelease?: boolean
  checkRemoteVersion?: boolean
  npmTag?: string
}
function publish({ preRelease, checkRemoteVersion, npmTag }: PublishCommandOptions): Promise<void>
function updateVersion(version: string): void
interface ReleaseCommandOptions {
  remote?: string
  skipNpmPublish?: boolean
  skipChangelog?: boolean
  skipGitTag?: boolean
  npmTag?: string
  task?(): Promise<void>
}
function release(options: ReleaseCommandOptions): Promise<void>

interface ChangelogCommandOptions {
  file?: string
  releaseCount?: number
}
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
  errorMessage?: string
  warningMessage?: string
}
function commitLint(options: CommitLintCommandOptions): void

License

MIT

0.2.10

15 days ago

0.2.9

20 days ago

0.2.8

1 month ago

0.2.7

1 month ago

0.2.6

2 months ago

0.2.5

3 months ago

0.2.4

3 months ago

0.2.3

3 months ago

0.2.1

4 months ago

0.2.2

4 months ago

0.2.0

4 months ago

0.1.2

5 months ago

0.1.1

5 months ago

0.1.0

5 months ago

0.0.5

5 months ago

0.0.4

5 months ago

0.0.3

6 months ago

0.0.2

6 months ago

0.0.1

6 months ago