@rsdoctor/docs 1.4.1-beta.0 → 1.5.0
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.
- package/docs/en/config/options/experiments.mdx +1 -1
- package/docs/en/config/options/options.mdx +1 -1
- package/docs/en/config/options/output.mdx +3 -1
- package/docs/en/guide/start/action.mdx +13 -1
- package/docs/zh/config/options/experiments.mdx +1 -1
- package/docs/zh/config/options/options.mdx +1 -1
- package/docs/zh/config/options/output.mdx +3 -1
- package/docs/zh/guide/start/action.mdx +13 -1
- package/package.json +2 -2
|
@@ -8,7 +8,7 @@ import { Badge } from '@theme';
|
|
|
8
8
|
|
|
9
9
|
- **Type:** `boolean`
|
|
10
10
|
- **Optional:** `true`
|
|
11
|
-
- **Default:** `
|
|
11
|
+
- **Default:** `true`
|
|
12
12
|
|
|
13
13
|
By enabling the enableNativePlugin option, the Rspack native plugin moves the time-consuming data processing logic from Rsdoctor to the Rspack build stage, significantly improving build analysis efficiency and greatly reducing Rsdoctor's own analysis time.
|
|
14
14
|
|
|
@@ -194,7 +194,9 @@ NormalModeOptions currently has an empty Object type.
|
|
|
194
194
|
|
|
195
195
|
```js
|
|
196
196
|
new RsdoctorRspackPlugin({
|
|
197
|
-
|
|
197
|
+
output: {
|
|
198
|
+
reportCodeType: { noModuleSource: true } // { noAssetsAndModuleSource: true }
|
|
199
|
+
}
|
|
198
200
|
}),
|
|
199
201
|
```
|
|
200
202
|
|
|
@@ -58,9 +58,12 @@ Create a `.github/workflows/ci.yml` file in your GitHub repository as shown in t
|
|
|
58
58
|
target_branch: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref || github.event.repository.default_branch }}
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
-
- `
|
|
61
|
+
- `dispatch_target_branch`: Optional, used to specify the target branch when manually triggered (workflow_dispatch).
|
|
62
|
+
|
|
63
|
+
- `on` indicates when the workflow runs, commonly set to `pull_request` and `push`, and also supports `workflow_dispatch` for manual triggering.
|
|
62
64
|
- On `pull_request`, Rsdoctor Action fetches baseline and current and performs bundle diff analysis.
|
|
63
65
|
- On `push` (i.e., after PR merge), it updates and uploads the baseline.
|
|
66
|
+
- `workflow_dispatch` allows you to manually trigger the workflow from the GitHub Actions page. This mode combines the behavior of `push` and `pull_request`: it uploads baseline data, and if `dispatch_target_branch` is specified, it also performs baseline comparison analysis.
|
|
64
67
|
- Before executing rsdoctor-action, build your project with the Rsdoctor plugin enabled to generate the Rsdoctor JSON data file.
|
|
65
68
|
|
|
66
69
|
```yaml
|
|
@@ -72,6 +75,13 @@ on:
|
|
|
72
75
|
push:
|
|
73
76
|
branches:
|
|
74
77
|
- main # or your target branch name
|
|
78
|
+
workflow_dispatch: # Optional, allows manual triggering
|
|
79
|
+
inputs:
|
|
80
|
+
target_branch:
|
|
81
|
+
description: 'Target branch to compare against'
|
|
82
|
+
required: false
|
|
83
|
+
default: 'main'
|
|
84
|
+
type: string
|
|
75
85
|
|
|
76
86
|
jobs:
|
|
77
87
|
bundle-analysis:
|
|
@@ -115,6 +125,8 @@ jobs:
|
|
|
115
125
|
# 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:
|
|
116
126
|
# ${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref || github.event.repository.default_branch }}
|
|
117
127
|
target_branch: 'main'
|
|
128
|
+
# Target branch for manual trigger
|
|
129
|
+
dispatch_target_branch: ${{ github.event.inputs.target_branch }}
|
|
118
130
|
```
|
|
119
131
|
|
|
120
132
|
## View Reports
|
|
@@ -191,7 +191,9 @@ NormalModeOptions 目前类型为空 Object。
|
|
|
191
191
|
|
|
192
192
|
```js
|
|
193
193
|
new RsdoctorRspackPlugin({
|
|
194
|
-
|
|
194
|
+
output: {
|
|
195
|
+
reportCodeType: { noModuleSource: true } // { noAssetsAndModuleSource: true }
|
|
196
|
+
}
|
|
195
197
|
}),
|
|
196
198
|
```
|
|
197
199
|
|
|
@@ -58,9 +58,12 @@ export default defineConfig({
|
|
|
58
58
|
target_branch: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref || github.event.repository.default_branch }}
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
-
- `
|
|
61
|
+
- `dispatch_target_branch`:非必需,用于手动触发 (workflow_dispatch) 时指定目标分支。
|
|
62
|
+
|
|
63
|
+
- `on` 是指 workflow 运行的时机,通常设置为 `pull_request` 和 `push`,也支持 `workflow_dispatch` 手动触发。
|
|
62
64
|
- 在 `pull_request` 时,Rsdoctor Action 会拉取 baseline 和 current,进行 bundle diff 分析。
|
|
63
65
|
- 在 `push`(即 PR 合并)时,会进行 baseline 的更新和上传操作。
|
|
66
|
+
- `workflow_dispatch` 允许在 GitHub Actions 页面手动触发工作流。此模式结合了 `push` 和 `pull_request` 的行为:会上传 baseline 数据,同时如果指定了 `dispatch_target_branch`,还会进行 baseline 对比分析。
|
|
64
67
|
- 在执行 rsdoctor-action 之前,需要先将项目进行构建,构建时需要开启 Rsdoctor 插件,并生成 Rsdoctor JSON 数据文件。
|
|
65
68
|
|
|
66
69
|
```yaml
|
|
@@ -72,6 +75,13 @@ on:
|
|
|
72
75
|
push:
|
|
73
76
|
branches:
|
|
74
77
|
- main # 或者其他目标分支
|
|
78
|
+
workflow_dispatch: # 可选,允许手动触发
|
|
79
|
+
inputs:
|
|
80
|
+
target_branch:
|
|
81
|
+
description: '用于对比的目标分支'
|
|
82
|
+
required: false
|
|
83
|
+
default: 'main'
|
|
84
|
+
type: string
|
|
75
85
|
|
|
76
86
|
jobs:
|
|
77
87
|
bundle-analysis:
|
|
@@ -115,6 +125,8 @@ jobs:
|
|
|
115
125
|
# 默认 'main',如果想用不固定的目标分支,即自动获取当前 pull request 的 target branch,则可以使用下方配置:
|
|
116
126
|
# ${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref || github.event.repository.default_branch }}
|
|
117
127
|
target_branch: 'main'
|
|
128
|
+
# 手动触发时使用的目标分支
|
|
129
|
+
dispatch_target_branch: ${{ github.event.inputs.target_branch }}
|
|
118
130
|
```
|
|
119
131
|
|
|
120
132
|
## 查看报告
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdoctor/docs",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/web-infra-dev/rsdoctor",
|
|
@@ -33,7 +33,7 @@
|
|
|
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.
|
|
36
|
+
"@rsdoctor/types": "1.5.0"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@rstack-dev/doc-ui": "1.12.2",
|