g6/packages/site/.dumirc.ts

646 lines
18 KiB
TypeScript
Raw Normal View History

2023-02-02 10:31:36 +08:00
import { Extractor, ExtractorConfig } from '@microsoft/api-extractor';
2023-08-24 10:17:57 +08:00
import { defineConfig } from 'dumi';
import fs from 'fs';
import path from 'path';
import { homepage, repository, version } from './package.json';
2023-02-02 10:31:36 +08:00
const getExtraLib = () => {
try {
2023-08-24 10:17:57 +08:00
const extractorConfig = ExtractorConfig.loadFileAndPrepare(path.resolve('./api-extractor.json'));
2023-02-02 10:31:36 +08:00
const extractorResult = Extractor.invoke(extractorConfig, {
localBuild: true,
showVerboseMessages: true,
});
if (extractorResult.succeeded) {
const typeFilePath = extractorResult.extractorConfig.untrimmedFilePath;
if (typeFilePath) {
return `declare module '${name}'{
${fs.readFileSync(typeFilePath, `utf8`)}
}`;
}
}
} catch (e) {
// eslint-disable-next-line no-console
console.warn(`api-extractor warn: ${e.message}`);
}
return '';
};
export default defineConfig({
2023-08-24 10:17:57 +08:00
locales: [
{ id: 'zh', name: '中文' },
{ id: 'en', name: 'English' },
],
title: 'G6', // 网站header标题
2023-02-02 10:31:36 +08:00
favicons: ['https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*7svFR6wkPMoAAAAAAAAAAAAADmJ7AQ/original'], // 网站 favicon
2023-08-24 10:17:57 +08:00
metas: [
// 自定义 meta 标签
2023-02-02 10:31:36 +08:00
{ name: 'keywords', content: 'G6' },
2023-08-24 10:17:57 +08:00
{
name: 'description',
content: 'A collection of charts made with the Grammar of Graphics',
},
2023-02-02 10:31:36 +08:00
],
themeConfig: {
title: 'G6',
description: 'A collection of charts made with the Grammar of Graphics',
2023-08-24 10:17:57 +08:00
defaultLanguage: 'zh', // 默认语言
isAntVSite: false, // 是否是 AntV 的大官网
siteUrl: homepage, // 官网地址
githubUrl: repository.url, // GitHub 地址
showSearch: true, // 是否显示搜索框
showGithubCorner: true, // 是否显示头部的 GitHub icon
showGithubStars: true, // 是否显示 GitHub star 数量
showAntVProductsCard: true, // 是否显示 AntV 产品汇总的卡片
showLanguageSwitcher: true, // 是否显示官网语言切换
showWxQrcode: true, // 是否显示头部菜单的微信公众号
showChartResize: true, // 是否在 demo 页展示图表视图切换
showAPIDoc: true, // 是否在 demo 页展示API文档
2023-02-02 10:31:36 +08:00
themeSwitcher: 'g2',
2023-08-24 10:17:57 +08:00
versions: {
// 历史版本以及切换下拉菜单
[version]: 'https://g6-next.antv.antgroup.com',
2023-08-24 10:17:57 +08:00
'4.x': 'https://g6.antv.antgroup.com',
2023-02-02 10:31:36 +08:00
'3.2.x': 'https://g6-v3-2.antv.vision',
},
2023-08-24 10:17:57 +08:00
docsearchOptions: {
// 头部搜索框配置
2023-02-02 10:31:36 +08:00
apiKey: '9d1cd586972bb492b7b41b13a949ef30',
indexName: 'antv_g6',
},
navs: [
{
2023-08-24 10:17:57 +08:00
slug: 'docs/manual/introduction',
2023-02-02 10:31:36 +08:00
title: {
2023-08-24 10:17:57 +08:00
zh: '教程',
en: 'Manual',
2023-02-02 10:31:36 +08:00
},
},
{
2023-08-24 10:17:57 +08:00
slug: 'examples',
2023-02-02 10:31:36 +08:00
title: {
2023-08-24 10:17:57 +08:00
zh: '示例',
en: 'Examples',
2023-02-02 10:31:36 +08:00
},
},
{
slug: 'docs/apis',
2023-02-02 10:31:36 +08:00
title: {
zh: 'API',
en: 'API',
},
},
{
title: {
2023-08-24 10:17:57 +08:00
zh: '其他资源',
2023-02-02 10:31:36 +08:00
en: 'Online Tools',
},
dropdownItems: [
2023-08-24 10:17:57 +08:00
// {
// url: '/design/overview',
// name: {
// zh: '设计体系',
// en: 'Design System',
// },
// },
2023-02-02 10:31:36 +08:00
{
2023-08-24 10:17:57 +08:00
url: 'https://www.yuque.com/antv/g6-blog',
2023-02-02 10:31:36 +08:00
name: {
2023-08-24 10:17:57 +08:00
zh: '文章博客',
en: 'Blog',
2023-02-02 10:31:36 +08:00
},
},
{
2023-08-24 10:17:57 +08:00
url: 'https://g6.antv.antgroup.com',
2023-02-02 10:31:36 +08:00
name: {
2023-08-24 10:17:57 +08:00
zh: '极速站点',
en: 'Fast Site',
2023-02-02 10:31:36 +08:00
},
},
2023-08-24 10:17:57 +08:00
{
name: {
zh: '在线工具',
en: 'Graphinsight',
},
url: 'https://graphinsight.antgroup.com/#/workspace',
},
],
2023-02-02 10:31:36 +08:00
},
],
2023-08-24 10:17:57 +08:00
ecosystems: [
// 头部的菜单中的「周边生态」
2023-02-02 10:31:36 +08:00
],
docs: [
// ===========Design===================
2023-08-24 10:17:57 +08:00
// {
// slug: 'design/global',
// title: {
// zh: '全局规范',
// en: 'Global',
// },
// order: 3,
// },
// {
// slug: 'design/component',
// title: {
// zh: '组件设计',
// en: 'Component Design',
// },
// order: 4,
// },
2023-02-02 10:31:36 +08:00
{
slug: 'manual/tutorial',
title: {
zh: '入门教程',
en: 'Tutorial',
},
2023-08-31 13:19:03 +08:00
order: 4,
2023-02-02 10:31:36 +08:00
},
// ===========Concepts===================
2023-08-24 10:17:57 +08:00
// {
// slug: 'manual/middle',
// title: {
// zh: '核心概念',
// en: 'Middle',
// },
// order: 4,
// },
2023-02-02 10:31:36 +08:00
2023-08-24 10:17:57 +08:00
// {
// slug: 'manual/middle/elements',
// title: {
// zh: '图元素:节点/边/Combo',
// en: 'Graph Elements',
// },
// order: 2,
// },
2023-02-02 10:31:36 +08:00
2023-08-24 10:17:57 +08:00
// {
// slug: 'manual/middle/elements/shape',
// title: {
// zh: '图形 Shape选读',
// en: 'Shape',
// },
// order: 1,
// },
// {
// slug: 'manual/middle/elements/nodes',
// title: {
// zh: '节点',
// en: 'Node',
// },
// order: 2,
// },
// {
// slug: 'manual/middle/elements/edges',
// title: {
// zh: '边',
// en: 'Edge',
// },
// order: 3,
// },
// {
// slug: 'manual/middle/elements/combos',
// title: {
// zh: 'Combo',
// en: 'Combo',
// },
// order: 4,
// },
2023-02-02 10:31:36 +08:00
2023-08-24 10:17:57 +08:00
// {
// slug: 'manual/middle/elements/nodes/built-in',
// title: {
// zh: '内置节点类型',
// en: 'Built-in Nodes',
// },
// order: 1,
// },
// {
// slug: 'manual/middle/elements/edges/built-in',
// title: {
// zh: '内置边类型',
// en: 'Built-in Edges',
// },
// order: 1,
// },
// {
// slug: 'manual/middle/elements/combos/built-in',
// title: {
// zh: '内置 Combo',
// en: 'Built-in Combos',
// },
// order: 1,
// },
2023-02-02 10:31:36 +08:00
2023-08-24 10:17:57 +08:00
// {
// slug: 'manual/middle/elements/advanced-style',
// title: {
// zh: '高级样式',
// en: 'Advanced Style',
// },
// order: 5,
// },
// {
// slug: 'manual/middle/elements/methods',
// title: {
// zh: '高级操作',
// en: 'Advanced operation',
// },
// order: 6,
// },
2023-02-02 10:31:36 +08:00
2023-08-24 10:17:57 +08:00
// {
// slug: 'manual/middle/layout',
// title: {
// zh: '图布局',
// en: 'Graph Layouts',
// },
// order: 3,
// },
// {
// slug: 'manual/middle/states',
// title: {
// zh: '交互与事件',
// en: 'Behavior & Event',
// },
// order: 4,
// },
// {
// slug: 'manual/middle/plugins',
// title: {
// zh: '分析组件',
// en: 'Component',
// },
// order: 6,
// },
// // ==============================
// {
// slug: 'manual/advanced',
// title: {
// zh: '拓展阅读',
// en: 'Further Reading',
// },
// order: 5,
// },
2023-02-02 10:31:36 +08:00
// ==========API====================
{
slug: 'apis/modules',
2023-02-02 10:31:36 +08:00
title: {
zh: '模块',
en: 'modules',
2023-02-02 10:31:36 +08:00
},
order: 2,
},
{
slug: 'apis/interfaces/graph',
2023-02-02 10:31:36 +08:00
title: {
zh: 'Graph',
en: 'graph',
2023-02-02 10:31:36 +08:00
},
order: 3,
2023-02-02 10:31:36 +08:00
},
{
slug: 'apis/interfaces/item',
title: {
zh: '元素',
en: 'item',
},
order: 4,
},
{
slug: 'apis/interfaces/layout',
title: {
zh: '布局',
en: 'layout',
},
order: 5,
},
{
slug: 'apis/interfaces/behaviors',
title: {
zh: '交互',
en: 'behaviors',
},
order: 6,
},
{
slug: 'apis/interfaces/plugins',
title: {
zh: '插件',
en: 'plugins',
},
order: 7,
},
2023-02-02 10:31:36 +08:00
{
slug: 'apis/classes',
2023-02-02 10:31:36 +08:00
title: {
zh: '类',
en: 'classes',
2023-02-02 10:31:36 +08:00
},
order: 8,
2023-02-02 10:31:36 +08:00
},
// {
// slug: 'apis/interfaces',
// title: {
// zh: 'interfaces',
// en: 'interfaces',
// },
// order: 2,
// },
2023-02-02 10:31:36 +08:00
],
tutorials: [
{
slug: 'manual/about',
title: {
zh: '关于',
en: 'About',
},
order: 1,
},
],
examples: [
2023-08-24 10:17:57 +08:00
// {
// slug: 'case',
// icon: 'gallery',
// title: {
// zh: '场景案例',
// en: 'Case',
// },
// },
2023-08-30 10:59:32 +08:00
{
slug: 'feature',
icon: 'gallery',
title: {
zh: '5.0 新能力',
en: '5.0 Features',
2023-08-30 10:59:32 +08:00
},
},
2023-02-02 10:31:36 +08:00
{
slug: 'net',
icon: 'net',
title: {
2023-08-28 20:39:59 +08:00
zh: '图布局',
en: 'Graph Layout',
2023-02-02 10:31:36 +08:00
},
},
{
slug: 'item',
icon: 'shape',
title: {
zh: '元素',
en: 'Item',
},
},
{
slug: 'interaction',
icon: 'interaction',
title: {
zh: '交互',
en: 'Interaction',
},
},
{
slug: 'scatter',
icon: 'scatter',
title: {
zh: '动画',
en: 'Animation',
},
},
{
slug: 'tool',
icon: 'tool',
title: {
zh: '组件',
en: 'Component',
},
},
{
slug: 'algorithm',
icon: 'gallery',
title: {
zh: '算法',
en: 'Algorithm',
},
},
{
slug: 'performance',
icon: 'net',
title: {
zh: '性能测试',
en: 'Performance',
},
},
],
mdPlayground: {
// 第一个分块的大小
splitPaneMainSize: '62%',
},
playground: {
extraLib: getExtraLib(),
},
announcement: {
zh: '',
en: '',
},
/** 首页技术栈介绍 */
detail: {
title: {
zh: 'G6 图可视化引擎',
en: 'G6 Graph Visualization Engine',
},
description: {
2023-08-28 20:39:59 +08:00
zh: 'G6 是一个简单、易用、完备的图可视化引擎,它在高定制能力的基础上,提供了一系列设计优雅、便于使用的图可视化解决方案。能帮助开发者搭建属于自己的图可视化、图分析、或图编辑器应用。',
en: 'G6 is graph visualization engine with simplicity and convenience. Based on the ability of customize, it provides a set of elegant graph visualization solutions, and helps developers to build up applications for graph visualization, graph analysis, and graph editor.',
2023-02-02 10:31:36 +08:00
},
image: 'https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*j5AqSpmNPdYAAAAAAAAAAABkARQnAQ',
buttons: [
{
text: {
zh: '图表示例',
en: 'Examples',
},
link: `/examples`,
},
{
text: {
zh: '开始使用',
en: 'Getting Started',
},
link: `/manual/introduction`,
type: 'primary',
},
],
},
/** 新闻公告,优先选择配置的,如果没有配置则使用远程的! */
news: [
{
type: {
zh: '推荐',
en: 'News',
},
title: {
zh: '图可视分析与搭建平台 GraphInsight 开源',
en: 'GraphInsight is opened source!',
},
date: '2022.11.22',
link: 'https://www.yuque.com/antv/blog/nyl5bkhdkicgm7v8',
},
{
type: {
zh: '推荐',
en: 'News',
},
title: {
zh: 'G6 5.0 插件机制与引擎性能蓄势待发',
en: 'G6 5.0: extension mechanism and better performance',
},
date: '2022.11.22',
link: 'https://www.yuque.com/antv/blog/fm6setn8p9m9lmh5',
},
],
/** 首页特性介绍 */
features: [
{
icon: 'https://gw.alipayobjects.com/zos/basement_prod/0e03c123-031b-48ed-9050-4ee18c903e94.svg',
title: {
zh: '专注关系,完备基建',
en: 'Dedicated & Complete',
},
description: {
zh: 'G6 是一个专注于关系数据的、完备的图可视化引擎',
2023-08-24 10:17:57 +08:00
en: 'G6 is a complete graph visualization engine, which focuses on relational data',
2023-02-02 10:31:36 +08:00
},
},
{
icon: 'https://gw.alipayobjects.com/zos/basement_prod/42d17359-8607-4227-af93-7509eabb3163.svg',
title: {
zh: '领域深钻,顶尖方案',
en: 'Top Solution',
},
description: {
zh: '扎根实际具体业务场景、结合业界领先成果,沉淀顶尖解决方案',
en: 'According to practical bussiness scenarios, we found out the top solutions',
},
},
{
icon: 'https://gw.alipayobjects.com/zos/basement_prod/acd8d1f3-d256-42b7-8340-27e5d5fde92c.svg',
title: {
zh: '简单易用,扩展灵活',
en: 'Simple & Extendable',
},
description: {
zh: 'Vivid, 精心设计的简单、灵活、高可拓展的接口,满足你的无限创意',
2023-08-24 10:17:57 +08:00
en: 'Well-designed simple, flexible, and extendable intefaces will satisfy your infinite originality',
},
2023-02-02 10:31:36 +08:00
},
],
/** 首页案例 */
cases: [
{
2023-08-28 20:39:59 +08:00
logo: 'https://camo.githubusercontent.com/53886f0e306c9f01c96dee2edca3992830b7cbb769118029a7e5d677deb7e67e/68747470733a2f2f67772e616c697061796f626a656374732e636f6d2f7a6f732f616e7466696e63646e2f306234487a4f63454a592f4772617068696e2e737667',
2023-02-02 10:31:36 +08:00
title: {
zh: 'Graphin 图可视分析组件',
en: 'Graphin: Graph Insight',
},
description: {
zh: 'Graphin 是一款基于 G6 封装的 React 分析组件库,专注在关系可视分析领域,简单高效,开箱即用。',
2023-08-28 20:39:59 +08:00
en: "Graphin stands for Graph Insight. It's a toolkit based on G6 and React, that focuses on relational visual analysis.It's simple, efficient, out of the box.",
2023-02-02 10:31:36 +08:00
},
link: `https://graphin.antv.vision`,
2023-08-24 10:17:57 +08:00
image: 'https://gw.alipayobjects.com/mdn/rms_00edcb/afts/img/A*LKq7Q5wPA0AAAAAAAAAAAAAAARQnAQ',
2023-02-02 10:31:36 +08:00
},
{
logo: 'https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*ch6rTrCxb6YAAAAAAAAAAABkARQnAQ',
title: {
zh: '基于 G6 的动态决策树',
en: 'Interactive Decision Graph Powered by G6',
},
description: {
zh: '基于 G6 实现的动态决策树,辅助用户寻找合适的可视化方式。它展示了 G6 强大的自定义节点和动画的能力。',
2023-08-28 20:39:59 +08:00
en: 'It is an interactive graph for users to find out an appropriate visualization method for their requirements. The demo shows the powerful custom node and animation ability of G6.',
2023-02-02 10:31:36 +08:00
},
link: `/examples/case/graphDemos/#decisionBubbles`,
2023-08-24 10:17:57 +08:00
image: 'https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*10b6R5fkyJ4AAAAAAAAAAABkARQnAQ',
2023-02-02 10:31:36 +08:00
},
{
logo: 'https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*95GYRI0zPx8AAAAAAAAAAABkARQnAQ',
title: {
zh: '基于 G6 的图分析应用',
en: 'Graph Analysis App Powered by G6',
},
description: {
2023-08-28 20:39:59 +08:00
zh: '社交网络分析是图可视化中一个重要的应用场景。随着社交网络越来越流行,人与人、人与组织之间的关系变得越来越复杂,使用传统的分析手段,已经很难满足我们的分析需求。在这种情况下,图分析及图可视化显得愈发重要。',
en: 'Social network is an important scenario in graph visualization. The relationships become complicate with the development of social network. Graph visualization and analysis do well on these complex cases.',
2023-02-02 10:31:36 +08:00
},
link: `/manual/cases/relations`,
2023-08-24 10:17:57 +08:00
image: 'https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*RYFQSZYewokAAAAAAAAAAABkARQnAQ',
2023-02-02 10:31:36 +08:00
},
{
logo: 'https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*IEQFS5VtXX8AAAAAAAAAAABkARQnAQ',
title: {
zh: '基于 G6 的关系时序分析应用',
en: 'Dynamic Relationships Analysis Powered by G6',
},
description: {
2023-08-28 20:39:59 +08:00
zh: '基于 G6 的关系时序分析应用,解决应急过程中流程、影响面、应急预案等一系列应急决策辅助信息和手段,快速止血以减少和避免故障升级。',
en: 'This is an application for dynamic relationships analysis based on G6, which helps people deal with the flow, influence, and find out solutions to avoid losses and faults.',
2023-02-02 10:31:36 +08:00
},
link: `/manual/cases/sequenceTime`,
2023-08-24 10:17:57 +08:00
image: 'https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*m41kSpg17ZkAAAAAAAAAAABkARQnAQ',
2023-02-02 10:31:36 +08:00
},
],
/** 首页合作公司 */
companies: [
2023-08-24 10:17:57 +08:00
{
name: '阿里云',
img: 'https://gw.alipayobjects.com/mdn/rms_2274c3/afts/img/A*V_xMRIvw2iwAAAAAAAAAAABkARQnAQ',
2023-02-02 10:31:36 +08:00
},
2023-08-24 10:17:57 +08:00
{
name: '支付宝',
img: 'https://gw.alipayobjects.com/mdn/rms_2274c3/afts/img/A*lYDrRZvcvD4AAAAAAAAAAABkARQnAQ',
},
{
name: '天猫',
img: 'https://gw.alipayobjects.com/mdn/rms_2274c3/afts/img/A*BQrxRK6oemMAAAAAAAAAAABkARQnAQ',
},
{
name: '淘宝网',
img: 'https://gw.alipayobjects.com/mdn/rms_2274c3/afts/img/A*1l8-TqUr7UcAAAAAAAAAAABkARQnAQ',
},
{
name: '网上银行',
img: 'https://gw.alipayobjects.com/mdn/rms_2274c3/afts/img/A*ZAKFQJ5Bz4MAAAAAAAAAAABkARQnAQ',
},
{
name: '京东',
img: 'https://gw.alipayobjects.com/mdn/rms_2274c3/afts/img/A*yh-HRr3hCpgAAAAAAAAAAABkARQnAQ',
},
{
name: 'yunos',
img: 'https://gw.alipayobjects.com/mdn/rms_2274c3/afts/img/A*_js7SaNosUwAAAAAAAAAAABkARQnAQ',
},
{
name: '菜鸟',
img: 'https://gw.alipayobjects.com/mdn/rms_2274c3/afts/img/A*TgV-RZDODJIAAAAAAAAAAABkARQnAQ',
},
],
// internalSite: {
// url: 'https://g6.antv.antgroup.com',
// name: {
// zh: '极速站点',
// en: 'Fast Site',
// },
// },
2023-02-02 10:31:36 +08:00
},
mfsu: false,
alias: {
2023-08-24 10:17:57 +08:00
'@': __dirname,
2023-02-02 10:31:36 +08:00
},
2023-08-24 10:17:57 +08:00
links: [],
scripts: [],
2023-02-02 10:31:36 +08:00
jsMinifier: 'terser',
});