Skip to content

Commit f67355f

Browse files
authored
docs: update config overview UI (#435)
1 parent 8535188 commit f67355f

File tree

7 files changed

+209
-68
lines changed

7 files changed

+209
-68
lines changed

website/docs/en/config/index.mdx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
---
2-
overview: true
32
title: Config Overview
43
---
54

65
This page lists all the configurations for Rstest. See ["Configure Rstest"](/guide/basic/configure-rstest) for details.
6+
7+
## Test configurations
8+
9+
import TestOverview from '@components/ConfigOverview';
10+
11+
<TestOverview />
12+
13+
## Build configurations
14+
15+
import { BuildOverview } from '@components/ConfigOverview';
16+
17+
<BuildOverview />
Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,33 @@
11
[
2+
"root",
3+
"name",
24
"include",
35
"exclude",
4-
"includeSource",
5-
"globals",
66
"setupFiles",
7-
"testEnvironment",
7+
"update",
8+
"globals",
9+
"passWithNoTests",
10+
"includeSource",
811
"testNamePattern",
12+
13+
"retry",
914
"testTimeout",
1015
"hookTimeout",
11-
"retry",
12-
"root",
13-
"reporters",
14-
"name",
15-
"isolate",
16+
"maxConcurrency",
17+
1618
"pool",
17-
"passWithNoTests",
18-
"printConsoleTrace",
19-
"onConsoleLog",
20-
"disableConsoleIntercept",
21-
"update",
19+
"isolate",
20+
"testEnvironment",
21+
2222
"clearMocks",
2323
"resetMocks",
2424
"restoreMocks",
2525
"unstubEnvs",
2626
"unstubGlobals",
27-
"maxConcurrency",
28-
"slowTestThreshold"
27+
28+
"reporters",
29+
"slowTestThreshold",
30+
"printConsoleTrace",
31+
"onConsoleLog",
32+
"disableConsoleIntercept"
2933
]

website/docs/zh/config/index.mdx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
---
2-
overview: true
32
title: Config 总览
43
---
54

65
当前页面列出了 Rstest 所有的配置项,请查看 [「配置 Rstest」](/guide/basic/configure-rstest) 了解使用方式。
6+
7+
## Test configurations
8+
9+
import TestOverview from '@components/ConfigOverview';
10+
11+
<TestOverview />
12+
13+
## Build configurations
14+
15+
import { BuildOverview } from '@components/ConfigOverview';
16+
17+
<BuildOverview />
Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,33 @@
11
[
2+
"root",
3+
"name",
24
"include",
35
"exclude",
4-
"includeSource",
5-
"globals",
66
"setupFiles",
7-
"testEnvironment",
7+
"update",
8+
"globals",
9+
"passWithNoTests",
10+
"includeSource",
811
"testNamePattern",
12+
13+
"retry",
914
"testTimeout",
1015
"hookTimeout",
11-
"retry",
12-
"root",
13-
"reporters",
14-
"name",
15-
"isolate",
16+
"maxConcurrency",
17+
1618
"pool",
17-
"passWithNoTests",
18-
"printConsoleTrace",
19-
"onConsoleLog",
20-
"disableConsoleIntercept",
21-
"update",
19+
"isolate",
20+
"testEnvironment",
21+
2222
"clearMocks",
2323
"resetMocks",
2424
"restoreMocks",
2525
"unstubEnvs",
2626
"unstubGlobals",
27-
"maxConcurrency",
28-
"slowTestThreshold"
27+
28+
"reporters",
29+
"slowTestThreshold",
30+
"printConsoleTrace",
31+
"onConsoleLog",
32+
"disableConsoleIntercept"
2933
]

website/theme/components/Overview.module.scss renamed to website/theme/components/ConfigOverview.module.scss

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
.root {
2-
margin-top: 64px;
2+
margin-top: 36px;
33

44
h2 {
55
font-size: 23px;
66
font-weight: 600;
77
line-height: 1;
88
margin: 0 0 20px;
9+
padding-top: 0;
10+
border-top: 0;
911
color: var(--rp-c-text-1);
1012
transition: color 0.5s;
1113
}
1214

13-
a {
15+
ul a {
1416
letter-spacing: -0.01em;
1517
margin-bottom: 1em;
1618
transition: color 0.5s;
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
import { Link } from '@rspress/core/theme';
2+
import styles from './ConfigOverview.module.scss';
3+
4+
export interface GroupItem {
5+
text: string;
6+
link: string;
7+
}
8+
9+
export interface Group {
10+
name: string;
11+
items?: string[];
12+
}
13+
14+
const OVERVIEW_GROUPS: Group[] = [
15+
{
16+
name: 'basic',
17+
items: [
18+
'root',
19+
'name',
20+
'include',
21+
'exclude',
22+
'setupFiles',
23+
'update',
24+
'globals',
25+
'passWithNoTests',
26+
'includeSource',
27+
'testNamePattern',
28+
],
29+
},
30+
{
31+
name: 'runtime',
32+
items: ['retry', 'testTimeout', 'hookTimeout', 'maxConcurrency'],
33+
},
34+
{
35+
name: 'environment',
36+
items: ['pool', 'isolate', 'testEnvironment'],
37+
},
38+
{
39+
name: 'mock',
40+
items: [
41+
'clearMocks',
42+
'resetMocks',
43+
'restoreMocks',
44+
'unstubEnvs',
45+
'unstubGlobals',
46+
],
47+
},
48+
{
49+
name: 'output',
50+
items: [
51+
'reporters',
52+
'slowTestThreshold',
53+
'onConsoleLog',
54+
'printConsoleTrace',
55+
'disableConsoleIntercept',
56+
],
57+
},
58+
];
59+
60+
export default function Overview() {
61+
const Nodes = OVERVIEW_GROUPS.map((group) => (
62+
<div key={group.name} className={styles.overviewGroups}>
63+
<div className={styles.group}>
64+
<h2>{group.name}</h2>
65+
<ul>
66+
{group.items?.map((item) => (
67+
<li key={item}>
68+
<Link href={`/config/test/${item}`}>{item}</Link>
69+
</li>
70+
))}
71+
</ul>
72+
</div>
73+
</div>
74+
));
75+
76+
return <div className={styles.root}>{Nodes}</div>;
77+
}
78+
79+
const BUILD_OVERVIEW_GROUPS: Group[] = [
80+
{
81+
name: 'plugins',
82+
},
83+
{
84+
name: 'source',
85+
items: [
86+
'source.decorators',
87+
'source.define',
88+
'source.exclude',
89+
'source.include',
90+
'source.tsconfigPath',
91+
],
92+
},
93+
{
94+
name: 'output',
95+
items: ['output.externals', 'output.cssModules', 'output.cleanDistPath'],
96+
},
97+
{
98+
name: 'resolve',
99+
items: [
100+
'resolve.aliasStrategy',
101+
'resolve.alias',
102+
'resolve.dedupe',
103+
'resolve.extensions',
104+
],
105+
},
106+
{
107+
name: 'tools',
108+
items: ['tools.bundlerChain', 'tools.rspack', 'tools.swc'],
109+
},
110+
{
111+
name: 'dev',
112+
items: ['dev.writeToDisk'],
113+
},
114+
{
115+
name: 'performance',
116+
items: ['performance.bundleAnalyze'],
117+
},
118+
];
119+
120+
export function BuildOverview() {
121+
const Nodes = BUILD_OVERVIEW_GROUPS.map((group) => (
122+
<div key={group.name} className={styles.overviewGroups}>
123+
<div className={styles.group}>
124+
<h2>
125+
<Link href={`/config/build/${group.name}`}> {group.name}</Link>
126+
</h2>
127+
<ul>
128+
{group.items?.map((item) => (
129+
<li key={item}>
130+
<Link
131+
href={`/config/build/${group.name}#${item.replace('.', '')}`}
132+
>
133+
{item}
134+
</Link>
135+
</li>
136+
))}
137+
</ul>
138+
</div>
139+
</div>
140+
));
141+
142+
return <div className={styles.root}>{Nodes}</div>;
143+
}

website/theme/components/Overview.tsx

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)