https://github.com/varletjs/varlet-release
Release all package, generate changelogs and lint commit message.
https://github.com/varletjs/varlet-release
changelog commitlint release varlet
Last synced: about 2 months ago
JSON representation
Release all package, generate changelogs and lint commit message.
- Host: GitHub
- URL: https://github.com/varletjs/varlet-release
- Owner: varletjs
- License: mit
- Created: 2023-11-14T06:29:32.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2026-04-09T13:04:31.000Z (about 2 months ago)
- Last Synced: 2026-04-09T13:04:49.472Z (about 2 months ago)
- Topics: changelog, commitlint, release, varlet
- Language: TypeScript
- Homepage:
- Size: 660 KB
- Stars: 6
- Watchers: 2
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
Varlet Release
English |
δΈζ
## Intro
`Varlet Release` is a tool used for publishing all packages, generating change logs, and checking `commit messages`, relying on `pnpm`.
- π¦ **Out of the box**: Zero-configuration release experience
- π€ **Interactive CLI**: Friendly interactive terminal prompts
- π **Standardization**: Validates Git Commit messages and generates standard changelogs
- π **Extensibility**: Supports both CLI commands and Node.js API for deep customization
> `Varlet Release` requires `Node.js` ^20.19.0 || >=22.12.0 and `esm` only.
## Installation
```shell
pnpm add @varlet/release -D
```
## Usage
### Core Workflow
When executing `vr release`, the following sequence of lifecycles occurs automatically:
1. Select/Confirm the **version** to publish interactively
2. Execute the user-defined `task` function (optional, e.g., to rebuild projects based on the new version)
3. Update the `package.json` **version** programmatically
4. Generate the **Changelog**
5. **Git Commit** & **Git Tag**
6. **Publish** to npm
### Using Command
```shell
# Release all packages and run the full workflow
npx vr release
# Specify remote name
npx vr release -r origin
# or
npx vr release --remote origin
# Just generate changelogs
npx vr changelog
# Specify changelog filename
npx vr changelog -f changelog.md
# or
npx vr changelog --file changelog.md
# Lint commit message
npx vr commit-lint -p .git/COMMIT_EDITMSG
# Publish to npm, which can be called in the ci environment
npx vr publish
# Check if lockfile has been updated
npx vr lockfile-sync-check
# Auto install dependencies if lockfile changed
npx vr lockfile-sync-check -i
```
### Git Hooks Integration (Best Practice)
It is highly recommended to use `commit-lint` with `simple-git-hooks` or `husky` in `package.json` to automatically check developers' commit messages before committing:
```json
{
"simple-git-hooks": {
"commit-msg": "npx vr commit-lint -p $1"
}
}
```
### Configuration
#### release
```
Usage: vr release [flags...]
Flags:
-r, --remote Remote name
-s, --skip-npm-publish Skip npm publish
--skip-changelog Skip generate changelog
--skip-git-tag Skip git tag
-t, --npm-tag Npm tag
-c, --check-remote-version Check remote version
```
#### publish
```
Usage: vr publish [flags...]
Flags:
-c, --check-remote-version Check remote version
-t, --npm-tag Npm tag
```
#### changelog
```
Usage: vr changelog [flags...]
Flags:
-c, --release-count Release count, default 0
-f, --file Changelog filename
```
#### commit-lint
```
Usage: vr commit-lint [flags...]
Flags:
-p, --commit-message-path Git commit message path
-r, --commit-message-re Validate the regular of whether the commit message passes
-e, --error-message Validation failed to display error messages
-w, --warning-message Validation failed to display warning messages
```
#### lockfile-sync-check
```
Usage: vr lockfile-sync-check [flags...]
Flags:
-m, --package-manager Package manager (npm, yarn, pnpm), default pnpm
-i, --install Auto install dependencies if lockfile changed
```
### Node API Custom Handle
You can write your own release scripts with Internal Node.js API instead of CLI.
#### Example
```js
import { changelog, release } from '@varlet/release'
// Run the core release workflow directly
release()
```
You can pass in a custom `task` function that will be called after the package version is updated but before the remaining publish steps.
```js
import { changelog, release } from '@varlet/release'
async function task(newVersion, oldVersion) {
await doSomething1()
await doSomething2()
}
release({ task })
```
## License
[MIT](https://github.com/varletjs/release/blob/main/LICENSE)