Skip to content

Commit 372391f

Browse files
author
白唯
committed
fix(修复提交工具): 更改git-cz 配置文件
1 parent 2770736 commit 372391f

8 files changed

+198
-79
lines changed

.czrc

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"path": "cz-conventional-changelog",
3+
"disableScopeLowerCase": false,
4+
"disableSubjectLowerCase": false,
5+
"maxHeaderWidth": 100,
6+
"maxLineWidth": 100,
7+
"defaultType": "",
8+
"defaultScope": "",
9+
"defaultSubject": "",
10+
"defaultBody": "",
11+
"defaultIssues": "",
12+
"types": {
13+
"feat": {
14+
"description": "新功能",
15+
"title": "新增"
16+
},
17+
"fix": {
18+
"description": "bug 修复",
19+
"title": "修复"
20+
},
21+
"style": {
22+
"description": "UI相关",
23+
"title": "UI"
24+
},
25+
"refactor": {
26+
"description": "代码重构",
27+
"title": "重构"
28+
},
29+
"docs": {
30+
"description": "文档更新",
31+
"title": "文档"
32+
},
33+
"build": {
34+
"description": "构建系统或者包依赖更新",
35+
"title": "构建系统或者包依赖更新"
36+
},
37+
"ci": {
38+
"description": "CI/CD,自动构建,持续集成相关",
39+
"title": "CI/CD"
40+
},
41+
"test": {
42+
"description": "测试用例相关",
43+
"title": "测试"
44+
},
45+
"perf": {
46+
"description": "优化",
47+
"title": "优化"
48+
},
49+
"chore": {
50+
"description": "非src或者测试文件的更新",
51+
"title": "非 src 或者 测试文件的更新"
52+
},
53+
"revert": {
54+
"description": "回到上一个版本",
55+
"title": "回溯"
56+
}
57+
}
58+
}

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@ pnpm-debug.log*
2323
*.sw?
2424

2525
# local docs
26-
todo-list.md
26+
todo-list.md
27+
*todo-list*.md

CHANGELOG.md

+10
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
## 0.1.2 (2020-09-03)
2+
3+
4+
### Features
5+
6+
* **基础代码架构:** 项目基础代码初始化,目前只有vue 全家桶 d4e8514
7+
* **项目搭建:** 初步完成除了UI 库以外的基础配置 f3da208
8+
9+
10+
111
## 0.1.1 (2020-09-03)
212

313

package.json

+2-59
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue3",
3-
"version": "0.1.2",
3+
"version": "0.1.3",
44
"private": true,
55
"scripts": {
66
"serve": "vue-cli-service serve",
@@ -75,63 +75,6 @@
7575
"not dead"
7676
],
7777
"config": {
78-
"commitizen": {
79-
"path": "./node_modules/cz-conventional-changelog",
80-
"disableScopeLowerCase": false,
81-
"disableSubjectLowerCase": false,
82-
"maxHeaderWidth": 100,
83-
"maxLineWidth": 100,
84-
"defaultType": "",
85-
"defaultScope": "",
86-
"defaultSubject": "",
87-
"defaultBody": "",
88-
"defaultIssues": "",
89-
"types": {
90-
"feat": {
91-
"description": "新功能",
92-
"title": "新增"
93-
},
94-
"fix": {
95-
"description": "bug 修复",
96-
"title": "修复"
97-
},
98-
"style": {
99-
"description": "UI相关",
100-
"title": "UI"
101-
},
102-
"refactor": {
103-
"description": "代码重构",
104-
"title": "重构"
105-
},
106-
"docs": {
107-
"description": "文档更新",
108-
"title": "文档"
109-
},
110-
"build": {
111-
"description": "构建系统或者包依赖更新",
112-
"title": "构建系统或者包依赖更新"
113-
},
114-
"ci": {
115-
"description": "CI/CD,自动构建,持续集成相关",
116-
"title": "CI/CD"
117-
},
118-
"test": {
119-
"description": "测试用例相关",
120-
"title": "测试"
121-
},
122-
"perf": {
123-
"description": "优化",
124-
"title": "优化"
125-
},
126-
"chore": {
127-
"description": "非src或者测试文件的更新",
128-
"title": "非 src 或者 测试文件的更新"
129-
},
130-
"revert": {
131-
"description": "回到上一个版本",
132-
"title": "回溯"
133-
}
134-
}
135-
}
78+
"commitizen": {}
13679
}
13780
}

src/api/apiList.ts

+35-12
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,50 @@
22

33
import { Method, ResponseType } from 'axios'
44

5-
interface ApiListItem {
6-
[key: string]: Array<{ url: string; method?: Method; resType?: ResponseType }>
5+
interface ApiListItemType {
6+
url: string
7+
method: Method
8+
resType: ResponseType
79
}
10+
11+
/** API 模块名 */
12+
type ApiModuleKey = 'user' | 'article'
13+
14+
/** 模块名下的属性名 */
15+
type UserModuleKey = 'login' | 'register' | 'logout'
16+
type ArticleModuleKey = 'list'
17+
18+
type ApiListItem = {
19+
user: { [key in UserModuleKey]: ApiListItemType }
20+
article: { [key in ArticleModuleKey]: ApiListItemType }
21+
}
22+
23+
/** 以对象的方式,对智能提示更好 */
824
const ApiList: ApiListItem = {
9-
user: [
10-
{
25+
user: {
26+
login: {
1127
url: '/login',
1228
method: 'post',
1329
resType: 'json'
1430
},
15-
{
16-
url: '/login',
17-
method: 'get',
31+
register: {
32+
url: '/register',
33+
method: 'post',
34+
resType: 'json'
35+
},
36+
logout: {
37+
url: '/register',
38+
method: 'post',
1839
resType: 'json'
1940
}
20-
],
21-
other: [
22-
{
23-
url: 'fd'
41+
},
42+
article: {
43+
list: {
44+
url: '/list',
45+
method: 'get',
46+
resType: 'json'
2447
}
25-
]
48+
}
2649
}
2750

2851
export default ApiList

src/api/user.ts

+11-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import API from './request'
1+
import API from './axios'
2+
import ApiList from './apiList'
3+
4+
const { user } = ApiList
5+
26
interface HttpParams {
37
coinName: string
48
cashName: string
@@ -13,12 +17,12 @@ export interface UserApi {
1317
* @todo Get the exchange rate of the current currency
1418
*/
1519
class User {
16-
register() {
17-
/* return API.get<{ data: string | { error: string } }>(`/market/${targetCoin}/${param.cashName.toLowerCase()}`, {
18-
params: {
19-
t: new Date().getTime()
20-
}
21-
}).then(({ data }) => data) */
20+
async register(): Promise<any> {
21+
return await API({
22+
method: user.register.method,
23+
url: user.register.url,
24+
responseType: user.register.resType
25+
})
2226
}
2327
}
2428

todo-list-today.md

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# 基于 vue2.x | vue3 的项目基础架构搭建
2+
3+
说明: [x] 已完成 [ ] 未完成
4+
5+
#### 主要用到的库
6+
7+
- vue 全家桶 vue3 + vue-router + vuex + typescript
8+
- http 请求:axios
9+
- ui 库:ant-design-vue.
10+
- 提交规范:git cz commitizen,版本更改历史: changelog
11+
- 文档工具:typedoc
12+
- 代码检查:eslint+eslint-typescript,格式化:prettier.
13+
- 测试用例:mocha,ts-node
14+
15+
#### 代码基础架构说明
16+
17+
- <b>api</b> http 请求相关文件夹
18+
- <b>assets</b> 静态资源文件,未经压缩的,会走 webpack 压缩流程
19+
- <b>public</b> 静态资源文件,根目录,不会经过 webpack 压缩打包,存放已经处理好的第三方资源,会原样输出
20+
- ...
21+
22+
#### 组件编写
23+
24+
- [x] 支持 tsx 方式编写页面,在.tsx 文件或者 class-component 里写 tsx.
25+
- [x] 支持 class-component 写法.
26+
- [x] 同时支持(.vue|.tsx.|.ts) 编写页面,defineComponent 以及 class-componnet 都支持智能提示.
27+
28+
#### 样式配置
29+
30+
> 均通过 webpack 实现.
31+
32+
- [x] 自动注入全局样式
33+
- [x] 配置全局 less 变量
34+
- [x] 支持自定义 UI 库的主题颜色
35+
36+
#### 网络请求
37+
38+
- [x] 基于 axios 封装脱离具体业务逻辑的网络请求,支持编写脱离浏览器环境的测试用例.(跟业务无关)
39+
- [ ] 基于具体业务逻辑再次封装网络请求 (跟业务相关,此项需要依据具体后台应用接口编写)
40+
41+
#### 数据状态管理
42+
43+
- [x] 建立应用数据状态管理
44+
- [x] 编写更加建议读取的方法,并完善 type
45+
- [x] 支持多个模块,以及自动装载模块
46+
- [ ] 支持持久化 (vue3 暂不支持)
47+
48+
#### UI 库
49+
50+
- [ ] 添加 ant-design-vue,支持按需加载
51+
- [ ] 将 UI 库部分功能如 message 添加到根目录
52+
53+
#### 插件与常用工具函数
54+
55+
- [ ] 引用常用工具函数
56+
57+
#### 配置
58+
59+
- [ ] 配置 webpack,分离开发/测试/生产环境配置.
60+
- [ ] 添加 webpack 常用插件,优化打包配置.
61+
- [x] 根据环境配置 vue-cli 环境变量(环境相关)
62+
- [x] 配置应用全局静态常量(业务相关)
63+
- [x] 完成 tsconfig 相关配置
64+
- [x] 增加编辑器配置
65+
66+
#### 开发工具
67+
68+
- [x] eslint 代码检查,配置 prettier 格式化工具,使检查规则和格式化规则一致
69+
- [x] 新增提交规范 git cz commitizen,统一代码提交规范
70+
- [x] 在提交规范的基础上,增加版本更改历史,自动生成 changelog
71+
- [ ] 为没有 type 的库和变量添加 shims
72+
73+
#### 文档
74+
75+
- [ ] 使用 TYPEDOC 搭建项目文档应用 (typescript4 暂时有 bug)
76+
- [x] 配置 http-server 启动文档应用
77+
78+
#### 测试用例
79+
80+
- [ ] 支持编写 js,ts 的测试用例

todo-list.png

-274 KB
Binary file not shown.

0 commit comments

Comments
 (0)