# git-changelog-test **Repository Path**: yc8332/git-changelog-test ## Basic Information - **Project Name**: git-changelog-test - **Description**: No description available - **Primary Language**: PHP - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2019-10-15 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # git-changelog-test * 此项目是git-commit-msg和conventions-changelog的测试项目 * git-commit-msg遵循`angular`的提交规范, [git-commit-msg](http://karma-runner.github.io/4.0/dev/git-commit-msg.html) * 根据`git history` 生成[changelog](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-cli) # 依赖 * node npm环境 * 遵循规范的 git commit 记录, 类型为 `feat`, `fix` 和 `perf` 的提交才会在`changelog`里面显示, 如果有包含`BREAKING CHANGE` 信息的提交也会在`changelog`显示 * 使用`standard-version` 管理 `version`或者说`tag`, [standard-version](https://github.com/conventional-changelog/standard-version) * 使用`conventional-changelog` 生成changelog,[changelog](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-cli) * 版本号规范 Major.Minor.Patch(主版本号.次版本号.修订号) # 新项目使用步骤 * 安装`standard-version`和 `conventional-changelog`,安装命令 `npm -i -g standard-version conventional-changelog-cli` * 初始化版本: `npm init -y`, 自动生成`package.json`,版本默认`1.0.0`,可以修改 * 提交符合规范的git commit,然后需要发布的时候, `npm run release[minor,major]`,默认是x.y.z+1, 如果是要x.y+1.0那就是`npm run release:minor`, 如果是要x+1.y.0,那就是`npm run release:major`.(需要把我这边配置的package.json里面的scripts拷过去) * 到这里已经生成了最新的changelog了,可以push代码到远端了 # 虚拟执行`npm run release` * `standard-version`有个`--dry-run`的参数可以查看运行命令的接口而不实际执行。在这里我们可以这样使用:`npm run release -- --dry-run`, 使用` npm run` 必须要加一个 `--` 才能够传参数