@worktile-devkit/pm

1.0.0-beta.24 • Public • Published

@worktile-devkit/pm

A package & project manager tool, current support sub commands release and publish

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:

  1. Checkout to default branch and identifies current version and latest tag.
  2. Prompts for a new version.
  3. Create a release branch
  4. Modifies package metadata to reflect new release and generate changelog
  5. Commits those changes to release branch.
  6. Pushes to the git remote.

Positionals semver bump

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

@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:

  1. Checkout to default branch
  2. Create a tag which named as current version base default branch
  3. Pushes to the git remote.

Options

Git Publish

Usage

wpm git-publish

When run, this command does the following:

  1. Create temp folder and copy source (build artifacts) to temp
  2. Git init temp and commit
  3. Create a release tag
  4. Pushes temp and tags to the git remote.

Options

--source

需要同步到 Repo 的制品文件夹,一般是 built 文件夹

--name

发布类库在git上仓储的名称,比如你发布的仓储叫 example ,那么 name 就需要传 example

--protocol

Git 传输协议,支持 httpsssh, 默认是 ssh

--provider

发布仓储的目标服务,目前支持 gitgithubgitlab

--organization

组织或者用户在 provider 上的名称,会根据 providerprotocolname 生成 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:

  1. Run tsc
  2. Sync src's files to output exclude *.ts

Options

Build SDK (Early Draft)

Usage

wpm build-sdk

When run, this command does the following:

  1. Run webpack bundle entry file
  2. Sync package.json to output path

Options

Create (Early Draft)

Usage

wpm create <PROJECT_NAME>

When run, this command does the following:

  1. Generate <PROJECT_NAME> folder and scaffolding codes
  2. Install all node_modules run npm install

Options

Readme

Keywords

none

Package Sidebar

Install

npm i @worktile-devkit/pm

Weekly Downloads

5

Version

1.0.0-beta.24

License

ISC

Unpacked Size

115 kB

Total Files

145

Last publish

Collaborators

  • why520crazy