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

feat: 支持commitizen #166

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
21 changes: 14 additions & 7 deletions template/framework-base/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
- [x] 内置面包屑方案,支持动态面包屑
- [x] 支持 svg-icon
- [x] 支持 es [optional-chaining](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining) 和 [nullish-coalescing-operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Nullish_coalescing_operator)
- [x] 支持[commitizen](https://github.com/commitizen/cz-cli)规范 git commit

[⬆ Back to Top](#table-of-contents)

Expand Down Expand Up @@ -75,7 +76,7 @@ yarn generate
├── package.json
├── src 开发目录
│   ├── services api 资源管理
│   │   ├── common service 公用的类库、BASE URL 定义等
│   │   ├── common service 公用的类库、BASE URL 定义等
│   │   │   ├── api.js 统一管理服务路径和 API version
│   │   │   └── repository.js RESTful 生成类,可以继承实现满足业务需求
│   │   ├── basic.js 一些基本的 services
Expand Down Expand Up @@ -136,6 +137,7 @@ Nuxt.js 会依据 `pages` 目录中的所有 `*.vue` 文件生成应用的路由
1. 在 `services` 中定义一个 API

在 `src/services` 下新建一个 `example.js`

```js
// 创建了一个 example 的 RESTful API
import {Repository} from './common/repository'
Expand Down Expand Up @@ -276,9 +278,14 @@ env: {

**注意,每次修改代理设置,都需要重新启动应用才能生效**

### git 规范 commit 信息

在`git add xx`添加修改的文件之后,使用`yarn commit`或者`npm run commit`代替`git commit -m`

[⬆ Back to Top](#table-of-contents)

### 参考链接

- [TypeScript FAQ](https://deepexi.yuque.com/docs/share/ec81b0e7-b1b4-426c-a66c-8c293e7185c2)
- [Composition API Best Practices](https://deepexi.yuque.com/docs/share/54bd68ca-27bb-4db8-8b26-f2dd1de406ff)

Expand Down Expand Up @@ -309,12 +316,12 @@ mounted() {

**自带的环境变量说明**

| 环境变量名 | 说明 | 是否必须 | 默认值 | 示例 |
| ----------- | ------------------------------------------------------ | -------- | ------ | ------------------------- |
| PUBLIC_PATH | 对应 webpack 的 publicPath,用于指定静态文件访问路径 | 是 | | http://cdn.deepexi.com |
| API_SERVER | axios 的 baseURL,可不传。不传时,使用相对路径发送请求 | 否 | | https://www.easy-mock.com |
| NO_LOGIN | 是否登陆拦截,传 1 则不会有登录拦截 | 否 | | 1 |
| APP_ID | 应用 ID | 否 | | |
| 环境变量名 | 说明 | 是否必须 | 默认值 | 示例 |
| ----------- | ------------------------------------------------------ | -------- | ------ | --------------------------- |
| PUBLIC_PATH | 对应 webpack 的 publicPath,用于指定静态文件访问路径 | 是 | | <http://cdn.deepexi.com> |
| API_SERVER | axios 的 baseURL,可不传。不传时,使用相对路径发送请求 | 否 | | <https://www.easy-mock.com> |
| NO_LOGIN | 是否登陆拦截,传 1 则不会有登录拦截 | 否 | | 1 |
| APP_ID | 应用 ID | 否 | | |

[⬆ Back to Top](#table-of-contents)

Expand Down
10 changes: 9 additions & 1 deletion template/framework-base/_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@
"start": "cross-env HOST=0.0.0.0 PORT=3333 MODE=prod nuxt start",
"stdver": "standard-version -m '[skip ci] chore(release): v%s'",
"release": "gren release --override",
"lint": "eslint \"src/**/*.@(js|ts|vue)\" --ignore-path .gitignore . --fix && stylelint src/**/*.{vue,less} --fix"
"lint": "eslint \"src/**/*.@(js|ts|vue)\" --ignore-path .gitignore . --fix && stylelint src/**/*.{vue,less} --fix",
"commit": "git-cz"
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
},
"dependencies": {
"@femessage/upload-to-ali": "latest",
Expand All @@ -47,12 +53,14 @@
"@babel/plugin-proposal-nullish-coalescing-operator": "7.8.3",
"@commitlint/cli": "8.2.0",
"@commitlint/config-conventional": "8.2.0",
"commitizen": "^4.2.3",
<%_ if (language !== 'TypeScript') { _%>
"babel-eslint": "10.1.0",
<%_ } _%>
"babel-jest": "24.9.0",
"core-js": "3.7.0",
"cross-env": "5.2.1",
"cz-conventional-changelog": "^3.3.0",
"eslint": "7.13.0",
"eslint-config-prettier": "6.15.0",
"eslint-friendly-formatter": "4.0.1",
Expand Down