Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/varletjs/varlet-release

Release all packages and generate changelogs
https://github.com/varletjs/varlet-release

changelog release varlet

Last synced: about 1 month ago
JSON representation

Release all packages and generate changelogs

Awesome Lists containing this project

README

        

Varlet Release


English |
中文



NPM Version
License

## Intro

`Varlet Release` is a tool used for publishing all packages, generating change logs, and checking `commit messages`, relying on `pnpm`.

## Installation

```shell
pnpm add @varlet/release -D
```

## Usage

### Using Command

```shell
# Release all packages and generate changelogs
npx vr release

# Specify remote name
npx vr release -r https://github.com/varletjs/varlet-release
# or
npx vr release --remote https://github.com/varletjs/varlet-release

# 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 lint-commit -p .git/COMMIT_EDITMSG

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

### Configuration

#### release

| Params | Instructions |
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| -r --remote \ | Specify remote name |
| -s --skip-npm-publish | Skip npm publish |
| -c --check-remote-version | Check if the remote version of the npm package is the same as the one you want to publish locally, if so, stop execution. |
| -sc --skip-changelog | Skip generate changelog |
| -sgt --skip-git-tag | Skip git tag |
| -nt --npm-tag \ | npm tag |

#### changelog

| Params | Instructions |
| ----------------------------------- | -------------------------- |
| -f --file \ | Specify changelog filename |
| -rc --releaseCount \ | Release count |

#### lint-commit

| Params | Instructions |
| ------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| -p --commitMessagePath \ | The path of the temporary file to which the git message is submitted. The git hook commit-msg will pass this parameter |
| -r --commitMessageRe \ | Validate the regular of whether the commit message passes |
| -e --errorMessage \ | Validation failed to display error messages |
| -w --warningMessage \ | Validation failed to display warning messages |

#### publish

| Params | Instructions |
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| -c --check-remote-version | Detects whether the remote version of the npm package is the same as the package version to be published locally, and if it is, skip the release |
| -nt --npm-tag \ | npm tag |

### Custom Handle

#### Example

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

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

You can pass in a task that will be called before the publish after the package version is changed.

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

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

release({ task })
```

#### Types

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

interface ChangelogCommandOptions {
file?: string
releaseCount?: number
}
function changelog({ releaseCount, file }?: ChangelogCommandOptions): Promise

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](https://github.com/varletjs/release/blob/main/LICENCE)