# @shuyun-ep-team/shuyun-version

> 自动化版本控制 CLI，自动化生成版本号、CHANGELOG.md、发布 npm 包、生成标签、提交至远程 Git

Latest version **0.0.9** (published 2021-02-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install @shuyun-ep-team/shuyun-version
pnpm add @shuyun-ep-team/shuyun-version
yarn add @shuyun-ep-team/shuyun-version
bun add @shuyun-ep-team/shuyun-version
```

Provides the command `shuyun-version`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.9 |
| Published | 2021-02-23 |
| First published | 2021-01-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 20.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | mark.zhang |
| Maintainers | bhxing, yiranphp, michaely, yong.tao, z900815, staryunat, wangxinzhuo, linweixian, markzhang, oaooao, kezhongfa, szhou |
| Keywords | npm, git, publish, cli |

## Links

- npm: https://www.npmjs.com/package/@shuyun-ep-team/shuyun-version
- Repository: http://gitlab.shuyun.com/research-and-development-1/front-end-engineering/shuyun-ep-team/shuyun-version
- npm.io page: https://npm.io/package/@shuyun-ep-team/shuyun-version

## Dependencies (6)

- [colors](https://npm.io/package/colors.md) ^1.4.0
- [semver](https://npm.io/package/semver.md) ^7.3.4
- [shelljs](https://npm.io/package/shelljs.md) ^0.8.4
- [inquirer](https://npm.io/package/inquirer.md) ^7.3.3
- [commander](https://npm.io/package/commander.md) ^7.0.0
- [conventional-changelog-cli](https://npm.io/package/conventional-changelog-cli.md) ^2.1.1

## Alternatives

- [@salesforce/cli](https://npm.io/package/@salesforce/cli.md) — 389.7K weekly downloads
- [@mintlify/cli](https://npm.io/package/@mintlify/cli.md) — 208.9K weekly downloads
- [@grafana/e2e-selectors](https://npm.io/package/@grafana/e2e-selectors.md) — 128.7K weekly downloads
- [mintlify](https://npm.io/package/mintlify.md) — 112.0K weekly downloads
- [@intlayer/cli](https://npm.io/package/@intlayer/cli.md) — 22.8K weekly downloads

## Recent versions

- 0.0.9 (latest) — 2021-02-23
- 0.0.8 — 2021-02-22
- 0.0.6 — 2021-02-19
- 0.0.5 — 2021-01-21
- 0.0.4 — 2021-01-21
- 0.0.3 — 2021-01-21
- 0.0.2 — 2021-01-21
- 0.0.1 — 2021-01-18
- 0.0.0 — 2021-01-18

## README

# shuyun-version

自动化版本控制 CLI，自动化生成版本号、CHANGELOG.md、发布 npm 包、生成标签、提交至远程 Git

## 安装

### 安装

```sh
npm i --save-dev @shuyun-ep-team/shuyun-version
```

### 在 package.json 中增加 script

```javascript
{
  "scripts": {
    "release": "shuyun-version -r"
  }
}
```

## CLI 使用

> 如果是 scope 包，如：`@shuyun-ep-team/shuyun-version`，以`@shuyun-ep-team`开头，请先使用`npm publish --access public`，提交第一个版本。

```bash
# 查看帮助
shuyun-version -h

# 自动化发布npm包
shuyun-version -r

# 自动化发布npm包并提交git
shuyun-version -p

# 自动更新版本并生CHANGELOG.md
shuyun-version -log

# 自动更新版本并生CHANGELOG.md、打Git标签
shuyun-version -lt
```

### 配置

```bash
--release [target]       自动化发布npm包
          [target]       目标目录
--publish [target]       自动化发布npm包并提交git
--changelog [target]     自动更新版本并生CHANGELOG.md
--changelogTag [target]  自动更新版本并生CHANGELOG.md
```

#### changelog 支持的 commit 类型：

```bash
"types": [
    {"type": "feat", "section": "Features"},
    {"type": "fix", "section": "Bug Fixes"},
    {"type": "chore", "hidden": true},
    {"type": "docs", "hidden": true},
    {"type": "style", "hidden": true},
    {"type": "refactor", "hidden": true},
    {"type": "perf", "hidden": true},
    {"type": "test", "hidden": true}
]
```

## 一个项目开发及版本管理的流程

### 假如你是 npm 包

- 做了一些修改
- 然后把修改提交了一些 git commit
- 确认 git 工作区是干净的
- 执行`npx shuyun-version -r`，假如是「dist」目录，则`npx shuyun-version -r dist`
- 执行脚本后会提示你输入要发布的版本号，假如你输入版本号：0.0.1
- 版本号无误后，会更改 package.json 中的版本号
- 生成 CHANGELOG.md，并执行`git add . && git commit -m "chore(release): 0.0.1" && git tag -a v0.0.1 -m "release: 0.0.1"`
- 下面再`npm publish`
- 如果想要在发布 npm 的同时 push 到 git 远程，则可以执行`npx shuyun-version -p`

### 假如你是一个业务项目

你可能只需要一些 changelog 的操作，比如我们每个月发版要打 tag 的操作

- 做了一些修改
- 然后把修改提交了一些 git commit
- 确认 git 工作区是干净的
- 执行`npx shuyun-version -log`
- 执行脚本后会提示你输入要发布的版本号（就是要打的 tag），假如你输入版本号：0.0.1
- 版本号无误后，会更改 package.json 中的版本号
- 生成 CHANGELOG.md
- `npx shuyun-version -log`仅仅会更新 CHANGELOG.md，如果想要打 tag 需执行`npx shuyun-version -lt`
- 最后，别忘了`git push`提交到远程

## 为什么造轮子

只是将`conventional-changelog-cli`与 npm 流程及 Git 提交流程做了相结合，抛砖引玉，希望大家贡献想法，一起优化。

- [staard-version](https://github.com/conventional-changelog/standard-version)：自动化版本控制和变更日志生成

* [conventional-changelog（生成 changelog）](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog)

* [conventional-changelog-cli](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-cli)：仅仅生成 changelog 的 CLI

---
_Source: https://npm.io/package/@shuyun-ep-team/shuyun-version · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
