Skip to content

Commit a0f1ccc

Browse files
committed
feat: 更新一下吧
1 parent 12c06be commit a0f1ccc

File tree

1,382 files changed

+68661
-57488
lines changed

Some content is hidden

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

1,382 files changed

+68661
-57488
lines changed

.babelrc

-4
This file was deleted.

.eslintignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/functions/mock/**
2+
/script
3+
/config
4+
/src

.eslintrc.js

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
module.exports = {
2+
parser: 'babel-eslint',
3+
extends: ['airbnb', 'prettier', 'plugin:compat/recommended'],
4+
env: {
5+
browser: true,
6+
node: true,
7+
es6: true,
8+
mocha: true,
9+
jest: true,
10+
jasmine: true,
11+
},
12+
globals: {
13+
APP_TYPE: true,
14+
page: true,
15+
},
16+
rules: {
17+
'react/jsx-filename-extension': [1, { extensions: ['.js'] }],
18+
'react/jsx-wrap-multilines': 0,
19+
'react/prop-types': 0,
20+
'react/forbid-prop-types': 0,
21+
'react/jsx-one-expression-per-line': 0,
22+
'import/no-unresolved': [2, { ignore: ['^@/', '^umi/'] }],
23+
'import/no-extraneous-dependencies': [
24+
2,
25+
{
26+
optionalDependencies: true,
27+
devDependencies: ['**/tests/**.js', '/mock/**/**.js', '**/**.test.js'],
28+
},
29+
],
30+
'jsx-a11y/no-noninteractive-element-interactions': 0,
31+
'jsx-a11y/click-events-have-key-events': 0,
32+
'jsx-a11y/no-static-element-interactions': 0,
33+
'jsx-a11y/anchor-is-valid': 0,
34+
'linebreak-style': 0,
35+
},
36+
settings: {
37+
polyfills: ['fetch', 'promises', 'url'],
38+
},
39+
};

.flowconfig

-14
This file was deleted.

.gitignore

+16-8
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,37 @@
11
# See https://help.github.com/ignore-files/ for more about ignoring files.
2+
# misc
3+
.DS_Store
4+
npm-debug.log*
5+
6+
# umi
7+
.umi
8+
*.umi-production
9+
.vscode/settings.json
210

311
# dependencies
412
/node_modules
5-
613
# testing
714
/coverage
815
/package-lock.json
916
# production
10-
1117
# misc
12-
.DS_Store
1318
.env.local
1419
.env.development.local
1520
.env.test.local
1621
.env.production.local
17-
18-
npm-debug.log*
22+
yarn-error.log
1923
yarn-debug.log*
2024
*.iws
2125
*.iml
2226
*.ipr
2327
*svn/
2428
.idea/
25-
*.jar
26-
yarn.lock
27-
yarn-error.log
2829
/build/*
2930
/dist/*
31+
.temp/*
32+
config/config.prod.js
33+
.umirc.local.js
34+
.build.js
35+
dep.sh
36+
scp.sh
37+
script/*

.prettierignore

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
**/*.md
2+
**/*.svg
3+
**/*.ejs
4+
**/*.html
5+
package.json
6+
.umi
7+
.umi-production
8+
.umi-test

.prettierrc

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"singleQuote": true,
3+
"trailingComma": "all",
4+
"printWidth": 80,
5+
"overrides": [
6+
{
7+
"files": ".prettierrc",
8+
"options": { "parser": "json" }
9+
}
10+
]
11+
}

.umirc.js

+163
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
import fs from 'fs';
2+
import pageRoutes from './config/router.config';
3+
import webpackPlugin from './config/plugin.config';
4+
import defaultSettings from './src/defaultSettings';
5+
import { defineConfig, utils } from 'umi';
6+
7+
const { winPath } = utils;
8+
9+
// 默认接口地址
10+
var host = 'http://127.0.0.1:9510';
11+
// 默认根目录
12+
var base = '';
13+
// 为了build后部署时不折腾nginx的try_files
14+
var history = 'hash';
15+
16+
// .umirc.js当做fashop的默认配置,.build.js是为了方便在本地编译生产环境下的配置
17+
if (fs.existsSync('.build.js')) {
18+
const build = require('./.build.js');
19+
if (build['host'] !== 'undefined') {
20+
host = build.host;
21+
}
22+
if (build['base'] !== 'undefined') {
23+
base = build.base;
24+
}
25+
if (build['history'] !== 'undefined') {
26+
history = build.history;
27+
}
28+
}
29+
30+
export default defineConfig({
31+
hash: true,
32+
history: {
33+
type: 'hash',
34+
},
35+
base: base,
36+
publicPath: base,
37+
antd: {},
38+
dva: {
39+
skipModelValidate: true,
40+
hmr: true,
41+
immer: true,
42+
// 注:如需兼容 IE11,需配置 { immer: { enableES5: true }}。
43+
},
44+
locale: {
45+
default: 'zh-CN', // default zh-CN
46+
baseNavigator: false, // default true, when it is true, will use `navigator.language` overwrite default
47+
antd: false,
48+
},
49+
targets: {
50+
chrome: 79,
51+
firefox: false,
52+
safari: false,
53+
edge: false,
54+
ios: false,
55+
},
56+
dynamicImport: {
57+
loading: "@/components/pageLoading/index"
58+
},
59+
define: {
60+
APP_TYPE: process.env.APP_TYPE || '',
61+
'process.env.dev': {
62+
websocket: {
63+
host: host.replace('http', 'ws'),
64+
},
65+
// 开发环境下的api走proxy
66+
},
67+
'process.env.production': {
68+
websocket: {
69+
host: host.replace('http', 'ws'),
70+
},
71+
api: {
72+
url: host,
73+
},
74+
},
75+
'process.env.base': history === 'hash' ? base + '#/' : base,
76+
},
77+
// 路由配置
78+
routes: pageRoutes,
79+
// Theme for antd
80+
// https://ant.design/docs/react/customize-theme-cn
81+
theme: {
82+
'primary-color': defaultSettings.primaryColor,
83+
'layout-header-background': '#000',
84+
'menu-bg': '#000',
85+
'menu-dark-bg': '#000',
86+
'menu-dark-submenu-bg': '#151515',
87+
},
88+
/**
89+
* 部署(build)模式下无效,仅供开发环境下
90+
*/
91+
proxy: {
92+
'/admin': {
93+
target: host,
94+
changeOrigin: true,
95+
pathRewrite: { '^/admin': '/admin' },
96+
secure: false,
97+
},
98+
},
99+
ignoreMomentLocale: true,
100+
inlineLimit: 1,
101+
// 暂时关闭
102+
pwa: false,
103+
lessLoader: {
104+
javascriptEnabled: true,
105+
},
106+
crossorigin: true,
107+
cssLoader: {
108+
localsConvention: 'camelCase',
109+
modules: {
110+
getLocalIdent: (context, _, localName) => {
111+
if (
112+
context.resourcePath.includes('node_modules') ||
113+
context.resourcePath.includes('ant.design.pro.less') ||
114+
context.resourcePath.includes('global.less')
115+
) {
116+
return localName;
117+
}
118+
const match = context.resourcePath.match(/src(.*)/);
119+
if (match && match[1]) {
120+
// css的防冲突 以文件位置来索引
121+
if (match[1].includes('.css')) {
122+
const antdProPath = match[1].replace('.css', '');
123+
const arr = winPath(antdProPath)
124+
.split('/')
125+
.map((a) => a.replace(/([A-Z])/g, '-$1'))
126+
.map((a) => a.toLowerCase());
127+
return `${arr.join('-')}-${localName}`.replace(/--/g, '-');
128+
}
129+
// less的防冲突 以文件位置来索引
130+
const antdProPath = match[1].replace('.less', '');
131+
const arr = winPath(antdProPath)
132+
.split('/')
133+
.map((a) => a.replace(/([A-Z])/g, '-$1'))
134+
.map((a) => a.toLowerCase());
135+
return `antd-pro${arr.join('-')}-${localName}`.replace(/--/g, '-');
136+
}
137+
return localName;
138+
},
139+
},
140+
141+
},
142+
manifest: {
143+
basePath: '/',
144+
},
145+
chainWebpack: webpackPlugin,
146+
// 引入被 external 库的 scripts
147+
// 区分 development 和 production,使用不同的产物
148+
scripts: process.env.NODE_ENV === 'development' ? [
149+
'https://cdn.jsdelivr.net/npm/[email protected]/umd/react.development.min.js',
150+
'https://cdn.jsdelivr.net/npm/[email protected]/umd/react-dom.development.min.js',
151+
'https://cdn.jsdelivr.net/npm/[email protected]/umd/react-dom-server.browser.development.js',
152+
'https://libs.cdnjs.net/moment.js/2.29.1/moment.min.js',
153+
] : [
154+
'https://gw.alipayobjects.com/os/lib/react/16.14.0/umd/react.production.min.js',
155+
'https://gw.alipayobjects.com/os/lib/react-dom/16.14.0/umd/react-dom.production.min.js',
156+
'https://gw.alipayobjects.com/os/lib/react-dom/16.14.0/umd/react-dom-server.browser.production.min.js',
157+
'https://libs.cdnjs.net/moment.js/2.29.1/moment.min.js',
158+
],
159+
externals: {
160+
'react': 'window.React',
161+
'react-dom': 'window.ReactDOM',
162+
},
163+
});

0 commit comments

Comments
 (0)