lvr v2.1.0
lvr
Perform jobs related to the release flows, such as:
1. Bump version.
2. Generate CHANGELOG.md.
3. Commit / Tag / Push.
4. Create a release and publish node packages.
Features
- 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.
Usage
Perform Bump :point_right: CHANGELOG :point_right: Commit :point_right: Tag :point_right: Push in one script:
npx lvrUse the dry run option to confirm what will be executed:
# npx lvr --dry-run
npx lvr -dInstall globally:
npm i lvr -gMore options detail:
lvr -hCommands used separately.
Bump
Powered by conventional-recommended-bump and semver. Using Conventional Commits preset by default.
Bump package.json in the root:
# lvr bump
lvr bIn a detected monorepo, it would bump those changed packages by default.
options
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 --allIn a detected monorepo, --pkg helps to prompt which packages should be bumped:
lvr b --pkgBump to the specified semver increment level rather than depending on conventional-recommended-bump.
lvr b --major
lvr b --major --all
lvr b --major --pkgSemver 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-pkgChangelog
Powered by antfu/changelogithub and unjs/changelogen.
Generate CHANGELOG.md with all existing tags:
# lvr changelog
lvr coptions
# 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.2It 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
@authorNamefor 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
--tokenwhen encountering this situation 😔.Alternatively, we can also create a
.env.localfile which should be included in the.gitignore.# .env.local GITHUB_TOKEN = your-github-pat
Commit / Tag / Push
Enable --commit --tag --push when execute the lvr script without other command. (opt-out like --no-push, etc.)
--no-changelogis considered to enable these git jobs in the same way, while--no-bumpmakes 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.
Send a GitHub Release on CI
See yml.ts and modify on your own.
# Add a workflow file to `.github/workflows/lvr.yml`.
lvr ymlPublish on CI
See publish.ts.
Configuration
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.
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago