Perform jobs related to the release flows, such as:
- Bump version.
- Generate
CHANGELOG.md
. - Commit / Tag / Push.
- Create a release and publish node packages.
- One brief script is good to go, may be a little opinionated by default options.
- Generate a tag-ranged
CHANGELOG.md
. - Publish job supports sync to cnpm.
Perform Bump 👉 CHANGELOG 👉 Commit 👉 Tag 👉 Push in one script:
npx lvr
Use the dry run option to confirm what will be executed:
# npx lvr --dry-run
npx lvr -d
Install globally:
npm i lvr -g
More options detail:
lvr -h
Powered by conventional-recommended-bump and semver. Using Conventional Commits preset by default.
Bump package.json
in the root:
# lvr bump
lvr b
In a detected monorepo, it would bump those changed packages by default.
In a detected monorepo, it would bump all packages whether they are changed.
If the root package.json has the version
field, packages would be bumped to the same version based on it.
lvr b --all
In a detected monorepo, --pkg
helps to prompt which packages should be bumped:
lvr b --pkg
Bump to the specified semver increment level rather than depending on conventional-recommended-bump
.
lvr b --major
lvr b --major --all
lvr b --major --pkg
Semver increment level support:
-
--major
: bump as a semver-major version. -
--minor
: bump as a semver-minor version. -
--patch
: bump as a semver-patch version. -
--premajor
: bump as a semver-premajor version, can set id with string. -
--preminor
: bump as a semver-preminor version, can set id with string. -
--prepatch
: bump as a semver-prepatch version, can set id with string. -
--prerelease
: bump as a semver-prerelease version, can set id with string.
In a detected monorepo, when releasing only one package, it specifies the tag name as vx.x.x
instead of abc@x.x.x
:
lvr b --main-pkg
Powered by antfu/changelogithub and unjs/changelogen.
Generate CHANGELOG.md
with all existing tags:
# lvr changelog
lvr c
# within a tag range.
lvr changelog --tag=v1.0.1...v2.1.3
# to last 2 tag.
lvr changelog --tag==2
# to a specified tag.
lvr changelog --tag=v0.0.2
It means that the CHANGELOG.md
would contain more commits that were not be parsed by conventional commits
. Disable by default.
lvr changelog --verbose
[!NOTE] About author
To be able to generate the format of
@authorName
for the interaction in the GitHub's release note, I need to fetch the GitHub Rest API. However, it occurred to me that the API has a rate limit for an IP.So we have to pass a GitHub PAT by
--token
when encountering this situation 😔.Alternatively, we can also create a
.env.local
file which should be included in the.gitignore
.# .env.local GITHUB_TOKEN = your-github-pat
Enable --commit
--tag
--push
when execute the lvr
script without other command. (opt-out like --no-push
, etc.)
--no-changelog
is considered to enable these git jobs in the same way, while--no-bump
makes no sense to the further step.
Use Release {r}
as the default commit message. The placeholder {r}
will be replaced by the tag name from the bumped result. If multiple packages are released in the same commit, the human-id
library is utilized to create words for the commit message and tag name:
lvr --commit="R: {r}"
# Use the tag name from bumped result from package.json by default:
lvr --tag=BatMan
# Push current branch and new tag by default.
lvr --push
# Push current branch only.
lvr --push=branch
# Push new tag only
lvr --push=tag
[!NOTE] It is not recommended to release more than one package at the same time in order to ensure a concise commit message and tag name.
See yml.ts and modify on your own.
# Add a workflow file to `.github/workflows/lvr.yml`.
lvr yml
See publish.ts.
See src/config.ts.
Configuration is loaded by antfu/unconfig from cwd which has highest priority. You can use either lvr.json
, lvr.{ts,js,mjs,cjs}
, .lvrrc
or use the lvr
field in package.json.