1 | <p align="center">
|
2 | <img src="media/kanpai.png" width="260"/>
|
3 | </p>
|
4 |
|
5 | <p align="center">
|
6 | <a href="https://npmjs.com/package/kanpai"><img src="https://img.shields.io/npm/v/kanpai.svg" alt="NPM version"></a>
|
7 | <a href="https://npmjs.com/package/kanpai"><img src="https://img.shields.io/npm/dm/kanpai.svg" alt="NPM downloads"></a>
|
8 | <a href="https://circleci.com/gh/egoist/kanpai"><img src="https://img.shields.io/circleci/project/egoist/kanpai/master.svg" alt="Build Status"></a>
|
9 | </p>
|
10 |
|
11 | ## How it works
|
12 |
|
13 | **No black magic**. In [semantic-release](https://github.com/semantic-release/semantic-release) you don't have full control of project publish, `semantic-release` smartly analyze your commits and publish the corresponding new version.
|
14 |
|
15 | While `kanpai` is, following this procedure:
|
16 |
|
17 | - Check git status, see if you have committed the changes and if the remote history differs.
|
18 | - Run tests, `npm test` by default, or `npm run kanpai` if this exists
|
19 | - Update package version, add git tag as well
|
20 | - Publish to NPM
|
21 | - Push to remote git server
|
22 |
|
23 | ## Install
|
24 |
|
25 | ```bash
|
26 | $ npm install -g kanpai
|
27 |
|
28 | # or use yarn
|
29 | $ yarn global add kanpai
|
30 | ```
|
31 |
|
32 | ## Usage
|
33 |
|
34 | ```bash
|
35 | # default type is `patch`
|
36 | $ kp
|
37 | $ kp [patch|minor|major|$version|pre$type]
|
38 |
|
39 | # custom test command, equal to npm run test:other
|
40 | $ kp --test test:other
|
41 |
|
42 | # only push to current working branch on remote
|
43 | # after runing test script
|
44 | $ kp --push-only
|
45 |
|
46 | # skip test script
|
47 | $ kp --skip-test
|
48 |
|
49 | # more usages
|
50 | $ kp -h
|
51 | ```
|
52 |
|
53 | A common workflow:
|
54 |
|
55 | ```bash
|
56 | # after hack something...
|
57 | $ git commit -am "change the world"
|
58 | $ kp
|
59 | ```
|
60 |
|
61 | ## Config
|
62 |
|
63 | You can use command-line to set and get config globally:
|
64 |
|
65 | ```bash
|
66 | $ kp get
|
67 | $ kp get test
|
68 |
|
69 | # update test
|
70 | $ kp set test custom-test-script
|
71 |
|
72 | # update the commit message when running `npm version `
|
73 | # %s will be replaced by version number, eg: 0.1.0
|
74 | $ kp set commitMessage "Release version %s"
|
75 | ```
|
76 |
|
77 | You can config these properties in `package.json` for a single project:
|
78 |
|
79 | ```
|
80 | {
|
81 | "kanpai": {
|
82 | "test": "lint", // custom test script => npm run lint
|
83 | "commitMessage": "Release version %s"
|
84 | }
|
85 | }
|
86 | ```
|
87 |
|
88 | ## FAQ
|
89 |
|
90 | ### What if the `❯❯❯❯❯ PUBLISH` failed?
|
91 |
|
92 | <img src="./media/faq1.png" alt="failed" width="500">
|
93 |
|
94 | You can manually publish it when you fixed the issue:
|
95 |
|
96 | ```bash
|
97 | npm publish
|
98 | git push --follow-tags
|
99 | ```
|
100 |
|
101 | ### fatal: no upstream configured for branch 'master'
|
102 |
|
103 | Two options:
|
104 |
|
105 | a) `git branch --set-upstream-to=origin/master master` and then run `git push`<br>
|
106 | b) `git push -u origin master`
|
107 |
|
108 | ## Preview
|
109 |
|
110 | [![asciicast](https://asciinema.org/a/aor622qgr9vplsq48rmkxzqxn.png)](https://asciinema.org/a/aor622qgr9vplsq48rmkxzqxn)
|
111 |
|
112 | ## License
|
113 |
|
114 | MIT © [EGOIST](https://github.com/egoist)
|