From eb79e54be24c3de42016aed0385c5c662eaa44fd Mon Sep 17 00:00:00 2001 From: yunji Date: Sun, 1 Dec 2024 17:18:31 +0800 Subject: [PATCH 1/7] fix: ssr render err for map --- .fatherrc.ts | 2 +- package.json | 4 ++++ src/export-map.browser.ts | 5 +++++ src/export-map.ts | 18 ++++++++++++++++++ src/export.ts | 16 ++++++++++------ 5 files changed, 38 insertions(+), 7 deletions(-) create mode 100644 src/export-map.browser.ts create mode 100644 src/export-map.ts diff --git a/.fatherrc.ts b/.fatherrc.ts index e983fef..0b9d896 100644 --- a/.fatherrc.ts +++ b/.fatherrc.ts @@ -17,7 +17,7 @@ export default defineConfig({ }, platform: 'browser', targets: { - chrome: 51, + chrome: 80, }, externals: { lodash: '_', diff --git a/package.json b/package.json index 667b0d6..34a6396 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,10 @@ "typings": "dist/esm/index.d.ts", "jsdelivr": "dist/umd/index.min.js", "unpkg": "dist/umd/index.min.js", + "browser": { + "./src/export-map.ts": "./src/export-map.browser.ts", + "./dist/esm/export-map.js": "./dist/esm/export-map.browser.js" + }, "files": [ "dist", "README.md", diff --git a/src/export-map.browser.ts b/src/export-map.browser.ts new file mode 100644 index 0000000..a105ece --- /dev/null +++ b/src/export-map.browser.ts @@ -0,0 +1,5 @@ +// organize-imports-ignore +export { default as Map, type MapProps } from './Map'; +export { default as PinMap, type PinMapProps } from './PinMap'; +export { default as HeatMap, type HeatMapProps } from './HeatMap'; +export { default as PathMap, type PathMapProps } from './PathMap'; diff --git a/src/export-map.ts b/src/export-map.ts new file mode 100644 index 0000000..8da4e75 --- /dev/null +++ b/src/export-map.ts @@ -0,0 +1,18 @@ +// Map Components mock for use in environments without `document` / `window`, like ssr pre render +import type { FC } from 'react'; + +function MockMap() { + return null; +} + +import { type HeatMapProps } from './HeatMap'; +import { type MapProps } from './Map'; +import { type PathMapProps } from './PathMap'; +import { type PinMapProps } from './PinMap'; + +export const Map: FC = MockMap; +export const HeatMap: FC = MockMap; +export const PathMap: FC = MockMap; +export const PinMap: FC = MockMap; + +export type { HeatMapProps, MapProps, PathMapProps, PinMapProps }; diff --git a/src/export.ts b/src/export.ts index bacf3a0..f137f95 100644 --- a/src/export.ts +++ b/src/export.ts @@ -1,3 +1,4 @@ +// organize-imports-ignore import { ChartType } from './types'; /********** plot chart **********/ @@ -5,7 +6,6 @@ import { default as Area, type AreaProps } from './Area'; import { default as Bar, type BarProps } from './Bar'; import { default as Column, type ColumnProps } from './Column'; import { default as DualAxes, type DualAxesProps } from './DualAxes'; -import { default as HeatMap, type HeatMapProps } from './HeatMap'; import { default as Histogram, type HistogramProps } from './Histogram'; import { default as Line, type LineProps } from './Line'; import { default as Pie, type PieProps } from './Pie'; @@ -20,12 +20,18 @@ import { default as FlowDiagram, type FlowDiagramProps } from './FlowDiagram'; import { default as MindMap, type MindMapProps } from './MindMap'; import { default as NetworkGraph, type NetworkGraphProps } from './NetworkGraph'; export { default as IndentedTree, type IndentedTreeProps } from './IndentedTree'; -export { default as Map, type MapProps } from './Map'; export { default as OrganizationChart, type OrganizationChartProps } from './OrganizationChart'; /********** map chart **********/ -import { default as PathMap, type PathMapProps } from './PathMap'; -import { default as PinMap, type PinMapProps } from './PinMap'; +export { Map, type MapProps } from './export-map'; +import { + PinMap, + type PinMapProps, + HeatMap, + type HeatMapProps, + PathMap, + type PathMapProps, +} from './export-map'; /********** NTV **********/ export { VisText, type VisTextProps } from './Text'; @@ -77,10 +83,8 @@ export const DEFAULT_CHART_COMPONENTS: Record> = { [ChartType.Area]: Area, [ChartType.Scatter]: Scatter, [ChartType.PinMap]: PinMap, - [ChartType.PathMap]: PathMap, [ChartType.HeatMap]: HeatMap, [ChartType.MindMap]: MindMap, [ChartType.FlowDiagram]: FlowDiagram, [ChartType.NetworkGraph]: NetworkGraph, - [ChartType.FishboneDiagram]: FishboneDiagram, }; From 62d0c5644ed7a310de17f0accd71f4ca5d603a83 Mon Sep 17 00:00:00 2001 From: yunji Date: Sun, 1 Dec 2024 17:22:08 +0800 Subject: [PATCH 2/7] chore: changeset --- .changeset/odd-ways-draw.md | 5 +++++ .changeset/pre.json | 8 ++++++++ 2 files changed, 13 insertions(+) create mode 100644 .changeset/odd-ways-draw.md create mode 100644 .changeset/pre.json diff --git a/.changeset/odd-ways-draw.md b/.changeset/odd-ways-draw.md new file mode 100644 index 0000000..ab521cb --- /dev/null +++ b/.changeset/odd-ways-draw.md @@ -0,0 +1,5 @@ +--- +'@antv/gpt-vis': minor +--- + +fix: ssr render err for map diff --git a/.changeset/pre.json b/.changeset/pre.json new file mode 100644 index 0000000..2334acb --- /dev/null +++ b/.changeset/pre.json @@ -0,0 +1,8 @@ +{ + "mode": "pre", + "tag": "beta", + "initialVersions": { + "@antv/gpt-vis": "0.2.2" + }, + "changesets": [] +} From 9839ebb296ec2c9f0be62c8954b257f8528787ba Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 1 Dec 2024 09:49:00 +0000 Subject: [PATCH 3/7] chore: version (beta) (#40) --- .changeset/pre.json | 2 +- CHANGELOG.md | 6 ++++++ package.json | 2 +- src/version.ts | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.changeset/pre.json b/.changeset/pre.json index 2334acb..bdb0b90 100644 --- a/.changeset/pre.json +++ b/.changeset/pre.json @@ -4,5 +4,5 @@ "initialVersions": { "@antv/gpt-vis": "0.2.2" }, - "changesets": [] + "changesets": ["odd-ways-draw"] } diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c12449..8576f80 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # @antv/gpt-vis +## 0.3.0-beta.0 + +### Minor Changes + +- [`62d0c56`](https://github.com/antvis/GPT-Vis/commit/62d0c5644ed7a310de17f0accd71f4ca5d603a83) Thanks [@lvisei](https://github.com/lvisei)! - fix: ssr render err for map + ## 0.2.2 ### Patch Changes diff --git a/package.json b/package.json index 34a6396..a7d02e2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@antv/gpt-vis", - "version": "0.2.2", + "version": "0.3.0-beta.0", "description": "Components for GPTs, generative AI, and LLM projects. Not only UI Components.", "keywords": [ "antv", diff --git a/src/version.ts b/src/version.ts index 5af3ea9..a4e9946 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export default '0.2.2'; +export default '0.3.0-beta.0'; From 8c65c8913f4dd81e7387692a50d830ca563a6cbb Mon Sep 17 00:00:00 2001 From: yunji Date: Sun, 1 Dec 2024 22:51:26 +0800 Subject: [PATCH 4/7] build: add mako --- .dumirc.ts | 10 ++++++++++ .gitignore | 1 + mako.config.json | 9 +++++++++ tsconfig.eslint.json | 10 +--------- tsconfig.json | 1 + 5 files changed, 22 insertions(+), 9 deletions(-) create mode 100644 mako.config.json diff --git a/.dumirc.ts b/.dumirc.ts index 740063a..43af4e7 100644 --- a/.dumirc.ts +++ b/.dumirc.ts @@ -1,4 +1,5 @@ import { defineConfig } from 'dumi'; +import os from 'node:os'; export default defineConfig({ outputPath: 'docs-dist', @@ -13,6 +14,15 @@ Powered by AntV`, github: 'https://github.com/antvis/GPT-Vis', }, }, + // ssr: + // process.env.NODE_ENV === 'production' + // ? { + // builder: 'mako', + // } + // : false, + hash: true, + mfsu: false, + mako: ['Darwin', 'Linux'].includes(os.type()) ? {} : false, externals: { 'mapbox-gl': 'window.mapboxgl', 'maplibre-gl': 'window.maplibregl', diff --git a/.gitignore b/.gitignore index fc3ead2..5075a9a 100644 --- a/.gitignore +++ b/.gitignore @@ -78,4 +78,5 @@ jspm_packages/ # Build dist docs-dist +server .dumi diff --git a/mako.config.json b/mako.config.json new file mode 100644 index 0000000..bf1f748 --- /dev/null +++ b/mako.config.json @@ -0,0 +1,9 @@ +{ + "optimization": { + "skipModules": false, + "concatenateModules": false + }, + "codeSplitting": { + "strategy": "auto" + } +} diff --git a/tsconfig.eslint.json b/tsconfig.eslint.json index 4131afc..9f910a2 100644 --- a/tsconfig.eslint.json +++ b/tsconfig.eslint.json @@ -2,13 +2,5 @@ "extends": "./tsconfig.json", "compilerOptions": { "noEmit": true - }, - // paths intend to lint - "include": [ - "./*.?*.ts", - "src", - // test workspace lint - "__tests__" - ], - "exclude": ["node_modules", "dist"] + } } diff --git a/tsconfig.json b/tsconfig.json index a579fbc..0916abb 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -14,5 +14,6 @@ "@antv/gpt-vis": ["./src/index.ts"] } }, + "include": ["./*.?*.ts", "src", "__tests__"], "exclude": ["node_modules", "dist"] } From edb0d692842d946b1810d8bec1739ea0463b7e08 Mon Sep 17 00:00:00 2001 From: yunji Date: Sun, 1 Dec 2024 22:53:36 +0800 Subject: [PATCH 5/7] chore: changets --- .changeset/pre.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/pre.json b/.changeset/pre.json index bdb0b90..d17ebf5 100644 --- a/.changeset/pre.json +++ b/.changeset/pre.json @@ -1,5 +1,5 @@ { - "mode": "pre", + "mode": "exit", "tag": "beta", "initialVersions": { "@antv/gpt-vis": "0.2.2" From 5b3edb53c14d1cad60385749d8fc5d1ac35adc24 Mon Sep 17 00:00:00 2001 From: yunji Date: Sun, 1 Dec 2024 22:56:09 +0800 Subject: [PATCH 6/7] chore: types for webpack-bundle-analyzer --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index a7d02e2..ac28c4c 100644 --- a/package.json +++ b/package.json @@ -74,6 +74,7 @@ "@types/jest": "^29.5.14", "@types/lodash": "^4.17.13", "@types/react": "^18.0.0", + "@types/webpack-bundle-analyzer": "^4.7.0", "antd": "^5.0.0", "dumi": "^2.4.13", "eslint": "^9.14.0", From 233e30a259fbea8199af172dfe41c16652e8887c Mon Sep 17 00:00:00 2001 From: yunji Date: Sun, 1 Dec 2024 23:01:07 +0800 Subject: [PATCH 7/7] ci: typo --- .github/workflows/preview.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index 743318f..ccfe9d4 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -22,4 +22,4 @@ jobs: surge_token: ${{ secrets.SURGE_TOKEN }} github_token: ${{ secrets.GITHUB_TOKEN }} dist: docs-dist - build: pn docs:build + build: pnpm docs:build