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

merge V4 #4130

Merged
merged 86 commits into from
May 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
27bbd53
use ant-design-pro components replace @/components
yutingzhao1991 Dec 7, 2018
5ba67a5
add block convertor config
yutingzhao1991 Dec 7, 2018
81ee2c1
remove pages
yutingzhao1991 Dec 7, 2018
5ea5e90
comment hardsource
yutingzhao1991 Dec 7, 2018
3cd53e8
add document.ejs
yutingzhao1991 Dec 7, 2018
693075c
update umi-plugin-react
yutingzhao1991 Dec 11, 2018
a36dd31
remove blocks locale
yutingzhao1991 Dec 13, 2018
9342671
fix style import
yutingzhao1991 Dec 13, 2018
1464632
use umi-request
yutingzhao1991 Dec 13, 2018
b62816c
update request comment
yutingzhao1991 Dec 13, 2018
569ad51
remove old block convert config\
yutingzhao1991 Dec 13, 2018
cc7f8f1
feat: simplify antd-pro's boilerplate
sorrycc Dec 19, 2018
22718f2
feat: remove SettingDrawer
sorrycc Dec 19, 2018
fc6ce19
add umi-plugin-pro-block
yutingzhao1991 Dec 20, 2018
7954726
fix menu bug
yutingzhao1991 Dec 21, 2018
23933db
update locales
yutingzhao1991 Dec 21, 2018
b42ef12
clean deps
sorrycc Dec 21, 2018
b069aa6
remove redirect when api error
yutingzhao1991 Dec 21, 2018
3918180
remove useless component
yutingzhao1991 Dec 25, 2018
9e862be
remove useless util and move e2e outside
yutingzhao1991 Dec 25, 2018
5732c5b
fix userLayout
yutingzhao1991 Dec 25, 2018
bac0082
fix e2etest
yutingzhao1991 Dec 25, 2018
17aee94
remove useless deps
yutingzhao1991 Dec 27, 2018
0a9094e
feat: revert some commit for support pwa, SettingDrawer etc... (#3443)
Jan 22, 2019
e0b20cb
feat: merge master to v4 (#3666)
Mar 5, 2019
1abac6a
[v4] transform typescript (#3702)
xiaohuoni Mar 11, 2019
0bc812b
[v4] Strict ts (#3723)
imhele Mar 14, 2019
f046426
[v4] fix type definition (#3851)
imhele Mar 30, 2019
4c91d0b
Merge branch 'master' into v4
chenshuai2144 Apr 2, 2019
3725402
change package
chenshuai2144 Apr 2, 2019
8638499
add netlify-lambda
chenshuai2144 Apr 2, 2019
eec5ee5
rm site config
chenshuai2144 Apr 2, 2019
c248536
remove unuse package
chenshuai2144 Apr 2, 2019
ebd1317
fix dll bug and add typescript typings (#3892)
xiaohuoni Apr 2, 2019
c82c453
Merge branch 'master' into v4
chenshuai2144 Apr 3, 2019
1c8dabc
change pageHeader
chenshuai2144 Apr 3, 2019
aa7e9bd
change to upcales
chenshuai2144 Apr 3, 2019
5748748
remove file
chenshuai2144 Apr 5, 2019
f5b3475
fix type error
chenshuai2144 Apr 5, 2019
d1b6e0f
use pro-layout Components
chenshuai2144 Apr 9, 2019
56a5bcf
use layout components
chenshuai2144 Apr 9, 2019
8045b84
fix types error
chenshuai2144 Apr 9, 2019
4dc7e73
Merge branch 'master' into v4
chenshuai2144 Apr 10, 2019
d61911a
rm ant-design-pro
chenshuai2144 Apr 27, 2019
ec5a5c4
beter code
chenshuai2144 Apr 28, 2019
4a7320e
fix style error
chenshuai2144 Apr 29, 2019
c7bffe5
Merge branch 'master' into v4
chenshuai2144 Apr 29, 2019
313a01f
rm dev script
chenshuai2144 May 6, 2019
4ad0e5a
add a block
chenshuai2144 May 6, 2019
d1d6ec0
Merge branch 'master' into v4
chenshuai2144 May 6, 2019
8fa71a2
use bizcharts beta
chenshuai2144 May 6, 2019
b8e9d67
remove script
chenshuai2144 May 6, 2019
dafdb9c
build don not need functions
chenshuai2144 May 6, 2019
c76d911
sort package.json
chenshuai2144 May 6, 2019
b20e9c9
sort package.json
chenshuai2144 May 6, 2019
0858fb9
[v4] fix e2e test (#3915)
imhele May 7, 2019
6639cbe
remove prettier.js
chenshuai2144 May 7, 2019
7e187a9
remove all code
chenshuai2144 May 14, 2019
c8b910d
set defult router
chenshuai2144 May 15, 2019
db2c01c
less add package
chenshuai2144 May 15, 2019
80ce8fe
Tweak console dev (#4133)
ycjcl868 May 16, 2019
dd59a08
fix code lint error
chenshuai2144 May 18, 2019
3764485
remove default block
chenshuai2144 May 20, 2019
de0cf3d
use new local
chenshuai2144 May 20, 2019
1ee2515
up umi
chenshuai2144 May 21, 2019
99834c3
merge master
chenshuai2144 May 21, 2019
7287c10
update comment (#4236)
zombieJ May 21, 2019
f4ee09f
add ignore (#4245)
zombieJ May 22, 2019
4970575
more ignore (#4248)
zombieJ May 22, 2019
225ecf6
remove unused code api.js (#4251)
Anderson-Liu May 22, 2019
dcce844
rm config file
chenshuai2144 May 22, 2019
e6728b2
remove decorators
chenshuai2144 May 22, 2019
5a30e60
chore: Add copy files (#4260)
zombieJ May 23, 2019
41719aa
V4 fetch block (#4238)
chenshuai2144 May 29, 2019
99ac6a7
Merge branch 'master' into v4
chenshuai2144 May 29, 2019
f2e3525
remove cnpm
chenshuai2144 May 29, 2019
6043d89
use defult mock
chenshuai2144 May 29, 2019
4ce4731
add lambda build
chenshuai2144 May 29, 2019
d241402
add lambda build
chenshuai2144 May 29, 2019
d807da1
close pwa
chenshuai2144 May 29, 2019
2f25e59
set insert code time
chenshuai2144 May 29, 2019
f494190
change @types/qs
chenshuai2144 May 29, 2019
a349ab4
remove mock data
chenshuai2144 May 29, 2019
5282d09
add tag
chenshuai2144 May 29, 2019
63aebe9
fix lint error
chenshuai2144 May 29, 2019
4bb2073
fix code style
chenshuai2144 May 29, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/lambda/
/scripts
/config
/config
4 changes: 3 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ module.exports = {
jasmine: true,
},
globals: {
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,
ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION: true,
},
rules: {
'react/jsx-filename-extension': [1, { extensions: ['.js'] }],
Expand All @@ -35,6 +35,8 @@ module.exports = {
'linebreak-style': 0,
},
settings: {
// support import modules from TypeScript files in JavaScript files
'import/resolver': { node: { extensions: ['.js', '.ts', '.tsx'] } },
polyfills: ['fetch', 'promises', 'url', 'object-assign'],
},
};
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ package-lock.json
.history
*.log
functions/*
lambda/mock/index.js
.temp/**

# umi
Expand Down
8 changes: 5 additions & 3 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{
"singleQuote": true,
"trailingComma": "es5",
"trailingComma": "all",
"printWidth": 100,
"proseWrap": "never",
"overrides": [
{
"files": ".prettierrc",
"options": { "parser": "json" }
"options": {
"parser": "json"
}
}
]
}
}
7 changes: 5 additions & 2 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@
"stylelint-config-rational-order",
"stylelint-config-prettier"
],
"plugins": ["stylelint-order", "stylelint-declaration-block-no-ignored-properties"],
"plugins": [
"stylelint-order",
"stylelint-declaration-block-no-ignored-properties"
],
"rules": {
"no-descending-specificity": null,
"plugin/declaration-block-no-ignored-properties": true
}
}
}
86 changes: 67 additions & 19 deletions config/config.js → config/config.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
// https://umijs.org/config/
import os from 'os';
import pageRoutes from './router.config';
import webpackPlugin from './plugin.config';
import defaultSettings from '../src/defaultSettings';
import slash from 'slash2';

import { IPlugin, IConfig } from 'umi-types';
import defaultSettings from './defaultSettings';
import webpackPlugin from './plugin.config';
const { pwa, primaryColor } = defaultSettings;
// 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 = [
// 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, NODE_ENV } = process.env;
const plugins: IPlugin[] = [
[
'umi-plugin-react',
{
Expand All @@ -18,9 +19,12 @@ const plugins = [
hmr: true,
},
locale: {
enable: true, // default false
default: 'zh-CN', // default zh-CN
baseNavigator: true, // default true, when it is true, will use `navigator.language` overwrite default
// default false
enable: true,
// default zh-CN
default: 'zh-CN',
// default true, when it is true, will use `navigator.language` overwrite default
baseNavigator: true,
},
dynamicImport: {
loadingComponent: './components/PageLoading/index',
Expand All @@ -46,10 +50,18 @@ const plugins = [
: {}),
},
],
];

// 针对 preview.pro.ant.design 的 GA 统计代码
[
'umi-plugin-pro-block',
{
moveMock: false,
moveService: false,
modifyRequest: true,
autoAddMenu: true,
},
],
]; // 针对 preview.pro.ant.design 的 GA 统计代码
// 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',
Expand All @@ -59,6 +71,18 @@ if (ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION === 'site') {
]);
}

const uglifyJSOptions =
NODE_ENV === 'production'
? {
uglifyOptions: {
// remove console.* except console.error
compress: {
drop_console: true,
pure_funcs: ['console.error'],
},
},
}
: {};
export default {
// add for transfer to umi
plugins,
Expand All @@ -72,7 +96,22 @@ export default {
},
devtool: ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION ? 'source-map' : false,
// 路由配置
routes: pageRoutes,
routes: [
{
path: '/',
component: '../layouts/BasicLayout',
Routes: ['src/pages/Authorized'],
authority: ['admin', 'user'],
routes: [
{
path: '/',
name: 'welcome',
icon: 'smile',
component: './Welcome',
},
],
},
],
// Theme for antd
// https://ant.design/docs/react/customize-theme-cn
theme: {
Expand All @@ -92,29 +131,38 @@ export default {
disableRedirectHoist: true,
cssLoaderOptions: {
modules: true,
getLocalIdent: (context, localIdentName, localName) => {
getLocalIdent: (
context: {
resourcePath: string;
},
localIdentName: string,
localName: string,
) => {
if (
context.resourcePath.includes('node_modules') ||
context.resourcePath.includes('ant.design.pro.less') ||
context.resourcePath.includes('global.less')
) {
return localName;
}

const match = context.resourcePath.match(/src(.*)/);

if (match && match[1]) {
const antdProPath = match[1].replace('.less', '');
const arr = slash(antdProPath)
.split('/')
.map(a => a.replace(/([A-Z])/g, '-$1'))
.map(a => a.toLowerCase());
.map((a: string) => a.replace(/([A-Z])/g, '-$1'))
.map((a: string) => a.toLowerCase());
return `antd-pro${arr.join('-')}-${localName}`.replace(/--/g, '-');
}

return localName;
},
},
manifest: {
basePath: '/',
},

uglifyJSOptions,
chainWebpack: webpackPlugin,
};
} as IConfig;
60 changes: 60 additions & 0 deletions config/defaultSettings.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import { MenuTheme } from 'antd/es/menu';

export type ContentWidth = 'Fluid' | 'Fixed';

export interface DefaultSettings {
/**
* theme for nav menu
*/
navTheme: MenuTheme;
/**
* primary color of ant design
*/
primaryColor: string;
/**
* nav menu position: `sidemenu` or `topmenu`
*/
layout: 'sidemenu' | 'topmenu';
/**
* layout of content: `Fluid` or `Fixed`, only works when layout is topmenu
*/
contentWidth: ContentWidth;
/**
* sticky header
*/
fixedHeader: boolean;
/**
* auto hide header
*/
autoHideHeader: boolean;
/**
* sticky siderbar
*/
fixSiderbar: boolean;
menu: { locale: boolean };
title: string;
pwa: boolean;
// Your custom iconfont Symbol script Url
// eg://at.alicdn.com/t/font_1039637_btcrd5co4w.js
// 注意:如果需要图标多色,Iconfont 图标项目里要进行批量去色处理
// Usage: https://github.com/ant-design/ant-design-pro/pull/3517
iconfontUrl: string;
colorWeak: boolean;
}

export default {
navTheme: 'dark',
primaryColor: '#1890FF',
layout: 'sidemenu',
contentWidth: 'Fluid',
fixedHeader: false,
autoHideHeader: false,
fixSiderbar: false,
colorWeak: false,
menu: {
locale: true,
},
title: 'Ant Design Pro',
pwa: false,
iconfontUrl: '',
} as DefaultSettings;
21 changes: 11 additions & 10 deletions config/plugin.config.js → config/plugin.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import MergeLessPlugin from 'antd-pro-merge-less';
import AntDesignThemePlugin from 'antd-theme-webpack-plugin';
import path from 'path';

function getModulePackageName(module) {
function getModulePackageName(module: { context: string }) {
if (!module.context) return null;

const nodeModulesPath = path.join(__dirname, '../node_modules/');
Expand All @@ -14,16 +14,16 @@ function getModulePackageName(module) {

const moduleRelativePath = module.context.substring(nodeModulesPath.length);
const [moduleDirName] = moduleRelativePath.split(path.sep);
let packageName = moduleDirName;
let packageName: string | null = moduleDirName;
// handle tree shaking
if (packageName.match('^_')) {
if (packageName && packageName.match('^_')) {
// eslint-disable-next-line prefer-destructuring
packageName = packageName.match(/^_(@?[^@]+)/)[1];
packageName = packageName.match(/^_(@?[^@]+)/)![1];
}
return packageName;
}

export default config => {
export default (config: any) => {
// 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' ||
Expand Down Expand Up @@ -62,18 +62,19 @@ export default config => {
minSize: 0,
cacheGroups: {
vendors: {
test: module => {
test: (module: { context: string }) => {
const packageName = getModulePackageName(module);
if (packageName) {
return ['bizcharts', '@antv_data-set'].indexOf(packageName) >= 0;
}
return false;
},
name(module) {
name(module: { context: string }) {
const packageName = getModulePackageName(module);

if (['bizcharts', '@antv_data-set'].indexOf(packageName) >= 0) {
return 'viz'; // visualization package
if (packageName) {
if (['bizcharts', '@antv_data-set'].indexOf(packageName) >= 0) {
return 'viz'; // visualization package
}
}
return 'misc';
},
Expand Down
Loading