Commit c7bffe52 authored by 陈帅's avatar 陈帅

Merge branch 'master' into v4

parents 4a7320ed b8c5c015
......@@ -10,7 +10,7 @@ module.exports = {
jasmine: true,
},
globals: {
APP_TYPE: true,
ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION: true, // preview.pro.ant.design only do not use in your production ; preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。
page: true,
},
rules: {
......@@ -27,6 +27,7 @@ module.exports = {
devDependencies: ['**/tests/**.js', '/mock/**/**.js', '**/**.test.js'],
},
],
'import/no-cycle': 0,
'jsx-a11y/no-noninteractive-element-interactions': 0,
'jsx-a11y/click-events-have-key-events': 0,
'jsx-a11y/no-static-element-interactions': 0,
......
**/*.md
**/*.svg
package.json
.umi
......
......@@ -2,6 +2,7 @@
"singleQuote": true,
"trailingComma": "all",
"printWidth": 100,
"proseWrap": "never",
"overrides": [
{
"files": ".prettierrc",
......
......@@ -6,7 +6,8 @@ import defaultSettings from './defaultSettings';
import webpackPlugin from './plugin.config';
const { pwa, primaryColor } = defaultSettings;
const { APP_TYPE, TEST } = process.env;
// preview.pro.ant.design only do not use in your production ; preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。
const { ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION, TEST } = process.env;
const plugins: IPlugin[] = [
[
......@@ -57,8 +58,8 @@ const plugins: IPlugin[] = [
];
// 针对 preview.pro.ant.design 的 GA 统计代码
// 业务上不需要这个
if (APP_TYPE === 'site') {
// preview.pro.ant.design only do not use in your production ; preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。
if (ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION === 'site') {
plugins.push([
'umi-plugin-ga',
{
......@@ -71,12 +72,14 @@ export default {
// add for transfer to umi
plugins,
define: {
APP_TYPE: APP_TYPE || '',
ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION:
ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION || '', // preview.pro.ant.design only do not use in your production ; preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。
},
treeShaking: true,
targets: {
ie: 11,
},
devtool: ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION ? 'source-map' : false,
// 路由配置
routes: [
{
......
......@@ -24,8 +24,11 @@ function getModulePackageName(module) {
}
export default config => {
// pro 和 开发环境再添加这个插件
if (process.env.APP_TYPE === 'site' || process.env.NODE_ENV !== 'production') {
// preview.pro.ant.design only do not use in your production ; preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。
if (
process.env.ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION === 'site' ||
process.env.NODE_ENV !== 'production'
) {
// 将所有 less 合并为一个供 themePlugin使用
const outFile = path.join(__dirname, '../.temp/ant-design-pro.less');
const stylesDir = path.join(__dirname, '../src/');
......
module.exports = {
testURL: 'http://localhost:8000',
preset: 'jest-puppeteer',
extraSetupFiles: ['./tests/setupTests.js'],
globals: {
APP_TYPE: false,
ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION: false, // preview.pro.ant.design only do not use in your production ; preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。
},
};
......@@ -14,7 +14,7 @@ function parseKey(key) {
method = spliced[0].toLowerCase();
path = spliced[1]; // eslint-disable-line
}
const routerBasePath = process.env.NODE_ENV === 'dev' ? `${path}` : `/.netlify/functions${path}`;
const routerBasePath = `${path}`;
return {
method,
path: routerBasePath,
......
......@@ -3,7 +3,7 @@
[[redirects]]
from = "/api/*"
to = "https://us-central1-antd-pro.cloudfunctions.net/api/api/:splat"
to = "/.netlify/functions/api/:splat"
status = 200
force = true
[redirects.headers]
......
......@@ -28,7 +28,8 @@
"lint:style": "stylelint 'src/**/*.less' --syntax less",
"lint:ts": "tslint -p . -c tslint.yml",
"prettier": "node ./scripts/prettier.js",
"start": "cross-env APP_TYPE=site umi dev",
"site": "umi build && npm run functions:build",
"start": "cross-env ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION=site umi dev",
"start:no-mock": "cross-env MOCK=none umi dev",
"test": "umi test",
"test:all": "node ./tests/run-tests.js",
......@@ -111,29 +112,27 @@
"gh-pages": "^2.0.1",
"husky": "^1.3.1",
"jest-puppeteer": "^4.1.0",
"jsdom-global": "^3.0.2",
"less": "^3.9.0",
"lint-staged": "^8.1.1",
"merge-umi-mock-data": "^1.0.4",
"mockjs": "^1.0.1-beta3",
"netlify-lambda": "^1.4.3",
"prettier": "^1.16.4",
"serverless-http": "^1.9.1",
"prettier": "^1.17.0",
"serverless-http": "^2.0.1",
"slash2": "^2.0.0",
"stylelint": "^9.10.1",
"stylelint-config-css-modules": "^1.3.0",
"stylelint-config-prettier": "^5.0.0",
"stylelint-config-rational-order": "^0.0.4",
"stylelint-config-rational-order": "^0.1.0",
"stylelint-config-standard": "^18.2.0",
"stylelint-declaration-block-no-ignored-properties": "^1.1.0",
"stylelint-declaration-block-no-ignored-properties": "^2.1.0",
"stylelint-order": "^2.0.0",
"tslint": "^5.12.1",
"tslint-config-prettier": "^1.17.0",
"tslint-eslint-rules": "^5.4.0",
"tslint-react": "^3.6.0",
"umi-plugin-ga": "^1.1.3",
"umi-plugin-pro-block": "^1.3.0",
"umi-plugin-react": "^1.7.2",
"umi-types": "^0.2.0"
"umi-plugin-ga": "^1.1.3"
},
"optionalDependencies": {
"puppeteer": "^1.12.1"
......
......@@ -7,11 +7,13 @@ const getPrettierFiles = () => {
const configFiles = glob.sync('config/**/*.js*', { ignore: ['**/node_modules/**', 'build/**'] });
const scriptFiles = glob.sync('scripts/**/*.js');
const lessFiles = glob.sync('src/**/*.less*', { ignore: ['**/node_modules/**', 'build/**'] });
const mdFiles = glob.sync('src/**/*.md*', { ignore: ['**/node_modules/**', 'build/**'] });
files = files.concat(jsFiles);
files = files.concat(tsFiles);
files = files.concat(configFiles);
files = files.concat(scriptFiles);
files = files.concat(lessFiles);
files = files.concat(mdFiles);
if (!files.length) {
return;
}
......
......@@ -3,8 +3,6 @@ import { notification, Button, message } from 'antd';
import { formatMessage } from 'umi-plugin-react/locale';
import defaultSettings from '../config/defaultSettings';
(window as any).React = React;
const { pwa } = defaultSettings;
// if pwa is true
if (pwa) {
......@@ -59,4 +57,9 @@ if (pwa) {
onClose: async () => {},
});
});
} else if ('serviceWorker' in navigator) {
// eslint-disable-next-line compat/compat
navigator.serviceWorker.ready.then(registration => {
registration.unregister();
});
}
......@@ -32,7 +32,7 @@ const links = [
const copyright = (
<Fragment>
Copyright <Icon type="copyright" /> 2018 蚂蚁金服体验技术部出品
Copyright <Icon type="copyright" /> 2019 蚂蚁金服体验技术部出品
</Fragment>
);
......
......@@ -14,7 +14,8 @@ let lessNodesAppended: boolean;
const updateTheme: (primaryColor?: string) => void = primaryColor => {
// Don't compile less in production!
if (APP_TYPE !== 'site') {
// preview.pro.ant.design only do not use in your production ; preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。
if (ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION !== 'site') {
return;
}
// Determine if the component is remounted
......
......@@ -13,7 +13,8 @@ export function getAuthority(str?: string): any {
if (typeof authority === 'string') {
return [authority];
}
if (!authority && APP_TYPE === 'site') {
// preview.pro.ant.design only do not use in your production ; preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。
if (!authority && ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION === 'site') {
return ['admin'];
}
return authority;
......
import 'jsdom-global/register';
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment