@worktile-devkit/pm
A package & project manager tool, current support sub commands
release
andpublish
Release
Usage
wpm release 1.0.1 # explicit
wpm release patch # semver keyword
wpm release # select from prompt(s)
When run, this command does the following:
- Checkout to default branch and identifies current version and latest tag.
- Prompts for a new version.
- Create a release branch
- Modifies package metadata to reflect new release and generate changelog
- Commits those changes to release branch.
- Pushes to the git remote.
bump
Positionals semver wpm release [major | minor | patch | premajor | preminor | prepatch | prerelease]
# uses the next semantic version(s) value and this skips `Select a new version for...` prompt
When this positional parameter is passed, wpm release
will skip the version selection prompt and increment the version by that keyword.
Options
--default-branch
--allow-branch
--dry-run
--skip
--release-branch-format
--issue-url-format
--bump-files
--infile
--preset
--commit-all
--hooks
--default-branch
--default-branch
@deprecated
Alias: -b
Repository's default or base branch, create release based on this branch.
It is easiest (and recommended) to configure in wpm.json
, but it is possible to pass as a CLI option as well.
{
"commands": {
"defaultBranch": "master"
}
}
With the configuration above, the wpm release
will create release branch base master
.
It is always possible to override this "durable" config on the command-line. Please use with caution.
wpm release --default-branch develop
--allow-branch <glob>
A whitelist of globs that match git branches where wpm release or publish is enabled.
default is ["master", "develop"]
, It is easiest (and recommended) to configure in .wpmrc.js file, but it is possible to pass as a CLI option as well.
{
"allowBranch": ["master", "feature/*"]
}
--dry-run
wpm release --dry-run
wpm publish --dry-run
running with the flag --dry-run allows you to see what commands would be run, without committing to git or updating files.
--skip
You can skip any of the lifecycle steps (branch, bump, changelog, commit, push, tag), by cli, adding the following to your package.json or .rc file:
release
contains: branch, bump, changelog, commit, push
publish
contains: tag, push
--skip.branch --skip.bump
// package.json
{
"wpm": {
"skip": {
"bump": true
}
}
}
// .wtpmrc.js
module.exports = {
"skip": {
"bump": true
}
}
--release-branch-format
Release branch name format used to create branch, default is release-v{{version}}
--tag-prefix
Set a custom prefix for the git tag to be created, default is v
.
If the tags in your project were named without a prefix (v) in the past, you need to set it to empty, otherwise, the changelog will rebuild, and will be lost past versions
--tag-prefix=
{
tagPrefix: ""
}
--issue-url-format
A URL representing the issue format (allowing a different URL format to be * swapped in for Github, Gitlab, Bitbucket, etc)
default is https//at.worktile.com/agile/items/{{id}}
--bump-files
--infile
Read the CHANGELOG from this file, default is CHANGELOG.md
--preset
List of preset see conventional-changelog, by default, release use angular preset
--commit-all
If you want to commit generated artifacts in the release commit, you can use the --commit-all
or -a
flag. You will need to stage the artifacts you want to commit, so your release command could look like this:
"prerelease": "npm run build-docs",
"release": "git add <file(s) to commit> && wpm release -commit-all"
--hooks
wpm supports lifecycle hooks. These allow you to execute your own supplementary commands during the release or publish. The following hooks are available and execute in the order documented:
- prerelease/postrelease: executed before/after anything happens. If the prerelease script returns a non-zero exit code, versioning will be aborted, but it has no other effect on the process.
- prebump/postbump: executed before and after the version is bumped. If the prebump script returns a version #, it will be used rather than the version calculated by standard-version.
- prechangelog/postchangelog: executes before and after the CHANGELOG is generated.
- precommit/postcommit: called before and after the commit step.
- pretag/posttag: called before and after the tagging step.
Simply add the following to your package.json or .wtpmrc file to configure lifecycle hooks:
{
"wpm": {
"hooks": {
"prebump": "echo 9.9.9"
}
}
}
As an example to build artifacts before publish, publish artifacts to npm after created tag.
{
"wpm": {
"hooks":
{
"prepublish": "npm run build",
"postpublish": "cd built && npm publish"
}
}
}
Publish
Usage
wpm publish
When run, this command does the following:
- Checkout to default branch
- Create a tag which named as current version base default branch
- Pushes to the git remote.
Options
Git Publish
Usage
wpm git-publish
When run, this command does the following:
- Create temp folder and copy source (build artifacts) to temp
- Git init temp and commit
- Create a release tag
- Pushes temp and tags to the git remote.
Options
--source
需要同步到 Repo 的制品文件夹,一般是 built 文件夹
--name
发布类库在git上仓储的名称,比如你发布的仓储叫 example
,那么 name 就需要传 example
--protocol
Git 传输协议,支持 https
和 ssh
, 默认是 ssh
--provider
发布仓储的目标服务,目前支持 git
、github
、gitlab
--organization
组织或者用户在 provider 上的名称,会根据 provider
、protocol
、name
生成 Remote URL。
provider: github
protocol: ssh
name: example
organization: worktile
生成的 Remote URL: git@github.com:worktile/example.git
provider: github
protocol: https
name: example
organization: worktile
生成的 Remote URL: https://github.com/worktile/example
Build (Early Draft)
Usage
wpm build
When run, this command does the following:
- Run
tsc
- Sync
src
's files to output exclude *.ts
Options
Build SDK (Early Draft)
Usage
wpm build-sdk
When run, this command does the following:
- Run
webpack
bundle entry file - Sync
package.json
to output path
Options
Create (Early Draft)
Usage
wpm create <PROJECT_NAME>
When run, this command does the following:
- Generate
<PROJECT_NAME>
folder and scaffolding codes - Install all node_modules run
npm install