Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Demo/GitHub actions ci #1

Merged
merged 35 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
8052d8f
feat: 新增 ESLint 依赖
ziyi2 Mar 7, 2023
d7828f9
feat: 新增 ESLint 配置
ziyi2 Mar 9, 2023
7872617
feat: 新增 Prettier 配置
ziyi2 Mar 12, 2023
be5aa9a
feat: 新增 Prettier 配置
ziyi2 Mar 12, 2023
55bd16f
feat: add husky
ziyi2 Mar 12, 2023
33b8a27
feat: add lint git hook
ziyi2 Mar 12, 2023
10cfef4
feat: 修复 build 构建脚本的 ESLint 错误
ziyi2 Mar 14, 2023
383175a
feat: 修复 build 构建脚本的 ESLint 错误
ziyi2 Mar 14, 2023
4af13e5
feat(工程化): 新增 cz
ziyi2 Aug 29, 2023
7328a77
docs(readme.md): 新增 README.md 说明
ziyi2 Aug 30, 2023
9cc8fef
特性(工程设计): 定制 cz
ziyi2 Sep 1, 2023
ee25d33
文档(工程设计): rEADME.md
ziyi2 Sep 1, 2023
64b1641
工具(工程设计): .cz-config.js
ziyi2 Sep 1, 2023
c03edc3
特性(工程设计): 新增 commitlint
ziyi2 Sep 4, 2023
be38c64
工具(工程设计): commitlint
ziyi2 Sep 4, 2023
f77bc9a
特性(工程设计): 新增 chagelog
ziyi2 Sep 4, 2023
f94a214
特性(工程设计): 新增 Jest 单元测试
ziyi2 Sep 11, 2023
6f9b97d
文档(工程设计): jest 运行说明
ziyi2 Sep 11, 2023
2356144
特性(工程设计): 新增 Jest 的 ESLint 配置
ziyi2 Sep 12, 2023
c0fcac6
特性(工程设计): 新增 Jest 的提交钩子,确保测试通过才能进行代码提交
ziyi2 Sep 13, 2023
720b786
特性(工程设计): 新增 Jest 的发布前检测处理
ziyi2 Sep 14, 2023
06a9191
特性(工程设计): 新增 VuePress 文档站点生成器,用于快速生成框架的开发指南
ziyi2 Sep 20, 2023
7d701d9
特性(工程设计): 新增 TypeDoc,用于自动生成 API 文档
ziyi2 Sep 22, 2023
507a7bc
工具(框架原理): vuePress 结合 TypeDoc
ziyi2 Sep 25, 2023
6971470
修复(工程设计): 固定工具版本
ziyi2 Oct 2, 2023
badfc8e
特性(工程设计): 新增 Github Actions 单元测试
ziyi2 Oct 2, 2023
6a8209a
文档(工程设计): 新增 Github Actions 的注释说明
ziyi2 Oct 2, 2023
427c942
开发中(工程设计): github Actions 的 CI 设计
ziyi2 Oct 2, 2023
c423972
特性(工程设计): 新增 CI 设计流程
ziyi2 Oct 9, 2023
613e8bd
文档(工程设计): cI 说明变更
ziyi2 Oct 9, 2023
f3a622c
feat: 新增 Github Actions 示例
ziyi2 Oct 9, 2023
352ff6b
修复(工程设计): 修复 ESLint 报错
ziyi2 Oct 9, 2023
6900b10
特性(工程设计): 新增 PR 的 CI 流程设计
ziyi2 Oct 10, 2023
f560124
feat: 测试 CI 失败场景
ziyi2 Oct 10, 2023
ae5d071
修复(工程设计): 修复 ESLint 错误
ziyi2 Oct 11, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .commitlintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = { extends: ["cz"] };
69 changes: 69 additions & 0 deletions .cz-config.js
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
};
6 changes: 6 additions & 0 deletions .eslintignore
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
25 changes: 25 additions & 0 deletions .eslintrc.js
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,
};
41 changes: 41 additions & 0 deletions .github/workflows/ci.yml
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
5 changes: 4 additions & 1 deletion .gitignore
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
4 changes: 4 additions & 0 deletions .husky/commit-msg
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}
4 changes: 4 additions & 0 deletions .husky/pre-commit
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
7 changes: 7 additions & 0 deletions .lintstagedrc.js
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",
};
4 changes: 4 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"MD013": false,
"MD033": false
}
15 changes: 15 additions & 0 deletions .vscode/settings.json
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
}
49 changes: 49 additions & 0 deletions CHANGELOG.md
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))



Loading