@rsdoctor/docs 1.3.7 → 1.3.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -52,14 +52,23 @@ export default defineConfig({
|
|
|
52
52
|
Create a `.github/workflows/ci.yml` file in your GitHub repository as shown in the example below. Please note the following points:
|
|
53
53
|
|
|
54
54
|
- `file_path`: Required, path to the Rsdoctor JSON data file.
|
|
55
|
-
- `target_branch`: Optional, target branch name, defaults to 'main'.
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
- `target_branch`: Optional, target branch name, defaults to 'main'. If you want to use a dynamic target branch, i.e., automatically get the target branch of the current pull request instead of a fixed main branch, you can use the following configuration:
|
|
56
|
+
|
|
57
|
+
```yaml
|
|
58
|
+
target_branch: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref || github.event.repository.default_branch }}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
- `on` indicates when the workflow runs, commonly set to `pull_request` and `push`.
|
|
62
|
+
- On `pull_request`, Rsdoctor Action fetches baseline and current and performs bundle diff analysis.
|
|
63
|
+
- On `push` (i.e., after PR merge), it updates and uploads the baseline.
|
|
64
|
+
- Before executing rsdoctor-action, build your project with the Rsdoctor plugin enabled to generate the Rsdoctor JSON data file.
|
|
58
65
|
|
|
59
66
|
```yaml
|
|
60
67
|
name: Bundle Analysis
|
|
61
68
|
|
|
62
|
-
on:
|
|
69
|
+
on:
|
|
70
|
+
pull_request:
|
|
71
|
+
types: [opened, synchronize, reopened, closed]
|
|
63
72
|
|
|
64
73
|
jobs:
|
|
65
74
|
bundle-analysis:
|
|
@@ -100,16 +109,11 @@ jobs:
|
|
|
100
109
|
uses: web-infra-dev/rsdoctor-action@main
|
|
101
110
|
with:
|
|
102
111
|
file_path: 'dist/.rsdoctor/rsdoctor-data.json'
|
|
103
|
-
|
|
112
|
+
# Default 'main'. If you want to use a dynamic target branch, i.e., automatically get the target branch of the current pull request instead of a fixed main branch, you can use the following configuration:
|
|
113
|
+
# ${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref || github.event.repository.default_branch }}
|
|
114
|
+
target_branch: 'main'
|
|
104
115
|
```
|
|
105
116
|
|
|
106
|
-
#### Configuration Options
|
|
107
|
-
|
|
108
|
-
In the above configuration:
|
|
109
|
-
|
|
110
|
-
- `file_path`: Required, path to the Rsdoctor JSON data file.
|
|
111
|
-
- `target_branch`: Optional, target branch name, defaults to 'main'.
|
|
112
|
-
|
|
113
117
|
## View Reports
|
|
114
118
|
|
|
115
119
|
After submitting the above configuration file to your repository, GitHub Actions will automatically run under the specified trigger conditions and generate Rsdoctor analysis reports. You will see bundle size change comparison prompts in GitHub CI, as shown below:
|
|
@@ -52,7 +52,12 @@ export default defineConfig({
|
|
|
52
52
|
在你的 GitHub 仓库中创建 `.github/workflows/ci.yml` 文件,如下示例。需要注意以下几点:
|
|
53
53
|
|
|
54
54
|
- `file_path`:必需,Rsdoctor JSON 数据文件路径。
|
|
55
|
-
- `target_branch`:非必需,目标分支名称,默认是 'main'
|
|
55
|
+
- `target_branch`:非必需,目标分支名称,默认是 'main'。如果想用不固定的目标分支,即自动获取当前 pull request 的 target branch,而不是固定的主分支,则可以使用下方配置:
|
|
56
|
+
|
|
57
|
+
```yaml
|
|
58
|
+
target_branch: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref || github.event.repository.default_branch }}
|
|
59
|
+
```
|
|
60
|
+
|
|
56
61
|
- `on` 是指 workflow 运行的时机,通常设置为 `pull_request` 和 `push`。
|
|
57
62
|
- 在 `pull_request` 时,Rsdoctor Action 会拉取 baseline 和 current,进行 bundle diff 分析。
|
|
58
63
|
- 在 `push`(即 PR 合并)时,会进行 baseline 的更新和上传操作。
|
|
@@ -61,7 +66,9 @@ export default defineConfig({
|
|
|
61
66
|
```yaml
|
|
62
67
|
name: Bundle Analysis
|
|
63
68
|
|
|
64
|
-
on:
|
|
69
|
+
on:
|
|
70
|
+
pull_request:
|
|
71
|
+
types: [opened, synchronize, reopened, closed]
|
|
65
72
|
|
|
66
73
|
jobs:
|
|
67
74
|
bundle-analysis:
|
|
@@ -102,7 +109,9 @@ jobs:
|
|
|
102
109
|
uses: web-infra-dev/rsdoctor-action@main
|
|
103
110
|
with:
|
|
104
111
|
file_path: 'dist/.rsdoctor/rsdoctor-data.json'
|
|
105
|
-
|
|
112
|
+
# 默认 'main',如果想用不固定的目标分支,即自动获取当前 pull request 的 target branch,则可以使用下方配置:
|
|
113
|
+
# ${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref || github.event.repository.default_branch }}
|
|
114
|
+
target_branch: 'main'
|
|
106
115
|
```
|
|
107
116
|
|
|
108
117
|
## 查看报告
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdoctor/docs",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.9",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/web-infra-dev/rsdoctor",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"registry": "https://registry.npmjs.org/"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@rspress/plugin-algolia": "2.0.0-beta.
|
|
22
|
-
"@rspress/plugin-llms": "2.0.0-beta.
|
|
21
|
+
"@rspress/plugin-algolia": "2.0.0-beta.35",
|
|
22
|
+
"@rspress/plugin-llms": "2.0.0-beta.35",
|
|
23
23
|
"@rspress/plugin-rss": "2.0.0-beta.29",
|
|
24
24
|
"@types/node": "^22.8.1",
|
|
25
25
|
"@types/react": "^18.3.26",
|
|
@@ -33,13 +33,13 @@
|
|
|
33
33
|
"rspress-plugin-sitemap": "^1.2.1",
|
|
34
34
|
"typescript": "^5.9.2",
|
|
35
35
|
"@rsbuild/plugin-sass": "^1.4.0",
|
|
36
|
-
"@rsdoctor/types": "1.3.
|
|
36
|
+
"@rsdoctor/types": "1.3.9"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@rstack-dev/doc-ui": "1.11.0",
|
|
40
40
|
"clsx": "^2.1.1",
|
|
41
41
|
"react-markdown": "^9.1.0",
|
|
42
|
-
"@rspress/core": "2.0.0-beta.
|
|
42
|
+
"@rspress/core": "2.0.0-beta.35"
|
|
43
43
|
},
|
|
44
44
|
"scripts": {
|
|
45
45
|
"dev": "cross-env RSPRESS_PERSIST_CACHE=false rspress dev",
|