Skip to content

Commit

Permalink
chore: open source website
Browse files Browse the repository at this point in the history
  • Loading branch information
lvisei committed Apr 23, 2024
1 parent f8550d0 commit ccba0dd
Show file tree
Hide file tree
Showing 134 changed files with 12,152 additions and 1 deletion.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"name": "location-insight",
"private": true,
"workspaces": [
"packages/*"
"packages/*",
"website"
],
"scripts": {
"prepare": "husky install",
Expand Down
7 changes: 7 additions & 0 deletions website/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/node_modules
/.env.local
/.umirc.local.ts
/config/config.local.ts
/src/.umi
/src/.umi-production
/dist
3 changes: 3 additions & 0 deletions website/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
.umi
.umi-production
6 changes: 6 additions & 0 deletions website/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
"printWidth": 120,
"singleQuote": true,
"trailingComma": "all",
"proseWrap": "never",
};
3 changes: 3 additions & 0 deletions website/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## L7VP Studio

L7VP Studio is an online geospatial intelligent visual analysis tool. See [Studio](https://locationinsight.antv.antgroup.com) online website.
22 changes: 22 additions & 0 deletions website/config/analytics.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { isProduction } from './env';

export const AnalyticsScripts = isProduction
? [
// Baidu tongji
`var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?c2b82edd7b45aa4aa6f9f31c1155db0f";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
`,
// Google tag (gtag.js)
{ src: 'https://www.googletagmanager.com/gtag/js?id=G-N97Y9S4GLG', async: true },
`window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-N97Y9S4GLG', { app_type: 'l7vp-site' });
`,
]
: [];
32 changes: 32 additions & 0 deletions website/config/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { defineConfig } from 'umi';
import { AnalyticsScripts } from './analytics';
import { getAssetDepExternal } from './external';
import routes from './routes';

export default defineConfig({
title: 'L7VP',
metas: [
{
name: 'keywords',
content:
'L7VP, LocationInsight, L7, Location, 地理, 地图, 地理可视化, 可视化, 可视分析, 地理可视分析, 地图研发, 地图应用,可视分析工具',
},
{
name: 'description',
content: 'L7VP is an geospatial intelligent visualization analysis tools and development platform.',
},
{ 'http-equiv': 'Content-Security-Policy', content: 'upgrade-insecure-requests' },
],
history: {
type: 'hash',
},
routes,
// 增量发布和避免浏览器加载缓存
hash: true,
mfsu: false,
// jsMinifier 默认为 esbuild,esbuild minify 污染全局变量 L7 问题
esbuildMinifyIIFE: true,
...getAssetDepExternal(),
scripts: AnalyticsScripts,
favicons: ['https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*WCVLT5Dp5oYAAAAAAAAAAAAADmJ7AQ/original'],
});
5 changes: 5 additions & 0 deletions website/config/env.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// 是否是生产环境
export const isProduction = process.env.NODE_ENV === 'production';

// 是否是开发环境
export const isDevelopment = process.env.NODE_ENV === 'development';
56 changes: 56 additions & 0 deletions website/config/external.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import { isProduction } from './env';
const { EXTERNAL_RESOURCES } = require('../src/constants/external');

const externals = {
lodash: '_',
'lodash-es': '_',
react: 'React',
'react-dom': 'ReactDOM',
dayjs: 'dayjs',
antd: 'antd',
'@ant-design/icons': 'icons',
'@formily/reactive': ['root Formily', 'Reactive'],
'@formily/shared': ['root Formily', 'Shared'],
'@formily/core': ['root Formily', 'Core'],
'@formily/react': ['root Formily', 'React'],
'@formily/antd-v5': ['root Formily', 'AntdV5'],
'@turf/turf': 'turf',
'@antv/l7': 'L7',
'@antv/l7-draw': 'L7.Draw',
'@antv/larkmap': 'LarkMap',
...(isProduction
? {
'@antv/li-sdk': 'LISDK',
}
: {}),
};

const styles: string[] = [
// /** antd */
...EXTERNAL_RESOURCES.get('antd')!.css!,
/** LarkMap */
...EXTERNAL_RESOURCES.get('LarkMap')!.css!,
];

const scripts = [
/** lodash */
...EXTERNAL_RESOURCES.get('lodash')!.js,
/** react */
...EXTERNAL_RESOURCES.get('react')!.js,
/** antd */
...EXTERNAL_RESOURCES.get('antd')!.js,
/** formily */
...EXTERNAL_RESOURCES.get('formily')!.js,
/** turf */
...EXTERNAL_RESOURCES.get('turf')!.js,
/** L7 library */
...EXTERNAL_RESOURCES.get('L7')!.js,
/** LarkMap */
...EXTERNAL_RESOURCES.get('LarkMap')!.js,
/** LI SDK */
isProduction && EXTERNAL_RESOURCES.get('LISDK')!.js[0],
].filter(Boolean);

const headScripts = scripts;

export const getAssetDepExternal = () => ({ externals, styles, headScripts });
68 changes: 68 additions & 0 deletions website/config/routes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
export default [
{ path: '/*', redirect: '/' },
{
name: 'workspace',
path: '/',
component: '@/layouts/WorkSpace',
routes: [
{
name: '首页',
path: '/',
component: './Home',
disabled: false,
hideInMenu: true,
},
{
name: '项目管理',
path: '/project',
component: './Project',
disabled: false,
},
{
name: '案例市场',
path: '/case',
component: './Case',
disabled: false,
},
],
},
{
name: 'asset-market',
path: '/asset-market',
component: '@/pages/AssetMarket',
},
{
name: 'new-project',
path: '/new',
component: '@/pages/Project/New',
},
{
name: 'map',
path: '/',
component: '@/layouts/Map',
routes: [
{
name: 'builder',
path: '/builder/:id',
component: '@/pages/Builder',
},
{
name: 'app',
path: '/app/:id',
component: '@/pages/Preview/App',
},
{
// 用于预览编辑态示例,进入探索分析态
name: 'template',
path: '/template/:id',
component: '@/pages/Preview/Template',
},
],
},
{
// 文档
name: 'docs',
path: '/docs',
component: '@/pages/Docs',
},
];
74 changes: 74 additions & 0 deletions website/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"name": "@antv/li-website",
"version": "0.0.0",
"description": "location insight website",
"private": true,
"author": "https://github.com/orgs/antvis/people",
"homepage": "https://li.antv.antgroup.com",
"scripts": {
"dev": "umi dev",
"build": "umi build",
"build:analyze": "ANALYZE=1 npm run build",
"postinstall": "umi setup",
"setup": "umi setup",
"start": "npm run dev",
"prettier": "prettier --write \"src/*.{tsx,ts,less,md,json}\""
},
"dependencies": {
"@antv/difi-weave": "^1.2.17",
"@antv/difi-weave-decor-mask": "^1.2.17",
"@antv/difi-weave-summary-row": "^1.2.17",
"@alipay/li-di-assets": "*",
"@ant-design/icons": "^5.0.1",
"@antv/g2plot": "^2.4.31",
"@antv/l7": "^2.17.2",
"@antv/larkmap": "^1.4.11",
"@antv/li-analysis-assets": "^1.0.5",
"@antv/li-core-assets": "^1.0.5",
"@antv/li-editor": "^1.0.5",
"@antv/li-sdk": "^1.0.5",
"@emotion/css": "^11.10.6",
"@emotion/react": "^11.10.6",
"@monaco-editor/react": "^4.5.1",
"@turf/turf": "^6.5.0",
"antd": "^5.5.0",
"classnames": "^2.3.1",
"copy-to-clipboard": "^3.3.3",
"dayjs": "^1.11.7",
"immer": "^10.0.3",
"localforage": "^1.10.0",
"lodash-es": "^4.17.21",
"lz-string": "^1.5.0",
"moment": "^2.29.4",
"react-transition-group": "^4.4.5",
"react-window": "^1.8.9",
"umi": "^4.0.8",
"use-immer": "^0.7.0"
},
"devDependencies": {
"@types/lodash-es": "^4.17.6",
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"cross-env": "^7.0.3",
"typescript": "^4.7.4"
},
"repository": {
"type": "git",
"url": "https://github.com/antvis/L7VP.git"
},
"nx": {
"implicitDependencies": [],
"targets": {
"start": {
"dependsOn": [
"^build"
]
},
"build": {
"outputs": [
"{projectRoot}/dist"
]
}
}
}
}
Binary file added website/src/assets/favicon.ico
Binary file not shown.
Binary file added website/src/assets/images/insight-into-data.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added website/src/assets/images/li-studio.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added website/src/assets/images/li-studio.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added website/src/assets/images/safe-storage.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added website/src/assets/images/visualization-data.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added website/src/assets/images/widget-attr.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
76 changes: 76 additions & 0 deletions website/src/constants/asset.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import * as LIAnalysisAssets from '@antv/li-analysis-assets';
import { version as LIAnalysisAssetsVersion } from '@antv/li-analysis-assets/package.json';
import * as LICoreAssets from '@antv/li-core-assets';
import { version as LICoreAssetsVersion } from '@antv/li-core-assets/package.json';
import * as LISDK from '@antv/li-sdk';
import dayjs from 'dayjs';
import { isDevelopment } from './env';
import type { AssetPackage } from '@/services';

// 开放环境下,将 LI SDK、CoreAssets、AnalysisAssets 挂载到 window 上,与生产环境统一,方便调试
// 生产环境下,会 tree shaking 掉以下代码
if (process.env.NODE_ENV === 'development') {
(window as any).LISDK = LISDK;
(window as any).LIAnalysisAssets = LIAnalysisAssets;
}

// TODO: 先内敛打包,不动态加载内置资产
(window as any).LICoreAssets = LICoreAssets;

export const CORE_ASSETS_ID = '@antv/li-core-assets';
export const ANALYSIS_ASSETS_ID = '@antv/li-analysis-assets';

export const DefaultAssetPackageIds = [CORE_ASSETS_ID, ANALYSIS_ASSETS_ID];

// 平台内置资产包
export const BUILTIN_ASSET_PACKAGES: AssetPackage[] = [
{
assetId: CORE_ASSETS_ID,
creatTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
name: '可视化核心资产',
description: '官方可视化核心资产, 包含 L7VP 核心可视化图层、组件、服务',
package: CORE_ASSETS_ID,
// latest
version: LICoreAssetsVersion,
global: 'LICoreAssets',
// latest 0.x
urls: [
`https://gw.alipayobjects.com/os/lib/antv/li-core-assets/${LICoreAssetsVersion}/dist/umd/li-core-assets.min.js`,
],
//TODO: 考虑到资产包加载速度,不动态加载内置资产
enable: false,
},
{
assetId: ANALYSIS_ASSETS_ID,
creatTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
name: '分析场景资产包',
description: '官方分析场景资产包,用于数据可视分析场景,包含分析图层、组件等',
package: ANALYSIS_ASSETS_ID,
version: LIAnalysisAssetsVersion,
global: 'LIAnalysisAssets',
urls: [
`https://gw.alipayobjects.com/os/lib/antv/li-analysis-assets/${LIAnalysisAssetsVersion}/dist/umd/li-analysis-assets.min.js`,
],
enable: !isDevelopment,
},
{
assetId: '@antv/li-sam-assets',
creatTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
name: '遥感图像分割资产包',
description: 'SAM 遥感图像分割资产包',
package: '@antv/li-sam-assets',
version: '0.1.3',
global: 'SAMAssets',
urls: [`https://npm.elemecdn.com/@antv/[email protected]/dist/li-sam-assets.min.js`],
},
{
assetId: '@lvisei/li-zelda-assets',
creatTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
name: '塞尔达应用资产包',
description: '塞尔达:王国之泪应用资产包',
package: '@lvisei/li-zelda-assets',
version: 'latest',
global: 'LIZeldaAssets',
urls: ['https://npm.elemecdn.com/@lvisei/[email protected]/dist/li-zelda-assets.min.js'],
},
];
Loading

0 comments on commit ccba0dd

Please sign in to comment.