-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from ziyi2/demo/github-actions-cd
Demo/GitHub actions cd
- Loading branch information
Showing
47 changed files
with
48,597 additions
and
6,572 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = { extends: ["cz"] }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
// https://github.com/leoforfree/cz-customizable/blob/master/cz-config-EXAMPLE.js | ||
module.exports = { | ||
// 对原有的 types 进行汉化处理 | ||
types: [ | ||
{ value: "特性", name: "特性: 一个新的特性" }, | ||
{ value: "修复", name: "修复: 修复一个Bug" }, | ||
{ value: "文档", name: "文档: 变更的只有文档" }, | ||
{ value: "格式", name: "格式: 空格, 分号等格式修复" }, | ||
{ value: "重构", name: "重构: 代码重构,注意和特性、修复区分开" }, | ||
{ value: "性能", name: "性能: 提升性能" }, | ||
{ value: "测试", name: "测试: 添加一个测试" }, | ||
{ value: "工具", name: "工具: 开发工具变动(构建、脚手架工具等)" }, | ||
{ value: "回滚", name: "回滚: 代码回退" }, | ||
{ value: "开发中", name: "开发中: 功能正在开发,还未完成" }, | ||
], | ||
|
||
// 以本小册的课程内容进行 scopes 的拆分 | ||
// 如果是组件库,则可以根据组件的名称进行拆分 | ||
// 如果是框架库,也可以根据框架库的模块内容进行拆分 | ||
// 例如这里的框架设计还可以细分为 框架设计(沙箱)、框架设计(性能优化)、框架设计(通信) | ||
scopes: [ | ||
{ name: "方案了解" }, | ||
{ name: "框架原理" }, | ||
{ name: "工程设计" }, | ||
{ name: "框架设计" }, | ||
], | ||
|
||
usePreparedCommit: false, // to re-use commit from ./.git/COMMIT_EDITMSG | ||
allowTicketNumber: false, | ||
isTicketNumberRequired: false, | ||
ticketNumberPrefix: "TICKET-", | ||
ticketNumberRegExp: "\\d{1,5}", | ||
|
||
// it needs to match the value for field type. Eg.: 'fix' | ||
/* | ||
scopeOverrides: { | ||
fix: [ | ||
{name: 'merge'}, | ||
{name: 'style'}, | ||
{name: 'e2eTest'}, | ||
{name: 'unitTest'} | ||
] | ||
}, | ||
*/ | ||
// override the messages, defaults are as follows | ||
messages: { | ||
type: "选择一种提交类型:", | ||
scope: "选择一个 scope (可选):", | ||
// used if allowCustomScopes is true | ||
customScope: "选择一个 scope:", | ||
subject: "短说明:\n", | ||
body: '长说明,使用"|"换行:\n', | ||
breaking: "非兼容性说明 (可选):\n", | ||
footer: "关联关闭的 issue,例如:#31, #34(可选):\n", | ||
confirmCommit: "确定提交说明?", | ||
}, | ||
|
||
allowCustomScopes: true, | ||
allowBreakingChanges: ["feat", "fix"], | ||
// skip any questions you want | ||
// skipQuestions: ['scope', 'body'], | ||
|
||
// limit subject length | ||
subjectLimit: 100, | ||
// breaklineChar: '|', // It is supported for fields body and footer. | ||
// footerPrefix : 'ISSUES CLOSED:' | ||
// askForBreakingChangeFirst : true, // default is false | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
lib | ||
node_modules | ||
.eslintrc.js | ||
.lintstagedrc.js | ||
commitlint.config.js | ||
jest.config.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
module.exports = { | ||
// 共享配置:配置 TypeScript 推荐的校验规则 | ||
extends: [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:@typescript-eslint/recommended-requiring-type-checking", | ||
"prettier", | ||
// 新增 Jest 推荐的 ESLint 校验规则 | ||
// 所有规则集查看:https://github.com/jest-community/eslint-plugin-jest#rules(recommended 标识表明是推荐规则) | ||
"plugin:jest/recommended", | ||
"plugin:jest/style", | ||
], | ||
// 解析器:将 TypeScript 的 AST 转换成兼容 ESLint 的 AST | ||
parser: "@typescript-eslint/parser", | ||
parserOptions: { | ||
// 项目根目录的绝对路径 | ||
tsconfigRootDir: __dirname, | ||
// tsconfig.json 的相对路径 | ||
project: ["./tsconfig.json"], | ||
}, | ||
// 插件:提供 TypeScript 校验规则的实现 | ||
plugins: ["@typescript-eslint"], | ||
// 层叠配置:停止向上遍历 ESLint 配置文件 | ||
root: true, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: cd | ||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
test: | ||
name: CD 执行流程 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 下载 Github 仓库 | ||
uses: actions/checkout@v4 | ||
|
||
- name: 下载和安装 Node 环境 | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "16.x" | ||
# 一定要配置该参数,否则 cat $NPM_CONFIG_USERCONFIG 时会发现没有生成 .npmrc 配置文件,从而会导致发布需要登录认证而失败 | ||
registry-url: "https://registry.npmjs.org" | ||
|
||
- name: 安装依赖 | ||
run: npm ci | ||
|
||
- name: 代码校验 | ||
run: npm run lint | ||
|
||
- name: 单元测试 | ||
run: npm test | ||
|
||
- name: 测试报告 | ||
uses: coverallsapp/github-action@v2 | ||
|
||
- name: 文档构建 | ||
run: npm run docs:build | ||
|
||
# 如果代码构建失败,则不需要进行文档部署 | ||
- name: 代码构建 | ||
run: npm run build | ||
|
||
# 部署文档 | ||
- name: 部署文档 | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
# GTIHUB_TOKEN:https://docs.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token | ||
# Github 会在 workflow 中自动生成 GIHUBT_TOKEN,用于认证 workflow 的运行 | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
# 执行 npm run docs 命令后默认会在该目录下生成静态资源 | ||
publish_dir: ./docs/.vuepress/dist | ||
# 默认发布到 gh-pages 分支上,可以指定特定的发布分支 | ||
# publish_branch: gh-pages1 | ||
# https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-set-custom-commit-message | ||
# 设置上传到 gs-pages 分支的 commit 信息 | ||
full_commit_message: ${{ github.event.head_commit.message }} | ||
|
||
# 基于构建的代码进行版本发布 | ||
# cat $NPM_CONFIG_USERCONFIG 用于查看 CD 服务器上的 .npmrc 文件的内容 | ||
- name: 发布库包 | ||
run: | | ||
cat $NPM_CONFIG_USERCONFIG | ||
npm run release | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: ci | ||
on: | ||
push: | ||
branches: | ||
- demo/** | ||
- feat/** | ||
- fix/** | ||
|
||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
test: | ||
name: CI 执行流程 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 下载 Github 仓库 | ||
uses: actions/checkout@v4 | ||
|
||
- name: 下载和安装 Node 环境 | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "16.x" | ||
|
||
- name: 安装依赖 | ||
run: npm ci | ||
|
||
- name: 代码校验 | ||
run: npm run lint | ||
|
||
# 如果希望强制校验 cz,则也可以增加 commit 规范的校验流程 | ||
|
||
- name: 单元测试 | ||
run: npm test | ||
|
||
- name: 文档构建 | ||
run: npm run docs:build | ||
|
||
- name: 代码构建 | ||
run: npm run build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
.DS_Store | ||
node_modules | ||
lib | ||
release.log | ||
release.log | ||
coverage | ||
tsdoc | ||
docs/.vuepress/dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npx --no -- commitlint --edit ${1} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npx lint-staged |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = { | ||
// 注意和 package.json 中的 { "lint": "eslint --ext .ts src test" } 保持一致 | ||
"src/**/*.ts": "eslint", | ||
"test/**/*.ts": "eslint", | ||
// 新增暂存区代码的单元测试 | ||
"src/**/*.ts": "jest --bail --findRelatedTests", | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"MD013": false, | ||
"MD033": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll": true | ||
}, | ||
// 设置 Prettier 为 VS Code 的默认格式工具 | ||
"editor.defaultFormatter": "esbenp.prettier-vscode", | ||
// Prettier 保存自动格式化 | ||
"editor.formatOnSave": true, | ||
// 自动显示源文件的测试覆盖率百分比 | ||
"jest.showCoverageOnLoad": true, | ||
// Jest 保存自动测试 | ||
"jest.autoRun": "on-save", | ||
"docthis.includeTypes": false, | ||
"docthis.returnsTag": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
## <small>1.0.6 (2023-09-04)</small> | ||
|
||
* 工具(工程设计): .cz-config.js ([64b1641](https://github.com/ziyi2/micro-framework/commit/64b1641)) | ||
* 工具(工程设计): commitlint ([be38c64](https://github.com/ziyi2/micro-framework/commit/be38c64)) | ||
* 特性(工程设计): 定制 cz ([9cc8fef](https://github.com/ziyi2/micro-framework/commit/9cc8fef)) | ||
* 特性(工程设计): 新增 commitlint ([c03edc3](https://github.com/ziyi2/micro-framework/commit/c03edc3)) | ||
* 文档(工程设计): rEADME.md ([ee25d33](https://github.com/ziyi2/micro-framework/commit/ee25d33)) | ||
* feat(工程化): 新增 cz ([4af13e5](https://github.com/ziyi2/micro-framework/commit/4af13e5)) | ||
* npm micro demo ([d182af3](https://github.com/ziyi2/micro-framework/commit/d182af3)) | ||
* docs(readme.md): 新增 README.md 说明 ([7328a77](https://github.com/ziyi2/micro-framework/commit/7328a77)) | ||
* feat: 实现 CommonJS 规范的按需加载 ([9a4b7d2](https://github.com/ziyi2/micro-framework/commit/9a4b7d2)) | ||
* feat: 实现 CommonJS 规范的按需加载 ([2f83aed](https://github.com/ziyi2/micro-framework/commit/2f83aed)) | ||
* feat: 实现 CommonJS 规范的按需加载 ([299afae](https://github.com/ziyi2/micro-framework/commit/299afae)) | ||
* feat: 实现 CommonJS 规范的按需加载 ([d2ce60e](https://github.com/ziyi2/micro-framework/commit/d2ce60e)) | ||
* feat: 新增 ESLint 配置 ([d7828f9](https://github.com/ziyi2/micro-framework/commit/d7828f9)) | ||
* feat: 新增 ESLint 依赖 ([8052d8f](https://github.com/ziyi2/micro-framework/commit/8052d8f)) | ||
* feat: 新增 gulp 构建 ([56ecae4](https://github.com/ziyi2/micro-framework/commit/56ecae4)) | ||
* feat: 新增 Prettier 配置 ([be5aa9a](https://github.com/ziyi2/micro-framework/commit/be5aa9a)) | ||
* feat: 新增 Prettier 配置 ([7872617](https://github.com/ziyi2/micro-framework/commit/7872617)) | ||
* feat: 新增 Webpack 的库构建示例 ([485eaa8](https://github.com/ziyi2/micro-framework/commit/485eaa8)) | ||
* feat: 新增发布脚本 ([4377ad7](https://github.com/ziyi2/micro-framework/commit/4377ad7)) | ||
* feat: 新增发布脚本 ([e7b5075](https://github.com/ziyi2/micro-framework/commit/e7b5075)) | ||
* feat: 新增发布卡口设计 ([24f56d5](https://github.com/ziyi2/micro-framework/commit/24f56d5)) | ||
* feat: 新增发布卡口设计 ([0da5e14](https://github.com/ziyi2/micro-framework/commit/0da5e14)) | ||
* feat: 新增发布卡口设计 ([59effd7](https://github.com/ziyi2/micro-framework/commit/59effd7)) | ||
* feat: 新增发布卡口设计 ([8f3d210](https://github.com/ziyi2/micro-framework/commit/8f3d210)) | ||
* feat: 新增发布卡口设计 ([5a65f55](https://github.com/ziyi2/micro-framework/commit/5a65f55)) | ||
* feat: 新增发布卡口设计 ([8a4ad3c](https://github.com/ziyi2/micro-framework/commit/8a4ad3c)) | ||
* feat: 修复 build 构建脚本的 ESLint 错误 ([383175a](https://github.com/ziyi2/micro-framework/commit/383175a)) | ||
* feat: 修复 build 构建脚本的 ESLint 错误 ([10cfef4](https://github.com/ziyi2/micro-framework/commit/10cfef4)) | ||
* feat: add husky ([55bd16f](https://github.com/ziyi2/micro-framework/commit/55bd16f)) | ||
* feat: add iframe isolate test ([7292646](https://github.com/ziyi2/micro-framework/commit/7292646)) | ||
* feat: add lint git hook ([33b8a27](https://github.com/ziyi2/micro-framework/commit/33b8a27)) | ||
* feat: NPM 组件 ES Module 测试 ([bf6bd40](https://github.com/ziyi2/micro-framework/commit/bf6bd40)) | ||
* feat: NPM 组件 ES Module 测试 ([04474a4](https://github.com/ziyi2/micro-framework/commit/04474a4)) | ||
* feat: NPM 组件 ES Module 测试 ([eb33cd1](https://github.com/ziyi2/micro-framework/commit/eb33cd1)) | ||
* feat: NPM 组件 ES Module 测试 ([e45b5b4](https://github.com/ziyi2/micro-framework/commit/e45b5b4)) | ||
* feat: npm micro demo ([45d8f2b](https://github.com/ziyi2/micro-framework/commit/45d8f2b)) | ||
* feat: npm micro demo ([8cb3bb9](https://github.com/ziyi2/micro-framework/commit/8cb3bb9)) | ||
* feat: npm micro demo ([04a4eb8](https://github.com/ziyi2/micro-framework/commit/04a4eb8)) | ||
* feat: npm micro demo ([254650e](https://github.com/ziyi2/micro-framework/commit/254650e)) | ||
* feat: npm micro demo ([1981d14](https://github.com/ziyi2/micro-framework/commit/1981d14)) | ||
* feat: npm micro demo ([efaf061](https://github.com/ziyi2/micro-framework/commit/efaf061)) | ||
* feat: npm-micro-demo ([ccf66c8](https://github.com/ziyi2/micro-framework/commit/ccf66c8)) | ||
* feat: web 应用构建示例 ([897ee29](https://github.com/ziyi2/micro-framework/commit/897ee29)) | ||
* feat: web 应用构建示例 ([d156bc2](https://github.com/ziyi2/micro-framework/commit/d156bc2)) | ||
|
||
|
||
|
Oops, something went wrong.