kanpai
🍻 Kanpai to publish a new version of your module!
Last updated 7 months ago by rem .
MIT · Repository · Bugs · Original npm · Tarball
$ cnpm install kanpai 
SYNC missed versions from official npm registry.

NPM version NPM downloads Build Status

Motivation

My major complaints about npm publish are:

  • npm install will also trigger npm run prepublish, see the discussion. If you wanna run npm test in prepublish script it will also be emitted whenever you run npm install, which is unexpected.
  • I have to manually update the package version.
  • I have to manually create git tag.

How it works

No black magic. In semantic-release you don't have full control of project publish, semantic-release smartly analyze your commits and publish the corresponding new version.

While kanpai is, following this procedure:

  • Check git status, see if you have committed the changes and if the remote history differs.
  • Run tests, npm test by default, or npm run kanpai if this exists
  • Update package version, add git tag as well
  • Publish to NPM
  • Push to remote git server

Install

$ npm install -g kanpai

# or use yarn
$ yarn global add kanpai

Usage

# default type is `patch`
$ kp
$ kp [patch|minor|major|$version|pre$type]

# custom test command, equal to npm run test:other
$ kp --test test:other

# only push to current working branch on remote
# after test
$ kp --push

# skip test
$ kp --skip-test

# more usages
$ kp -h

A common workflow:

# after hack something...
$ git commit -am "change the world"
$ kp

Config

You can use command-line to set and get config globally:

$ kp get
$ kp get test

# update test
$ kp set test custom-test-script

# update the commit message when running `npm version `
# %s will be replaced by version number, eg: 0.1.0
$ kp set commitMessage "Release version %s"

You can config these properties in package.json for a single project:

{
  "kanpai": {
    "test": "lint", // custom test script => npm run lint
    "commitMessage": "Release version %s"
  }
}

FAQ

What if the ❯❯❯❯❯ PUBLISH failed?

failed

You can manually publish it when you fixed the issue:

npm publish
git push --follow-tags

fatal: no upstream configured for branch 'master'

Two options:

a) git branch --set-upstream-to=origin/master master and then run git push
b) git push -u origin master

Preview

asciicast

License

MIT © EGOIST

Maintainers (2)
Downloads
Today 0
This Week 0
This Month 198
Last Day 0
Last Week 77
Last Month 53
Dependencies (14)
Dev Dependencies (1)
  • xo ^0.12.1
Dependents (1)

Copyright 2014 - 2017 © taobao.org |