@modern-js/main-doc 2.14.0 → 2.16.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +26 -0
- package/docs/en/about/contributing-guide.mdx +268 -0
- package/docs/en/about/releases.mdx +31 -0
- package/docs/en/about/showcase.mdx +15 -0
- package/docs/en/about/team.mdx +29 -0
- package/docs/en/configure/app/output/disable-svgr.mdx +13 -0
- package/docs/en/guides/basic-features/env-vars.mdx +14 -6
- package/docs/en/guides/troubleshooting/dependencies.mdx +110 -0
- package/docs/zh/about/contributing-guide.mdx +267 -0
- package/docs/zh/about/releases.mdx +31 -0
- package/docs/zh/about/showcase.mdx +15 -0
- package/docs/zh/about/team.mdx +29 -0
- package/docs/zh/configure/app/output/disable-svgr.mdx +13 -0
- package/docs/zh/guides/basic-features/env-vars.mdx +14 -5
- package/docs/zh/guides/troubleshooting/dependencies.mdx +16 -5
- package/modern.config.ts +6 -0
- package/package.json +10 -6
- package/src/.eslintrc.json +3 -0
- package/src/components/RandomMemberList/index.module.scss +35 -0
- package/src/components/RandomMemberList/index.tsx +122 -0
- package/src/components/ShowcaseList/index.module.scss +80 -0
- package/src/components/ShowcaseList/index.tsx +39 -0
- package/src/components/ShowcaseList/useShowcases.ts +73 -0
- package/src/i18n/enUS.ts +8 -0
- package/src/i18n/zhCN.ts +8 -0
- package/docs/zh/community/index.mdx +0 -3
@@ -0,0 +1,267 @@
|
|
1
|
+
---
|
2
|
+
sidebar_position: 3
|
3
|
+
---
|
4
|
+
|
5
|
+
# 贡献指南
|
6
|
+
|
7
|
+
感谢你有兴趣为 Modern.js 做贡献!在开始你的贡献之前,请花几分钟时间阅读以下指南。
|
8
|
+
|
9
|
+
---
|
10
|
+
|
11
|
+
## 设置开发环境
|
12
|
+
|
13
|
+
### Fork 仓库
|
14
|
+
|
15
|
+
[Fork](https://help.github.com/articles/fork-a-repo/) Modern.js 仓库到你的 GitHub 账户,然后 [clone](https://help.github.com/articles/cloning-a-repository/) 到你的本地。
|
16
|
+
|
17
|
+
### 安装 Node.js
|
18
|
+
|
19
|
+
我们推荐使用 Node.js 16 或 18。你可以通过以下命令查看当前使用的 Node.js 版本:
|
20
|
+
|
21
|
+
```bash
|
22
|
+
node -v
|
23
|
+
#v16.18.0
|
24
|
+
```
|
25
|
+
|
26
|
+
如果你当前环境没有安装 Node.js,可以使用 [nvm](https://github.com/nvm-sh/nvm)或者 [fnm](https://github.com/Schniz/fnm) 来安装它。
|
27
|
+
|
28
|
+
以下是如何通过 nvm 安装 Node.js 16 LTS 版本的示例:
|
29
|
+
|
30
|
+
```bash
|
31
|
+
# 安装 Node.js 16 的 LTS 版本
|
32
|
+
nvm install 16 --lts
|
33
|
+
|
34
|
+
# 将新安装的 Node.js 16 设为默认版本
|
35
|
+
nvm alias default 16
|
36
|
+
|
37
|
+
# 切换到新安装的 Node.js 16
|
38
|
+
nvm use 16
|
39
|
+
```
|
40
|
+
|
41
|
+
### 安装 pnpm
|
42
|
+
|
43
|
+
```bash
|
44
|
+
# 使用 corepack 启用 pnpm,仅在 Node.js >= `v14.19.0` 上可用
|
45
|
+
corepack enable
|
46
|
+
```
|
47
|
+
|
48
|
+
### 安装依赖
|
49
|
+
|
50
|
+
```sh
|
51
|
+
pnpm install
|
52
|
+
```
|
53
|
+
|
54
|
+
这将完成:
|
55
|
+
|
56
|
+
- 安装所有依赖项
|
57
|
+
- 在 monorepo 中的 packages 之间创建 symlinks
|
58
|
+
- 运行 `prepare` 脚本来构建所有包(这将需要一些时间,但可以保证所有包都被正确构建)
|
59
|
+
|
60
|
+
> 在此之后,你通常不需要一次性构建所有 packages。如果你正在开发的新功能依赖另一个 package 的最新代码,通常只构建指定的 package 就足够了。
|
61
|
+
|
62
|
+
### 设置 Git 邮箱
|
63
|
+
|
64
|
+
请确保在 `<https://github.com/settings/emails>` 中设置了电子邮件,当你提交 Pull Request 时将需要它。
|
65
|
+
|
66
|
+
检查你的 git 客户端是否已配置邮箱:
|
67
|
+
|
68
|
+
```sh
|
69
|
+
git config --list | grep email
|
70
|
+
```
|
71
|
+
|
72
|
+
全局设置邮箱:
|
73
|
+
|
74
|
+
```sh
|
75
|
+
git config --global user.email "SOME_EMAIL@example.com"
|
76
|
+
```
|
77
|
+
|
78
|
+
针对本地仓库设置邮箱:
|
79
|
+
|
80
|
+
```sh
|
81
|
+
git config user.email "SOME_EMAIL@example.com"
|
82
|
+
```
|
83
|
+
|
84
|
+
---
|
85
|
+
|
86
|
+
## 代码变更和构建
|
87
|
+
|
88
|
+
当你在 fork 的仓库中设置完本地开发环境后,我们就可以开始开发了。
|
89
|
+
|
90
|
+
### 创建一个新分支
|
91
|
+
|
92
|
+
建议在一个新的分支上开发,这样便于后续提交 pull request:
|
93
|
+
|
94
|
+
```sh
|
95
|
+
git checkout -b MY_BRANCH_NAME
|
96
|
+
```
|
97
|
+
|
98
|
+
### 构建 Package
|
99
|
+
|
100
|
+
要构建你要更改的 package,首先打开 package 目录,然后执行 `build` 命令:
|
101
|
+
|
102
|
+
```sh
|
103
|
+
# 将 some-path 替换为你要构建的 package 的路径
|
104
|
+
cd ./packages/some-package
|
105
|
+
pnpm run build
|
106
|
+
```
|
107
|
+
|
108
|
+
此外,你可以使用 `--filter` 选项从仓库根目录来构建指定的 package:
|
109
|
+
|
110
|
+
```sh
|
111
|
+
pnpm run --filter @modern-js/some-package build
|
112
|
+
```
|
113
|
+
|
114
|
+
构建所有包:
|
115
|
+
|
116
|
+
```sh
|
117
|
+
pnpm run prepare
|
118
|
+
```
|
119
|
+
|
120
|
+
如果你需要清理项目中的所有 `node_modules/*`,执行 `reset` 命令:
|
121
|
+
|
122
|
+
```sh
|
123
|
+
pnpm 运行重置
|
124
|
+
```
|
125
|
+
|
126
|
+
---
|
127
|
+
|
128
|
+
## 测试
|
129
|
+
|
130
|
+
### 添加新测试
|
131
|
+
|
132
|
+
如果你进行了 bugfix,或者添加了需要测试的代码,请添加一些测试代码。
|
133
|
+
|
134
|
+
你可以在 `<PACKAGE_DIR>/tests` 文件夹中添加单元测试用例。测试语法基于 [Jest](https://jestjs.io/) 和 [Vitest](https://vitest.dev/)。
|
135
|
+
|
136
|
+
### 运行单元测试
|
137
|
+
|
138
|
+
在提交 pull request 之前,为了确保本次变更没有引入缺陷,你可以通过执行以下命令运行单元测试:
|
139
|
+
|
140
|
+
```sh
|
141
|
+
pnpm run test
|
142
|
+
```
|
143
|
+
|
144
|
+
你也可以使用 `--filter` 选项运行单个包的单元测试:
|
145
|
+
|
146
|
+
```sh
|
147
|
+
pnpm run --filter @modern-js/some-package test
|
148
|
+
```
|
149
|
+
|
150
|
+
### 运行 E2E 测试
|
151
|
+
|
152
|
+
除了单元测试之外,Modern.js 仓库还包括端到端 (E2E) 测试,用于检查整个应用程序的功能。
|
153
|
+
|
154
|
+
你可以执行 `test:e2e` 命令来运行 E2E 测试:
|
155
|
+
|
156
|
+
```sh
|
157
|
+
pnpm run test:e2e
|
158
|
+
```
|
159
|
+
|
160
|
+
如果需要运行指定的测试,可以添加关键字进行过滤:
|
161
|
+
|
162
|
+
```sh
|
163
|
+
# 只运行带有 copy-assets 关键词的测试用例
|
164
|
+
npx jest copy-assets
|
165
|
+
```
|
166
|
+
|
167
|
+
---
|
168
|
+
|
169
|
+
## Linting
|
170
|
+
|
171
|
+
为了帮助保持代码风格的一致性和可读性,我们使用 ESLint 对代码进行校验。
|
172
|
+
|
173
|
+
你可以执行以下命令来运行 Linter:
|
174
|
+
|
175
|
+
```sh
|
176
|
+
pnpm run lint
|
177
|
+
```
|
178
|
+
|
179
|
+
---
|
180
|
+
|
181
|
+
## 文档
|
182
|
+
|
183
|
+
目前 Modern.js 提供英文和中文文档。如果你熟悉中文,请同时更新中英文文档。否则,只需更新英文文档即可。
|
184
|
+
|
185
|
+
你可以在 `packages/document` 文件夹中找到所有文档:
|
186
|
+
|
187
|
+
```sh
|
188
|
+
root
|
189
|
+
└─ packages
|
190
|
+
└─ document
|
191
|
+
├─ builder-doc # Modern.js Builder 文档
|
192
|
+
├─ doc-tools-doc # Modern.js Doc 文档
|
193
|
+
├─ main-doc # Modern.js Framework 文档
|
194
|
+
└─ module-doc # Modern.js Module 文档
|
195
|
+
```
|
196
|
+
|
197
|
+
文档站使用 [Modern.js Doc](https://modernjs.dev/doc-tools) 构建,文档内容可以使用 markdown 或 mdx 语法编写。详细使用方法可以参考 [Modern.js Doc 文档](https://modernjs.dev/doc-tools)。
|
198
|
+
|
199
|
+
Modern.js Doc 的源代码可以在 [这个文件夹](https://github.com/web-infra-dev/modern.js/tree/main/packages/solutions/doc-tools) 中找到。
|
200
|
+
|
201
|
+
---
|
202
|
+
|
203
|
+
## 提交变更
|
204
|
+
|
205
|
+
### 添加 Changeset
|
206
|
+
|
207
|
+
Modern.js 使用 [Changesets](https://github.com/changesets/changesets) 来管理版本和 Changelog。
|
208
|
+
|
209
|
+
如果你修改了一些包,则需要为本次变更添加一个新的变更集。请运行 `change` 命令来选择更改的包并添加 changeset 信息。
|
210
|
+
|
211
|
+
```sh
|
212
|
+
pnpm run change
|
213
|
+
```
|
214
|
+
|
215
|
+
### 提交你的变更
|
216
|
+
|
217
|
+
提交变更到 fork 后的仓库,并 [创建 pull request](https://help.github.com/articles/creating-a-pull-request/)。
|
218
|
+
|
219
|
+
### PR 标题格式
|
220
|
+
|
221
|
+
PR 标题的格式遵循 Conventional Commits。
|
222
|
+
|
223
|
+
一个例子:
|
224
|
+
|
225
|
+
```
|
226
|
+
feat(plugin-swc): 添加 `xxx` 配置项
|
227
|
+
^ ^ ^
|
228
|
+
| | |__ 主题
|
229
|
+
| |_______ 范围
|
230
|
+
|____________ 类型
|
231
|
+
```
|
232
|
+
|
233
|
+
---
|
234
|
+
|
235
|
+
## 发布
|
236
|
+
|
237
|
+
Modern.js 使用 [Changesets](https://github.com/changesets/changesets) 来管理版本和 changelog。
|
238
|
+
|
239
|
+
仓库的维护者可以将所有包的新版本发布到 npm。
|
240
|
+
|
241
|
+
以下是发布的步骤(我们通常使用 CI 进行发布,并避免在本地发布 npm 包):
|
242
|
+
|
243
|
+
1. 拉取 `main` 分支的最新代码。
|
244
|
+
2. 安装依赖:
|
245
|
+
|
246
|
+
```sh
|
247
|
+
pnpm i
|
248
|
+
```
|
249
|
+
|
250
|
+
3. 构建 packages:
|
251
|
+
|
252
|
+
```sh
|
253
|
+
pnpm prepare
|
254
|
+
```
|
255
|
+
|
256
|
+
4. 升级版本:
|
257
|
+
|
258
|
+
```sh
|
259
|
+
pnpm run bump
|
260
|
+
```
|
261
|
+
|
262
|
+
5. 提交版本变更。
|
263
|
+
|
264
|
+
```sh
|
265
|
+
git add .
|
266
|
+
git commit -m "Release va.b.c"
|
267
|
+
```
|
@@ -0,0 +1,31 @@
|
|
1
|
+
---
|
2
|
+
sidebar_position: 2
|
3
|
+
---
|
4
|
+
|
5
|
+
# 版本发布
|
6
|
+
|
7
|
+
## 更新日志
|
8
|
+
|
9
|
+
请访问 [GitHub - Release](https://github.com/web-infra-dev/modern.js/releases) 来了解 Modern.js 每个版本的变更内容。
|
10
|
+
|
11
|
+
## 版本规范
|
12
|
+
|
13
|
+
Modern.js 遵循 [Semantic Versioning](https://semver.org/lang/zh-CN/) 语义化版本规范。
|
14
|
+
|
15
|
+
- 主版本号:包含不兼容的 API 变更。
|
16
|
+
- 次版本号:包含向下兼容的功能性变更。
|
17
|
+
- 修订号:包含向下兼容的问题修正。
|
18
|
+
|
19
|
+
## 发版周期
|
20
|
+
|
21
|
+
- Modern.js 通常在每周四发布一个正式版本。
|
22
|
+
- 当出现较为严重的问题时,我们会在当天发布修订版本。
|
23
|
+
- 我们期望保持 Modern.js v2 的稳定和兼容,目前没有发布下一个 Major 版本的计划。
|
24
|
+
|
25
|
+
## 版本升级
|
26
|
+
|
27
|
+
当你需要升级项目中的 Modern.js 版本时,可以使用 `modern upgrade` 命令,参考 [升级](/guides/get-started/upgrade)。
|
28
|
+
|
29
|
+
```bash
|
30
|
+
npx modern upgrade
|
31
|
+
```
|
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
sidebar_position: 0
|
3
|
+
---
|
4
|
+
|
5
|
+
# 案例展示
|
6
|
+
|
7
|
+
欢迎来到 Modern.js 的案例展示页面!在这里,我们展示了一些基于 Modern.js 所实现的网站。
|
8
|
+
|
9
|
+
如果你使用 Modern.js 构建了一个网站,欢迎你与社区分享它。只需回复 [GitHub 讨论贴](https://github.com/web-infra-dev/modern.js/discussions/3554) 并附上你网站的链接即可。我们会定期收集内容,并将它们展示在当前页面。
|
10
|
+
|
11
|
+
## 案例
|
12
|
+
|
13
|
+
import { ShowcaseList } from '@site/src/components/ShowcaseList';
|
14
|
+
|
15
|
+
<ShowcaseList />
|
@@ -0,0 +1,29 @@
|
|
1
|
+
---
|
2
|
+
sidebar_position: 1
|
3
|
+
---
|
4
|
+
|
5
|
+
# 团队
|
6
|
+
|
7
|
+
Modern.js 的开发由字节跳动的 Modern.js 团队和社区贡献者驱动。
|
8
|
+
|
9
|
+
## 核心团队成员
|
10
|
+
|
11
|
+
以下是 Modern.js 团队的核心成员:
|
12
|
+
|
13
|
+
import { RandomMemberList } from '@site/src/components/RandomMemberList';
|
14
|
+
|
15
|
+
<RandomMemberList />
|
16
|
+
|
17
|
+
## 所有贡献者
|
18
|
+
|
19
|
+
感谢以下伙伴们为 Modern.js 做出的贡献:
|
20
|
+
|
21
|
+
<a
|
22
|
+
href="https://github.com/web-infra-dev/modern.js/graphs/contributors"
|
23
|
+
style={{ display: 'block', marginTop: 24 }}
|
24
|
+
>
|
25
|
+
<img
|
26
|
+
src="https://opencollective.com/modernjs/contributors.svg?width=890&button=false"
|
27
|
+
alt="contributors"
|
28
|
+
/>
|
29
|
+
</a>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
---
|
2
|
+
sidebar_label: disableSvgr
|
3
|
+
---
|
4
|
+
|
5
|
+
# output.disableSvgr
|
6
|
+
|
7
|
+
:::tip
|
8
|
+
该配置由 Modern.js Builder 提供,更多信息可参考 [output.disableSvgr](https://modernjs.dev/builder/api/config-output.html#outputdisablesvgr)。
|
9
|
+
:::
|
10
|
+
|
11
|
+
import Main from '@modern-js/builder-doc/docs/zh/config/output/disableSvgr.md';
|
12
|
+
|
13
|
+
<Main />
|
@@ -31,7 +31,9 @@ MODERN_ENV 的优先级高于 NODE_ENV。
|
|
31
31
|
|
32
32
|
### MODERN_TARGET
|
33
33
|
|
34
|
-
使用 `@modern-js/runtime`
|
34
|
+
使用 `@modern-js/runtime` 时,Modern.js 会自动注入 `MODERN_TARGET`,用于区分 SSR 与 CSR 环境。
|
35
|
+
|
36
|
+
你可以在代码中通过 `process.env.MODERN_TARGET` 来判断环境,并执行相应的逻辑。
|
35
37
|
|
36
38
|
```ts title="App.tsx"
|
37
39
|
function App() {
|
@@ -41,9 +43,10 @@ function App() {
|
|
41
43
|
}
|
42
44
|
```
|
43
45
|
|
44
|
-
|
46
|
+
在开发环境构建完成后,可以看到 SSR 产物和 CSR 产物如下:
|
45
47
|
|
46
48
|
```js title="dist/bundles/main.js"
|
49
|
+
// SSR 产物
|
47
50
|
function App() {
|
48
51
|
if (false) {
|
49
52
|
}
|
@@ -51,6 +54,7 @@ function App() {
|
|
51
54
|
```
|
52
55
|
|
53
56
|
```js title="dist/static/main.js"
|
57
|
+
// CSR 产物
|
54
58
|
function App() {
|
55
59
|
if (true) {
|
56
60
|
console.log(window.innerHeight);
|
@@ -58,12 +62,17 @@ function App() {
|
|
58
62
|
}
|
59
63
|
```
|
60
64
|
|
61
|
-
|
62
|
-
|
65
|
+
这种方式可以针对不同客户端提供不同的产物,保证代码体积最小化;也便于处理不同环境下代码中的一些副作用。
|
66
|
+
|
67
|
+
:::note 死代码移除
|
68
|
+
在生产环境,Terser 和 SWC 等代码压缩工具会分析代码,并将 dead code 移除,从而减少产物体积,这个过程被称为死代码移除(DCE)。
|
69
|
+
|
70
|
+
例如,上述 `if (false)` 语句包含的代码会被移除,而 `if (true)` 包含的代码将被保留。
|
71
|
+
|
72
|
+
如果你未按照上述写法来使用 `process.env.MODERN_TARGET`,代码压缩工具可能会无法分析出 dead code,从而导致产物体积增大。
|
63
73
|
|
64
74
|
:::
|
65
75
|
|
66
|
-
这种方式可以针对不同客户端提供不同的产物,保证代码体积最小化。也能方便处理不同环境下,代码中的一些副作用,
|
67
76
|
|
68
77
|
## 自定义环境变量
|
69
78
|
|
@@ -18,8 +18,8 @@ sidebar_position: 1
|
|
18
18
|
|
19
19
|
```
|
20
20
|
project
|
21
|
-
└─┬ @modern-js/app-tools@
|
22
|
-
└── @modern-js/core@
|
21
|
+
└─┬ @modern-js/app-tools@2.0.0
|
22
|
+
└── @modern-js/core@2.0.0
|
23
23
|
```
|
24
24
|
|
25
25
|
**pnpm**
|
@@ -30,8 +30,8 @@ project
|
|
30
30
|
|
31
31
|
```
|
32
32
|
devDependencies:
|
33
|
-
@modern-js/app-tools
|
34
|
-
└── @modern-js/core
|
33
|
+
@modern-js/app-tools 2.0.0
|
34
|
+
└── @modern-js/core 2.0.0
|
35
35
|
```
|
36
36
|
|
37
37
|
---
|
@@ -88,7 +88,7 @@ Type '{}' is not assignable to type 'ReactNode'.
|
|
88
88
|
}
|
89
89
|
```
|
90
90
|
|
91
|
-
|
91
|
+
关于锁定依赖版本的方法,请参考 [锁定子依赖](/guides/get-started/upgrade.html#锁定子依赖)。
|
92
92
|
|
93
93
|
---
|
94
94
|
|
@@ -97,3 +97,14 @@ Type '{}' is not assignable to type 'ReactNode'.
|
|
97
97
|
出现该警告的原因是,某些三方 npm 包声明的 peer dependencies 版本范围与 Modern.js 中安装的版本范围不一致。
|
98
98
|
|
99
99
|
绝大多数情况下,peer dependencies 的警告不会影响项目运行,不需要额外进行处理,请忽略相关 warning。
|
100
|
+
|
101
|
+
---
|
102
|
+
|
103
|
+
### Modern.js 框架最低支持的 React 版本是多少?
|
104
|
+
|
105
|
+
**Modern.js 框架推荐使用的 React 版本为 >= 18.0.0**,并且不同功能对 React 版本的要求有所不同。
|
106
|
+
|
107
|
+
- 如果你在使用 React 17,那么部分框架功能将无法使用,比如 Steaming SSR,因为它依赖 React 18 提供的新特性。
|
108
|
+
- 如果你仍然在使用 React 16,那么将无法使用 Modern.js 的运行时或服务端能力。你可以考虑使用 Modern.js 的构建模式,即只使用 Modern.js 的构建能力,这种情况是可以继续使用 React 16 的。
|
109
|
+
|
110
|
+
在 Modern.js 未来的 major 版本中,我们会逐步移除对 React 16 和 React 17 的支持。因此,请尽快升级到 React 18 以上版本。
|
package/modern.config.ts
CHANGED
@@ -8,6 +8,7 @@ const rootCategories = [
|
|
8
8
|
'apis/app',
|
9
9
|
'configure/app',
|
10
10
|
'blog',
|
11
|
+
'about',
|
11
12
|
];
|
12
13
|
|
13
14
|
const { version } = require('./package.json');
|
@@ -45,6 +46,11 @@ const getNavbar = (lang: string): NavItem[] => {
|
|
45
46
|
link: getLink('/blog/index'),
|
46
47
|
activeMatch: '/blog/',
|
47
48
|
},
|
49
|
+
{
|
50
|
+
text: getText('关于', 'About'),
|
51
|
+
link: getLink('/about/showcase'),
|
52
|
+
activeMatch: '/about/',
|
53
|
+
},
|
48
54
|
{
|
49
55
|
text: `v${version}`,
|
50
56
|
items: [
|
package/package.json
CHANGED
@@ -3,7 +3,11 @@
|
|
3
3
|
"description": "Documentation of modern.js framework",
|
4
4
|
"homepage": "https://modernjs.dev",
|
5
5
|
"bugs": "https://github.com/web-infra-dev/modern.js/issues",
|
6
|
-
"repository":
|
6
|
+
"repository": {
|
7
|
+
"type": "git",
|
8
|
+
"url": "https://github.com/web-infra-dev/modern.js",
|
9
|
+
"directory": "packages/document/main-doc"
|
10
|
+
},
|
7
11
|
"license": "MIT",
|
8
12
|
"keywords": [
|
9
13
|
"react",
|
@@ -11,13 +15,13 @@
|
|
11
15
|
"modern",
|
12
16
|
"modern.js"
|
13
17
|
],
|
14
|
-
"version": "2.
|
18
|
+
"version": "2.16.0",
|
15
19
|
"publishConfig": {
|
16
20
|
"registry": "https://registry.npmjs.org/",
|
17
21
|
"access": "public"
|
18
22
|
},
|
19
23
|
"peerDependencies": {
|
20
|
-
"@modern-js/builder-doc": "^2.
|
24
|
+
"@modern-js/builder-doc": "^2.16.0"
|
21
25
|
},
|
22
26
|
"devDependencies": {
|
23
27
|
"classnames": "^2",
|
@@ -29,9 +33,9 @@
|
|
29
33
|
"fs-extra": "^10",
|
30
34
|
"@types/node": "^16",
|
31
35
|
"@types/fs-extra": "^9",
|
32
|
-
"@modern-js/builder-doc": "2.
|
33
|
-
"@modern-js/doc-tools": "2.
|
34
|
-
"@modern-js/doc-plugin-auto-sidebar": "2.
|
36
|
+
"@modern-js/builder-doc": "2.16.0",
|
37
|
+
"@modern-js/doc-tools": "2.16.0",
|
38
|
+
"@modern-js/doc-plugin-auto-sidebar": "2.16.0"
|
35
39
|
},
|
36
40
|
"scripts": {
|
37
41
|
"dev": "modern dev",
|
@@ -0,0 +1,35 @@
|
|
1
|
+
.wrapper {
|
2
|
+
display: flex;
|
3
|
+
flex-wrap: wrap;
|
4
|
+
align-items: center;
|
5
|
+
}
|
6
|
+
|
7
|
+
.link {
|
8
|
+
display: flex;
|
9
|
+
align-items: center;
|
10
|
+
justify-content: center;
|
11
|
+
flex-direction: column;
|
12
|
+
width: 20%;
|
13
|
+
max-width: 20%;
|
14
|
+
margin: 24px 0;
|
15
|
+
|
16
|
+
&:hover {
|
17
|
+
.avatar {
|
18
|
+
transform: scale(1.15);
|
19
|
+
}
|
20
|
+
}
|
21
|
+
}
|
22
|
+
|
23
|
+
.avatar {
|
24
|
+
width: 48px;
|
25
|
+
height: 48px;
|
26
|
+
border-radius: 999px;
|
27
|
+
transition: all 0.2s ease-in-out;
|
28
|
+
background-color: #f8f8f8;
|
29
|
+
}
|
30
|
+
|
31
|
+
.name {
|
32
|
+
margin-top: 12px;
|
33
|
+
font-size: 13px;
|
34
|
+
color: rgb(0, 53, 67);
|
35
|
+
}
|
@@ -0,0 +1,122 @@
|
|
1
|
+
import { NoSSR } from '@modern-js/doc-tools/runtime';
|
2
|
+
import style from './index.module.scss';
|
3
|
+
|
4
|
+
interface Member {
|
5
|
+
id: string;
|
6
|
+
avatar: string;
|
7
|
+
// The display name, if not set, use id instead
|
8
|
+
name?: string;
|
9
|
+
}
|
10
|
+
|
11
|
+
const MEMBERS: Member[] = [
|
12
|
+
{
|
13
|
+
id: '10Derozan',
|
14
|
+
avatar: 'https://avatars.githubusercontent.com/u/50694858?s=120&v=4',
|
15
|
+
},
|
16
|
+
{
|
17
|
+
id: '2heal1',
|
18
|
+
avatar: 'https://avatars.githubusercontent.com/u/41466093?s=120&v=4',
|
19
|
+
},
|
20
|
+
{
|
21
|
+
id: '9aoy',
|
22
|
+
avatar: 'https://avatars.githubusercontent.com/u/22373761?s=120&v=4',
|
23
|
+
},
|
24
|
+
{
|
25
|
+
id: 'Asuka109',
|
26
|
+
avatar: 'https://avatars.githubusercontent.com/u/18379948?s=120&v=4',
|
27
|
+
},
|
28
|
+
{
|
29
|
+
id: 'caohuilin',
|
30
|
+
avatar: 'https://avatars.githubusercontent.com/u/12605189?s=120&v=4',
|
31
|
+
},
|
32
|
+
{
|
33
|
+
id: 'chenjiahan',
|
34
|
+
avatar: 'https://avatars.githubusercontent.com/u/7237365?s=120&v=4',
|
35
|
+
},
|
36
|
+
{
|
37
|
+
id: 'clChenLiang',
|
38
|
+
avatar: 'https://avatars.githubusercontent.com/u/13596193?s=120&v=4',
|
39
|
+
},
|
40
|
+
{
|
41
|
+
id: 'danpeen',
|
42
|
+
avatar: 'https://avatars.githubusercontent.com/u/18045417?s=120&v=4',
|
43
|
+
},
|
44
|
+
{
|
45
|
+
id: 'GiveMe-A-Name',
|
46
|
+
avatar: 'https://avatars.githubusercontent.com/u/58852732?s=120&v=4',
|
47
|
+
},
|
48
|
+
{
|
49
|
+
id: 'jkzing',
|
50
|
+
avatar: 'https://avatars.githubusercontent.com/u/2851517?s=120&v=4',
|
51
|
+
},
|
52
|
+
{
|
53
|
+
id: 'JSerFeng',
|
54
|
+
avatar: 'https://avatars.githubusercontent.com/u/57202839?s=120&v=4',
|
55
|
+
},
|
56
|
+
{
|
57
|
+
id: 'KyrieLii',
|
58
|
+
avatar: 'https://avatars.githubusercontent.com/u/16858738?s=120&v=4',
|
59
|
+
},
|
60
|
+
{
|
61
|
+
id: 'nyqykk',
|
62
|
+
avatar: 'https://avatars.githubusercontent.com/u/65393845?s=120&v=4',
|
63
|
+
},
|
64
|
+
{
|
65
|
+
id: 'sanyuan0704',
|
66
|
+
avatar: 'https://avatars.githubusercontent.com/u/39261479?s=120&v=4',
|
67
|
+
},
|
68
|
+
{
|
69
|
+
id: 'targeral',
|
70
|
+
avatar: 'https://avatars.githubusercontent.com/u/9037723?s=120&v=4',
|
71
|
+
},
|
72
|
+
{
|
73
|
+
id: 'xuchaobei',
|
74
|
+
avatar: 'https://avatars.githubusercontent.com/u/5110783?s=120&v=4',
|
75
|
+
},
|
76
|
+
{
|
77
|
+
id: 'xyoscer',
|
78
|
+
avatar: 'https://avatars.githubusercontent.com/u/16360717?s=120&v=4',
|
79
|
+
},
|
80
|
+
{
|
81
|
+
id: 'yimingjfe',
|
82
|
+
avatar: 'https://avatars.githubusercontent.com/u/10381581?s=120&v=4',
|
83
|
+
},
|
84
|
+
{
|
85
|
+
id: 'zhoushaw',
|
86
|
+
avatar: 'https://avatars.githubusercontent.com/u/27547179?s=120&v=4',
|
87
|
+
},
|
88
|
+
{
|
89
|
+
id: 'zllkjc',
|
90
|
+
avatar: 'https://avatars.githubusercontent.com/u/68810266?s=120&v=4',
|
91
|
+
},
|
92
|
+
{
|
93
|
+
id: 'zoolsher',
|
94
|
+
avatar: 'https://avatars.githubusercontent.com/u/9161085?s=120&v=4',
|
95
|
+
},
|
96
|
+
];
|
97
|
+
|
98
|
+
export const RandomMemberList = () => {
|
99
|
+
const randomList = MEMBERS.sort(() => Math.random() - 0.5);
|
100
|
+
|
101
|
+
return (
|
102
|
+
<NoSSR>
|
103
|
+
<div className={style.wrapper}>
|
104
|
+
{randomList.map(item => (
|
105
|
+
<a
|
106
|
+
className={style.link}
|
107
|
+
href={`https://github.com/${item.id}`}
|
108
|
+
target="_blank"
|
109
|
+
rel="nofollow"
|
110
|
+
key={item.id}
|
111
|
+
style={{
|
112
|
+
border: 'none',
|
113
|
+
}}
|
114
|
+
>
|
115
|
+
<img className={style.avatar} src={item.avatar} />
|
116
|
+
<span className={style.name}>{item.name || item.id}</span>
|
117
|
+
</a>
|
118
|
+
))}
|
119
|
+
</div>
|
120
|
+
</NoSSR>
|
121
|
+
);
|
122
|
+
};
|