Skip to content

Commit 99ee03a

Browse files
committed
feat: update to umijs 4
1 parent f7656e0 commit 99ee03a

File tree

34 files changed

+159
-156
lines changed

34 files changed

+159
-156
lines changed

SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ currently being supported with security updates.
1313
| pnpm | 7.x |
1414
| antd | 4.x |
1515
| react | 17.x |
16-
| umi | 3.x |
16+
| umi | 4.x |
1717
| father | 2.x |
1818
| webpack | 5.x |
1919

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"react": "17",
5252
"react-dom": "17.x",
5353
"stream-browserify": "^3.0.0",
54-
"umi": "3.x"
54+
"@umijs/max": "4.x"
5555
},
5656
"devDependencies": {
5757
"@changesets/cli": "^2.26.1",

packages/gi-site/.umirc.ts

Lines changed: 59 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import { defineConfig } from 'umi';
12
import GI_SDK from '@antv/gi-sdk/package.json';
23
import GI_THEME_ANTD from '@antv/gi-theme-antd/package.json';
3-
44
import deps_externals from './scripts/deps_externals.json';
55
export const G6_VERSION = '4.8.14';
66
export const GRAPHIN_VERSION = '2.7.16';
@@ -26,22 +26,25 @@ export const externalScripts = deps_externals.map(c => {
2626
return { src: c.url };
2727
});
2828
console.log('externals', externals, BUILD_MODE);
29+
const BASE_CONFIG = {
30+
links: [
31+
{
32+
href: 'https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*7svFR6wkPMoAAAAAAAAAAAAADmJ7AQ/original',
33+
rel: 'shortcut icon',
34+
},
35+
],
36+
};
2937
const EXTRA_CONFIG = isDev
3038
? {
3139
externals: {
3240
react: 'React',
3341
'react-dom': 'ReactDOM',
3442
antd: 'antd',
35-
// '@antv/g6': 'G6',
36-
// '@antv/graphin': 'Graphin',
3743
},
3844
scripts: [
39-
'https://gw.alipayobjects.com/os/lib/react/17.0.2/umd/react.production.min.js',
40-
'https://gw.alipayobjects.com/os/lib/react-dom/17.0.2/umd/react-dom.production.min.js',
45+
'https://gw.alipayobjects.com/os/lib/react/18.2.0/umd/react.production.min.js',
46+
'https://gw.alipayobjects.com/os/lib/react-dom/18.2.0/umd/react-dom.production.min.js',
4147
'https://gw.alipayobjects.com/os/lib/antd/4.24.8/dist/antd.min.js',
42-
// 'https://gw.alipayobjects.com/os/lib/antv/g6/4.8.8/dist/g6.min.js',
43-
// // 'https://gw.alipayobjects.com/os/lib/antv/graphin/2.7.13/dist/graphin.min.js',
44-
// 'http://localhost:5501/graphin.min.js',
4548
],
4649
links: [],
4750
}
@@ -58,31 +61,48 @@ const EXTRA_CONFIG = isDev
5861
};
5962

6063
export default {
61-
// base: '/',
6264
base: '/',
65+
title: 'AntV Insight 让数据栩栩如生',
66+
metas: [
67+
{
68+
name: 'keywords',
69+
content: 'AntV Insight 数据可视化平台 图可视化 地理可视化 分析应用低代码构建',
70+
},
71+
{
72+
name: 'description',
73+
content:
74+
'AntV Insight 是蚂蚁集团 AntV 团队推出的一款数据分析产品,用户可以在线完成视觉映射,分析洞察工作,也可以一键导出SDK,二次开发,集成部署',
75+
},
76+
],
77+
externals: EXTRA_CONFIG.externals,
78+
scripts: EXTRA_CONFIG.scripts,
79+
links: [...BASE_CONFIG.links, ...EXTRA_CONFIG.links],
80+
styles: ['body {background: var(--background-color); color: var(--text-color)}'],
81+
headScripts: [
82+
'https://www.googletagmanager.com/gtag/js?id=G-9Z6Z0NTLFB',
83+
"window.dataLayer = window.dataLayer || [];function gtag() {dataLayer.push(arguments);}gtag('js', new Date());gtag('config', 'G-9Z6Z0NTLFB');",
84+
"window.TracertCmdCache = window.TracertCmdCache || [];var t = window.Tracert || {_isRenderInit: !0,call: function () {window.TracertCmdCache.push(arguments);},},f = ['call','start','config','logPv','info','err','click','expo','pageName','pageState','time','timeEnd','parse','checkExpo','stringify','report','set','before'];for (let i = 0; i < f.length; i++) {(function (fn) {t[fn] = function () {var a = [],l = arguments.length;for (var j = 0; j < l; j++) {a.push(arguments[j]);}a.unshift(fn);window.TracertCmdCache.push(a);};})(f[i]);}window.Tracert = t;window._to = window._to || {};function filterLog(logType) {return function (opts) {return !!window.GI_USER_INFO?.outUserNo;};}window.Tracert.call('before', 'logPv', filterLog('PageMonitor'));window.Tracert.call('before', 'expo', filterLog('expo'));window.Tracert.call('before', 'click', filterLog('click'));",
85+
'https://ur.alipay.com/tracert_a3220.js',
86+
],
6387
publicPath: BUILD_MODE === 'docker' ? '/public/' : '/',
6488
hash: true,
65-
favicon: 'https://gw.alipayobjects.com/zos/bmw-prod/b9a0f537-3768-445d-aa39-ff49de82124a.svg',
89+
favicons: ['https://gw.alipayobjects.com/zos/bmw-prod/b9a0f537-3768-445d-aa39-ff49de82124a.svg'],
6690
history: {
67-
type: 'hash',
91+
type: 'browser',
6892
},
6993
alias: {
7094
'@': './src',
71-
},
72-
nodeModulesTransform: {
73-
type: 'none',
95+
// '@antv/gi-sdk': '../gi-sdk/src',
7496
},
7597
routes: [
76-
{ exact: true, path: '/', redirect: '/home' },
98+
{ exact: true, path: '', redirect: '/home' },
7799
{ exact: true, path: '/workspace/:projectId', component: 'Analysis' },
78100
{ exact: true, path: '/share/:shareId', component: 'Share' },
79101
{ exact: true, path: '/tabs/:type', component: 'Tab' },
80102
{
81103
path: '/',
82-
component: '@/layouts/index',
104+
component: '@/layouts/Main',
83105
routes: [
84-
{ exact: true, path: '/workspace', component: 'Workspace' },
85-
{ exact: true, path: '/services', component: 'ServerCenter' },
86106
{ exact: true, path: '/home', component: 'Home' },
87107
{
88108
path: '/dataset',
@@ -182,25 +202,34 @@ export default {
182202
},
183203
],
184204
},
185-
{ component: '404' },
205+
{ exact: true, path: '/services', component: 'ServerCenter' },
206+
{ exact: true, path: '/workspace', component: 'Workspace' },
186207
],
187208
},
209+
{ component: '404' },
188210
],
189-
...EXTRA_CONFIG,
211+
190212
request: {
191213
dataField: '',
192214
},
193-
// ...EXTRA_CONFIG,
194-
analyze: {
195-
analyzerMode: 'server',
196-
analyzerPort: 8888,
197-
openAnalyzer: true,
198-
// generate stats file while ANALYZE_DUMP exist
199-
generateStatsFile: false,
200-
statsFilename: 'stats.json',
201-
logLevel: 'info',
202-
defaultSizes: 'parsed', // stat // gzip
215+
fastRefresh: true,
216+
mfsu: {
217+
// exclude: ['@antv/*', '@alipay/*'],
218+
// strategy: 'eager',
203219
},
220+
// monorepoRedirect: {
221+
// srcDir: ['src'],
222+
// },
223+
// analyze: {
224+
// analyzerMode: 'server',
225+
// analyzerPort: 8888,
226+
// openAnalyzer: true,
227+
// // generate stats file while ANALYZE_DUMP exist
228+
// generateStatsFile: false,
229+
// statsFilename: 'stats.json',
230+
// logLevel: 'info',
231+
// defaultSizes: 'parsed', // stat // gzip
232+
// },
204233
chainWebpack(memo, { type }) {
205234
memo.module
206235
.rule('mjs$')

packages/gi-site/package.json

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,14 @@
1010
],
1111
"main": "dist/app.js",
1212
"scripts": {
13-
"analyse": "ANALYZE=1 NODE_OPTIONS=--max_old_space_size=4096 umi build",
14-
"build": "node --experimental-json-modules scripts/pre-build.mjs && NODE_OPTIONS=--max_old_space_size=4096 umi build",
15-
"build:docker": "node scripts/link.mjs && cd ../../ && npm run build:all:umd && cd packages/gi-site/ && BUILD_MODE=docker node scripts/pre-build.mjs && node scripts/copy-assets.mjs && BUILD_MODE=docker NODE_OPTIONS=--max_old_space_size=4096 umi build",
13+
"analyse": "ANALYZE=1 NODE_OPTIONS=--max_old_space_size=4096 max build",
14+
"build": "node --experimental-json-modules scripts/pre-build.mjs && NODE_OPTIONS=--max_old_space_size=4096 max build",
15+
"build:docker": "node scripts/link.mjs && cd ../../ && npm run build:all:umd && cd packages/gi-site/ && BUILD_MODE=docker node scripts/pre-build.mjs && node scripts/copy-assets.mjs && BUILD_MODE=docker NODE_OPTIONS=--max_old_space_size=4096 max build",
1616
"deploy": "node ./scripts/deploy.js",
17-
"start": "node --experimental-json-modules scripts/link.mjs && node scripts/pre-build.mjs && cross-env NODE_OPTIONS=--max_old_space_size=4096 cross-env PORT=8000 umi dev",
17+
"start": "node --experimental-json-modules scripts/link.mjs && node scripts/pre-build.mjs && cross-env NODE_OPTIONS=--max_old_space_size=4096 cross-env PORT=8000 max dev",
1818
"link": "node scripts/link.mjs",
1919
"unlink": "cross-env UNLINK=true node scripts/link.mjs",
2020
"eject": "cross-env EJECT=true node scripts/link.mjs"
21-
2221
},
2322
"dependencies": {
2423
"@ant-design/charts": "^1.0.21",
@@ -41,12 +40,14 @@
4140
"@antv/gi-common-components": "workspace:*",
4241
"@antv/gi-sdk": "workspace:*",
4342
"@antv/gi-theme-antd": "workspace:*",
43+
"@antv/s2-react": "^1.41.0",
44+
"@antv/s2": "^1.48.0",
45+
"@antv/util": "^3.3.2",
4446
"@faker-js/faker": "latest",
4547
"@fast-csv/format": "latest",
4648
"@types/classnames": "^2.2.9",
4749
"@types/node": "^7.0.12",
4850
"@types/systemjs": "latest",
49-
"@umijs/preset-react": "^1.8.12",
5051
"ahooks": "^2.10.9",
5152
"classnames": "^2.2.6",
5253
"d3-scale": "^4.0.0",
@@ -62,10 +63,10 @@
6263
"node-fetch": "^3.3.0",
6364
"react-color": "^2.19.3",
6465
"react-monaco-editor": "^0.48.0",
65-
"react-router-dom": "^5.1.1",
6666
"swr": "^1.2.2",
6767
"systemjs": "^6.11.0",
68-
"umi": "^3.5.18",
68+
"@umijs/max": "^4.0.0",
69+
"umi": "^4.0.0",
6970
"umi-request": "^1.3.9",
7071
"use-immer": "^0.7.0",
7172
"xlsx2js": "^1.3.8"

packages/gi-site/scripts/pre-build.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,15 @@ const depsPackage = [
4343
name: 'localforage',
4444
},
4545
{
46-
url: 'https://gw.alipayobjects.com/os/lib/react/17.0.2/umd/react.production.min.js',
47-
version: '17.0.2',
46+
url: 'https://gw.alipayobjects.com/os/lib/react/18.2.0/umd/react.production.min.js',
47+
version: '18.2.0',
4848
global: 'React',
4949
name: 'react',
5050
},
5151
{
52-
url: 'https://gw.alipayobjects.com/os/lib/react-dom/17.0.2/umd/react-dom.production.min.js',
52+
url: 'https://gw.alipayobjects.com/os/lib/react-dom/18.2.0/umd/react-dom.production.min.js',
5353
name: 'react-dom',
54-
version: '17.0.2',
54+
version: '18.2.0',
5555
global: 'ReactDOM',
5656
},
5757
{

packages/gi-site/src/components/DataSource/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import { useImmer } from 'use-immer';
3-
import { getSearchParams } from '../../components/utils';
3+
import { getSearchParams } from '../utils';
44
import Detail from './Detail';
55
import './index.less';
66
import SideList from './List';

packages/gi-site/src/components/Empty/index.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
import { Button, Empty } from 'antd';
22
import * as React from 'react';
3-
import { useHistory } from 'react-router-dom';
3+
import { history } from 'umi';
44
interface EmptyDemoProps {
55
url: string;
66
title: string;
77
}
88

99
const EmptyDemo: React.FunctionComponent<EmptyDemoProps> = props => {
1010
const { url, title } = props;
11-
const history = useHistory();
1211

1312
return (
1413
<Empty

packages/gi-site/src/components/Navbar/Links.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as React from 'react';
2-
import { Link } from 'react-router-dom';
2+
import { Link } from 'umi';
33
interface LinksProps {
44
active: string;
55
}

packages/gi-site/src/components/Navbar/SaveWorkbook.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
import { history } from 'umi';
12
import { SaveOutlined } from '@ant-design/icons';
23
import { Graph } from '@antv/graphin';
34
import { Button, notification, Tooltip } from 'antd';
45
import * as React from 'react';
5-
import { useHistory } from 'react-router-dom';
66
import { useContext } from '../../pages/Analysis/hooks/useContext';
77
import * as ProjectServices from '../../services/project';
88
import type { IProject } from '../../services/typing';
@@ -23,7 +23,6 @@ const getCover = async (graph: Graph) => {
2323

2424
const SaveWorkbook: React.FunctionComponent<SaveWorkbookProps> = props => {
2525
const { workbookId } = props;
26-
const history = useHistory();
2726
const { context, updateContext } = useContext();
2827
const { config, activeAssetsKeys, name, graphRef } = context;
2928
const handleSave = async () => {

packages/gi-site/src/components/Navbar/SiteNav.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as React from 'react';
2-
import { useHistory } from 'react-router-dom';
2+
import { history } from 'umi';
33
import DataModeCard from '../DataModeCard';
44
import Github from './Github';
55
import Links from './Links';
@@ -28,7 +28,6 @@ const styles = {
2828

2929
const SiteNav: React.FunctionComponent<WorkbookBarProps> = props => {
3030
const { active } = props;
31-
const history = useHistory();
3231

3332
return (
3433
<header style={styles.container} className="gi-navbar-container">

0 commit comments

Comments
 (0)