Skip to content

Commit 84f4aad

Browse files
authored
Merge pull request #285 from HuolalaTech/release-2.0-precheck
Release 2.0 precheck
2 parents 74fbe0b + f8072bc commit 84f4aad

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1427
-670
lines changed

.github/workflows/build_docker.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ name: Create and publish a dev Docker image
1111

1212
on:
1313
push:
14-
branches: ["main"]
14+
branches: ["main", "release-2.0-precheck"]
1515

1616
env:
1717
REGISTRY: ghcr.io
@@ -28,10 +28,10 @@ jobs:
2828
- name: Checkout repository
2929
uses: actions/checkout@v3
3030

31-
- name: Set Node.js 19.x
31+
- name: Set Node.js 20.x
3232
uses: actions/setup-node@v3
3333
with:
34-
node-version: 19.x
34+
node-version: 20.x
3535

3636
- name: Run install
3737
uses: borales/actions-yarn@v4

.github/workflows/build_docker_hub.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ jobs:
2828
- name: Checkout repository
2929
uses: actions/checkout@v3
3030

31-
- name: Set Node.js 19.x
31+
- name: Set Node.js 20.x
3232
uses: actions/setup-node@v3
3333
with:
34-
node-version: 19.x
34+
node-version: 20.x
3535

3636
- name: Run install
3737
uses: borales/actions-yarn@v4

.github/workflows/release.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ jobs:
2424
with:
2525
fetch-depth: 0
2626

27-
- name: Set Node.js 19.x
27+
- name: Set Node.js 20.x
2828
uses: actions/setup-node@v3
2929
env:
3030
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
3131
with:
32-
node-version: 19.x
32+
node-version: 20.x
3333
registry-url: "https://registry.npmjs.org"
3434

3535
- name: Run install

.github/workflows/release_docker.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ jobs:
2727
- name: Checkout repository
2828
uses: actions/checkout@v3
2929

30-
- name: Set Node.js 19.x
30+
- name: Set Node.js 20.x
3131
uses: actions/setup-node@v3
3232
with:
33-
node-version: 19.x
33+
node-version: 20.x
3434

3535
- name: Run install
3636
uses: borales/actions-yarn@v4

.github/workflows/release_docker_hub.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ jobs:
2727
- name: Checkout repository
2828
uses: actions/checkout@v3
2929

30-
- name: Set Node.js 19.x
30+
- name: Set Node.js 20.x
3131
uses: actions/setup-node@v3
3232
with:
33-
node-version: 19.x
33+
node-version: 20.x
3434

3535
- name: Run install
3636
uses: borales/actions-yarn@v4

.github/workflows/static.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
- name: Set up Node
3535
uses: actions/setup-node@v3
3636
with:
37-
node-version: 18
37+
node-version: 20
3838
- name: Install dependencies
3939
run: yarn --frozen-lockfile --ignore-optional
4040
- name: Build

.github/workflows/version_docker.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ jobs:
2828
- name: Checkout repository
2929
uses: actions/checkout@v3
3030

31-
- name: Set Node.js 19.x
31+
- name: Set Node.js 20.x
3232
uses: actions/setup-node@v3
3333
with:
34-
node-version: 19.x
34+
node-version: 20.x
3535

3636
- name: Run install
3737
uses: borales/actions-yarn@v4

.github/workflows/version_docker_hub.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ jobs:
2828
- name: Checkout repository
2929
uses: actions/checkout@v3
3030

31-
- name: Set Node.js 19.x
31+
- name: Set Node.js 20.x
3232
uses: actions/setup-node@v3
3333
with:
34-
node-version: 19.x
34+
node-version: 20.x
3535

3636
- name: Run install
3737
uses: borales/actions-yarn@v4

package.json

+10-6
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,17 @@
4343
"prettier": "^2.5.1",
4444
"remark-gfm": "^4.0.0",
4545
"typescript": "^5.3.3",
46-
"vite": "^4.0.0",
46+
"vite": "^5.4.11",
4747
"vite-plugin-svgr": "^2.4.0",
4848
"yorkie": "^2.0.0"
4949
},
5050
"dependencies": {
5151
"@ant-design/icons": "^4.7.0",
52-
"@huolala-tech/page-spy-browser": "^1.9.14",
53-
"@huolala-tech/page-spy-plugin-data-harbor": "^1.3.12",
54-
"@huolala-tech/page-spy-plugin-rrweb": "^1.2.8",
55-
"@huolala-tech/page-spy-plugin-whole-bundle": "^0.0.10",
56-
"@huolala-tech/page-spy-types": "^1.9.6",
52+
"@huolala-tech/page-spy-browser": "^2.0.0-beta.0",
53+
"@huolala-tech/page-spy-plugin-data-harbor": "^2.0.0-beta.0",
54+
"@huolala-tech/page-spy-plugin-rrweb": "^2.0.0-beta.0",
55+
"@huolala-tech/page-spy-plugin-whole-bundle": "^1.0.0-beta.0",
56+
"@huolala-tech/page-spy-types": "^2.0.0-beta.0",
5757
"@huolala-tech/react-json-view": "^1.2.5",
5858
"@huolala-tech/request": "^1.1.2",
5959
"@mdx-js/mdx": "^3.0.1",
@@ -78,6 +78,7 @@
7878
"react-transition-group": "^4.4.5",
7979
"rehype-parse": "^9.0.0",
8080
"rehype-stringify": "^10.0.0",
81+
"remark-parse": "^11.0.0",
8182
"remark-rehype": "^11.1.0",
8283
"rrweb-player": "^1.0.0-alpha.4",
8384
"shiki": "^0.14.3",
@@ -86,6 +87,9 @@
8687
"unist-util-visit": "^4.1.2",
8788
"zustand": "^4.5.2"
8889
},
90+
"resolutions": {
91+
"rollup": "npm:@rollup/wasm-node"
92+
},
8993
"gitHooks": {
9094
"pre-commit": "lint-staged && node ./scripts/check-i18n.mjs"
9195
},
9.16 KB
Loading
6.83 KB
Loading

src/assets/locales/en.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
"device-id": "Device ID",
1515
"os": "OS",
1616
"browser": "Browser",
17+
"harmony": "HarmonyOS",
18+
"rn": "React Native",
1719
"miniprogram": "Mini Program",
1820
"mpwechat": "WeChat Mini Program",
1921
"mpqq": "QQ Mini Program",
@@ -45,7 +47,8 @@
4547
"copied": "Copied",
4648
"prev": "Previous",
4749
"next": "Next",
48-
"replay-lab": "Replay Lab"
50+
"replay-lab": "Replay Lab",
51+
"toc": "Table of Contents"
4952
},
5053
"error": {
5154
"oops": "Oops! Errors happened~",

src/assets/locales/ja.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
"device-id": "デバイスID",
1515
"os": "オペレーティング システム",
1616
"browser": "ブラウザ",
17+
"harmony": "HarmonyOS",
18+
"rn": "React Native",
1719
"miniprogram": "Mini Program",
1820
"mpwechat": "WeChat Mini Program",
1921
"mpqq": "QQ Mini Program",
@@ -45,7 +47,8 @@
4547
"copied": "コピーされました",
4648
"prev": "前のページ",
4749
"next": "次のページ",
48-
"replay-lab": "リプレイラボ"
50+
"replay-lab": "リプレイラボ",
51+
"toc": "目次"
4952
},
5053
"error": {
5154
"oops": "おっと!エラーが発生しました。",

src/assets/locales/ko.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
"device-id": "장치 ID",
1515
"os": "운영 체제",
1616
"browser": "브라우저",
17+
"harmony": "HarmonyOS",
18+
"rn": "React Native",
1719
"miniprogram": "Mini Program",
1820
"mpwechat": "WeChat Mini Program",
1921
"mpqq": "QQ Mini Program",
@@ -45,7 +47,8 @@
4547
"copied": "복사되었습니다",
4648
"prev": "이전 페이지",
4749
"next": "다음 페이지",
48-
"replay-lab": "리플레이 연구소"
50+
"replay-lab": "리플레이 연구소",
51+
"toc": "목차"
4952
},
5053
"error": {
5154
"oops": "이런! 오류가 발생했습니다.",

src/assets/locales/zh.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
"device-id": "设备 ID",
1515
"os": "系统",
1616
"browser": "浏览器",
17+
"harmony": "鸿蒙",
18+
"rn": "React Native",
1719
"miniprogram": "小程序",
1820
"mpwechat": "微信小程序",
1921
"mpalipay": "支付宝小程序",
@@ -45,7 +47,8 @@
4547
"copied": "已复制",
4648
"prev": "上一页",
4749
"next": "下一页",
48-
"replay-lab": "回放实验室"
50+
"replay-lab": "回放实验室",
51+
"toc": "本页目录"
4952
},
5053
"error": {
5154
"oops": " 哎呀!发生错误~",

src/assets/style/initial.less

-4
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,4 @@ samp {
4040
--header-height: @header-height;
4141
--light-background: @light-bg;
4242
--dark-background: @dark-bg;
43-
44-
--doc-sidebar-width: @doc-sidebar-width;
45-
--doc-page-max-width: @doc-page-max-width;
46-
--doc-side-space: calc(100vw - var(--doc-page-max-width));
4743
}

src/assets/style/variable.less

-2
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,3 @@
3030
@header-height: 64px;
3131
@light-bg: rgba(255, 255, 255, 1);
3232
@dark-bg: rgba(26, 26, 26, 1);
33-
@doc-sidebar-width: 240px;
34-
@doc-page-max-width: 1024px;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import { langType } from '@/utils/useLanguage';
2+
import React from 'react';
3+
import { DocNotFound } from '../../DocNotFound';
4+
5+
const modules = import.meta.glob('@/pages/Docs/md/*.mdx') as Record<
6+
string,
7+
() => Promise<any>
8+
>;
9+
10+
export const LOAD_DOC_EVENT = 'load-doc';
11+
12+
const lazyDocWithNotification =
13+
(doc: string, value: () => Promise<any>) => async () => {
14+
window.dispatchEvent(
15+
new CustomEvent(LOAD_DOC_EVENT, {
16+
detail: {
17+
doc,
18+
loading: true,
19+
},
20+
}),
21+
);
22+
const result = await value();
23+
setTimeout(() => {
24+
window.dispatchEvent(
25+
new CustomEvent(LOAD_DOC_EVENT, {
26+
detail: {
27+
doc,
28+
loading: false,
29+
},
30+
}),
31+
);
32+
}, 100);
33+
return result;
34+
};
35+
36+
const mdComponents = Object.entries(modules).reduce((acc, cur) => {
37+
const [key, value] = cur;
38+
const result = key.match(/md\/(.+)\.(zh|en|ja|ko)\.mdx$/);
39+
if (!result) return acc;
40+
const [, doc, lang] = result;
41+
const lazyDoc = lazyDocWithNotification(doc, value);
42+
if (!acc[doc]) {
43+
acc[doc] = { [lang]: React.lazy(lazyDoc) };
44+
} else {
45+
acc[doc][lang] = React.lazy(lazyDoc);
46+
}
47+
return acc;
48+
}, {} as Record<string, Record<string, React.LazyExoticComponent<any>>>);
49+
50+
export const getDocContent = (doc: string, lang: langType) => {
51+
const docData = mdComponents[doc][lang];
52+
if (!docData) {
53+
return DocNotFound;
54+
}
55+
return docData;
56+
};

0 commit comments

Comments
 (0)