开源项目 conventional-changelog
使用教程
conventional-changelog项目地址:https://gitcode.com/gh_mirrors/conv/conventional-changelog
1. 项目的目录结构及介绍
conventional-changelog/
├── LICENSE
├── README.md
├── package.json
├── pnpm-lock.yaml
├── pnpm-workspace.yaml
├── commitlintrc.js
├── czrc
├── editorconfig
├── eslintrc.json
├── gitattributes
├── gitignore
├── nano-staged.json
├── npmrc
├── release-please-manifest.json
├── simple-git-hooks.json
├── meta.md
└── packages/
└── conventional-changelog/
├── README.md
├── package.json
└── index.js
LICENSE
: 项目的许可证文件。README.md
: 项目的说明文档。package.json
: 项目的依赖管理文件。pnpm-lock.yaml
: 锁定依赖版本的文件。pnpm-workspace.yaml
: 管理 monorepo 的配置文件。commitlintrc.js
: 用于规范 commit 信息的配置文件。czrc
: 用于配置 commitizen 的文件。editorconfig
: 编辑器配置文件。eslintrc.json
: ESLint 配置文件。gitattributes
: Git 属性配置文件。gitignore
: Git 忽略文件配置。nano-staged.json
: 用于 staged 文件的配置。npmrc
: npm 配置文件。release-please-manifest.json
: 用于 release-please 的配置文件。simple-git-hooks.json
: Git hooks 配置文件。meta.md
: 项目元数据文件。packages/
: 包含项目的各个子模块。conventional-changelog/
: 核心模块,包含项目的核心逻辑。
2. 项目的启动文件介绍
项目的启动文件位于 packages/conventional-changelog/index.js
。这个文件是项目的入口点,负责初始化和执行主要的逻辑。
// packages/conventional-changelog/index.js
const conventionalChangelog = require('conventional-changelog');
// 初始化并执行逻辑
conventionalChangelog({
preset: 'angular',
releaseCount: 1
}).pipe(process.stdout);
3. 项目的配置文件介绍
commitlintrc.js
这个文件用于配置 commitlint,确保 commit 信息符合规范。
// commitlintrc.js
module.exports = {
extends: ['@commitlint/config-conventional']
};
czrc
这个文件用于配置 commitizen,提供交互式的 commit 信息输入。
// czrc
{
"path": "cz-conventional-changelog"
}
release-please-manifest.json
这个文件用于配置 release-please,自动化生成 CHANGELOG 和 release notes。
// release-please-manifest.json
{
"release-type": "node",
"bump-minor-pre-major": true,
"bump-patch-for-minor-pre-major": true,
"changelog-path": "CHANGELOG.md",
"include-v-in-tag": true
}
simple-git-hooks.json
这个文件用于配置 Git hooks,自动化执行一些任务。
// simple-git-hooks.json
{
"pre-commit": "npm run lint"
}
通过以上配置文件,可以确保项目的 commit 信息规范、自动化生成 CHANGELOG 和 release notes,以及自动化执行一些任务。
conventional-changelog项目地址:https://gitcode.com/gh_mirrors/conv/conventional-changelog