Skip to content

Commit 81e6b82

Browse files
committed
feat(compiler): Init Project
1 parent 7ed12c4 commit 81e6b82

File tree

132 files changed

+30990
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+30990
-0
lines changed

.editorconfig

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# http://editorconfig.org
2+
root = true
3+
4+
[*]
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
11+
12+
[*.md]
13+
trim_trailing_whitespace = false
14+
15+
[Makefile]
16+
indent_style = tab

.eslintignore

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/lambda/
2+
/scripts
3+
/config
4+
.history
5+
public
6+
dist
7+
.umi
8+
mock

.eslintrc.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
extends: [require.resolve('@umijs/lint/dist/config/eslint')],
3+
globals: {
4+
page: true,
5+
REACT_APP_ENV: true,
6+
},
7+
};

.gitignore

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
**/node_modules
5+
# roadhog-api-doc ignore
6+
/src/utils/request-temp.js
7+
_roadhog-api-doc
8+
9+
# production
10+
/dist
11+
12+
# misc
13+
.DS_Store
14+
npm-debug.log*
15+
yarn-error.log
16+
17+
/coverage
18+
.idea
19+
yarn.lock
20+
package-lock.json
21+
*bak
22+
.vscode
23+
24+
25+
# visual studio code
26+
.history
27+
*.log
28+
functions/*
29+
.temp/**
30+
31+
# umi
32+
.umi
33+
.umi-production
34+
.umi-test
35+
36+
# screenshot
37+
screenshot
38+
.firebase
39+
.eslintcache
40+
41+
build

.husky/commit-msg

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
# Export Git hook params
5+
export GIT_PARAMS=$*
6+
7+
npx --no-install fabric verify-commit

.husky/pre-commit

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npx --no-install lint-staged

.prettierignore

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
**/*.svg
2+
.umi
3+
.umi-production
4+
/dist
5+
.dockerignore
6+
.DS_Store
7+
.eslintignore
8+
*.png
9+
*.toml
10+
docker
11+
.editorconfig
12+
Dockerfile*
13+
.gitignore
14+
.prettierignore
15+
LICENSE
16+
.eslintcache
17+
*.lock
18+
yarn-error.log
19+
.history
20+
CNAME
21+
/build
22+
/public

.prettierrc.js

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
module.exports = {
2+
singleQuote: true,
3+
trailingComma: 'all',
4+
printWidth: 100,
5+
proseWrap: 'never',
6+
endOfLine: 'lf',
7+
overrides: [
8+
{
9+
files: '.prettierrc',
10+
options: {
11+
parser: 'json',
12+
},
13+
},
14+
{
15+
files: 'document.ejs',
16+
options: {
17+
parser: 'html',
18+
},
19+
},
20+
],
21+
};

README.md

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# EAIRP Web
2+
3+
This is the new web UI implementation of [eairp](https://github.com/eairps/eairp).
4+
5+
## Environment Prepare
6+
7+
Install `node_modules`:
8+
9+
```bash
10+
npm install
11+
```
12+
13+
or
14+
15+
```bash
16+
yarn
17+
```
18+
19+
## Provided Scripts
20+
21+
Ant Design Pro provides some useful script to help you quick start and build with web project, code style check and test.
22+
23+
Scripts provided in `package.json`. It's safe to modify or add additional script:
24+
25+
### Start project
26+
27+
```bash
28+
npm start
29+
```
30+
31+
### Build project
32+
33+
```bash
34+
npm run build
35+
```
36+
37+
### Check code style
38+
39+
```bash
40+
npm run lint
41+
```
42+
43+
You can also use script to auto fix some lint error:
44+
45+
```bash
46+
npm run lint:fix
47+
```
48+
49+
### Test code
50+
51+
```bash
52+
npm test
53+
```

config/config.ts

+156
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
// https://umijs.org/config/
2+
import { defineConfig } from '@umijs/max';
3+
import { join } from 'path';
4+
import defaultSettings from './defaultSettings';
5+
import proxy from './proxy';
6+
import routes from './routes';
7+
8+
const { REACT_APP_ENV = 'dev' } = process.env;
9+
10+
export default defineConfig({
11+
/**
12+
* @name 开启 hash 模式
13+
* @description 让 build 之后的产物包含 hash 后缀。通常用于增量发布和避免浏览器加载缓存。
14+
* @doc https://umijs.org/docs/api/config#hash
15+
*/
16+
hash: true,
17+
18+
/**
19+
* @name 兼容性设置
20+
* @description 设置 ie11 不一定完美兼容,需要检查自己使用的所有依赖
21+
* @doc https://umijs.org/docs/api/config#targets
22+
*/
23+
// targets: {
24+
// ie: 11,
25+
// },
26+
/**
27+
* @name 路由的配置,不在路由中引入的文件不会编译
28+
* @description 只支持 path,component,routes,redirect,wrappers,title 的配置
29+
* @doc https://umijs.org/docs/guides/routes
30+
*/
31+
// umi routes: https://umijs.org/docs/routing
32+
routes,
33+
/**
34+
* @name 主题的配置
35+
* @description 虽然叫主题,但是其实只是 less 的变量设置
36+
* @doc antd的主题设置 https://ant.design/docs/react/customize-theme-cn
37+
* @doc umi 的theme 配置 https://umijs.org/docs/api/config#theme
38+
*/
39+
theme: {
40+
// 如果不想要 configProvide 动态设置主题需要把这个设置为 default
41+
// 只有设置为 variable, 才能使用 configProvide 动态设置主色调
42+
'root-entry-name': 'variable',
43+
},
44+
/**
45+
* @name moment 的国际化配置
46+
* @description 如果对国际化没有要求,打开之后能减少js的包大小
47+
* @doc https://umijs.org/docs/api/config#ignoremomentlocale
48+
*/
49+
ignoreMomentLocale: true,
50+
/**
51+
* @name 代理配置
52+
* @description 可以让你的本地服务器代理到你的服务器上,这样你就可以访问服务器的数据了
53+
* @see 要注意以下 代理只能在本地开发时使用,build 之后就无法使用了。
54+
* @doc 代理介绍 https://umijs.org/docs/guides/proxy
55+
* @doc 代理配置 https://umijs.org/docs/api/config#proxy
56+
*/
57+
proxy: proxy[REACT_APP_ENV as keyof typeof proxy],
58+
/**
59+
* @name 快速热更新配置
60+
* @description 一个不错的热更新组件,更新时可以保留 state
61+
*/
62+
fastRefresh: true,
63+
//============== 以下都是max的插件配置 ===============
64+
/**
65+
* @name 数据流插件
66+
* @@doc https://umijs.org/docs/max/data-flow
67+
*/
68+
model: {},
69+
/**
70+
* 一个全局的初始数据流,可以用它在插件之间共享数据
71+
* @description 可以用来存放一些全局的数据,比如用户信息,或者一些全局的状态,全局初始状态在整个 Umi 项目的最开始创建。
72+
* @doc https://umijs.org/docs/max/data-flow#%E5%85%A8%E5%B1%80%E5%88%9D%E5%A7%8B%E7%8A%B6%E6%80%81
73+
*/
74+
initialState: {},
75+
/**
76+
* @name layout 插件
77+
* @doc https://umijs.org/docs/max/layout-menu
78+
*/
79+
title: 'Ant Design Pro',
80+
layout: {
81+
locale: true,
82+
...defaultSettings,
83+
},
84+
/**
85+
* @name moment2dayjs 插件
86+
* @description 将项目中的 moment 替换为 dayjs
87+
* @doc https://umijs.org/docs/max/moment2dayjs
88+
*/
89+
moment2dayjs: {
90+
preset: 'antd',
91+
plugins: ['duration'],
92+
},
93+
/**
94+
* @name 国际化插件
95+
* @doc https://umijs.org/docs/max/i18n
96+
*/
97+
locale: {
98+
// default zh-CN
99+
default: 'zh-CN',
100+
antd: true,
101+
// default true, when it is true, will use `navigator.language` overwrite default
102+
baseNavigator: true,
103+
},
104+
/**
105+
* @name antd 插件
106+
* @description 内置了 babel import 插件
107+
* @doc https://umijs.org/docs/max/antd#antd
108+
*/
109+
antd: {},
110+
/**
111+
* @name 网络请求配置
112+
* @description 它基于 axios 和 ahooks 的 useRequest 提供了一套统一的网络请求和错误处理方案。
113+
* @doc https://umijs.org/docs/max/request
114+
*/
115+
request: {},
116+
/**
117+
* @name 权限插件
118+
* @description 基于 initialState 的权限插件,必须先打开 initialState
119+
* @doc https://umijs.org/docs/max/access
120+
*/
121+
access: {},
122+
/**
123+
* @name <head> 中额外的 script
124+
* @description 配置 <head> 中额外的 script
125+
*/
126+
headScripts: [
127+
// 解决首次加载时白屏的问题
128+
{ src: '/scripts/loading.js', async: true },
129+
],
130+
//================ pro 插件配置 =================
131+
presets: ['umi-presets-pro'],
132+
/**
133+
* @name openAPI 插件的配置
134+
* @description 基于 openapi 的规范生成serve 和mock,能减少很多样板代码
135+
* @doc https://pro.ant.design/zh-cn/docs/openapi/
136+
*/
137+
openAPI: [
138+
{
139+
requestLibPath: "import { request } from '@umijs/max'",
140+
// 或者使用在线的版本
141+
// schemaPath: "https://gw.alipayobjects.com/os/antfincdn/M%24jrzTTYJN/oneapi.json"
142+
schemaPath: join(__dirname, 'oneapi.json'),
143+
mock: false,
144+
},
145+
{
146+
requestLibPath: "import { request } from '@umijs/max'",
147+
schemaPath: 'https://gw.alipayobjects.com/os/antfincdn/CA1dOm%2631B/openapi.json',
148+
projectName: 'swagger',
149+
},
150+
],
151+
mfsu: {
152+
strategy: 'normal',
153+
},
154+
esbuildMinifyIIFE: true,
155+
requestRecord: {},
156+
});

config/defaultSettings.ts

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { ProLayoutProps } from '@ant-design/pro-components';
2+
3+
/**
4+
* @name
5+
*/
6+
const Settings: ProLayoutProps & {
7+
pwa?: boolean;
8+
logo?: string;
9+
} = {
10+
navTheme: 'light',
11+
// 拂晓蓝
12+
colorPrimary: '#1890ff',
13+
layout: 'mix',
14+
contentWidth: 'Fluid',
15+
fixedHeader: false,
16+
fixSiderbar: true,
17+
colorWeak: false,
18+
title: 'Ant Design Pro',
19+
pwa: true,
20+
logo: 'https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg',
21+
iconfontUrl: '',
22+
token: {
23+
// 参见ts声明,demo 见文档,通过token 修改样式
24+
//https://procomponents.ant.design/components/layout#%E9%80%9A%E8%BF%87-token-%E4%BF%AE%E6%94%B9%E6%A0%B7%E5%BC%8F
25+
},
26+
};
27+
28+
export default Settings;

0 commit comments

Comments
 (0)