Skip to content

Commit 66a69b5

Browse files
committed
refactor(core): move report template out of core js output
1 parent 30405dd commit 66a69b5

42 files changed

Lines changed: 852 additions & 486 deletions

Some content is hidden

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

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,8 @@ jobs:
5656
- name: Build project
5757
run: pnpm run build
5858

59+
- name: Verify report template asset
60+
run: pnpm run verify:report-template
61+
5962
- name: Run tests
6063
run: pnpm run test

.github/workflows/studio-headless-linux.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,6 @@ jobs:
9191
- name: Build Studio
9292
run: npx nx run-many --target=build --projects=studio,@midscene/report
9393

94-
- name: Re-inject report template into @midscene/core dist
95-
run: node apps/report/scripts/inject-report-template.mjs
96-
9794
- name: Run Studio startup smoke test
9895
run: xvfb-run -a --server-args="-screen 0 1920x1080x24" pnpm --dir apps/studio run test:smoke
9996
env:

CONTRIBUTING.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,13 @@ cd apps/playground && pnpm run dev
152152
cd apps/chrome-extension && pnpm run dev
153153
```
154154

155-
### `REPLACE_ME_WITH_REPORT_HTML` error in the report file
155+
### Missing report template errors
156156

157157
`apps/report` is not standalone at runtime. Its built `index.html` template is
158-
injected back into `packages/core/dist` during build. If report UI changes do
159-
not show up, or you see `REPLACE_ME_WITH_REPORT_HTML` in the report file, the
160-
template injection is usually stale. Rebuild the entire workspace without Nx
161-
cache to fix it:
158+
synced into `packages/core/dist/report-template/index.html` during build. If
159+
report UI changes do not show up, or the runtime says the Midscene report
160+
template is missing, rebuild the entire workspace without Nx cache to refresh
161+
the synced template:
162162

163163
```sh
164164
# Rebuild the entire project without cache

apps/android-playground/package.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,19 @@
2525
"@types/react-dom": "^18.3.1",
2626
"less": "^4.2.0",
2727
"typescript": "^5.8.3"
28+
},
29+
"nx": {
30+
"targets": {
31+
"build": {
32+
"dependsOn": [
33+
"^build",
34+
{
35+
"projects": ["@midscene/report"],
36+
"target": "build",
37+
"params": "ignore"
38+
}
39+
]
40+
}
41+
}
2842
}
2943
}

apps/android-playground/rsbuild.config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { pluginWorkspaceDev } from 'rsbuild-plugin-workspace-dev';
99
import { version as playgroundVersion } from '../../packages/playground/package.json';
1010
import {
1111
commonIgnoreWarnings,
12+
createCoreReportTemplateReplacementPlugin,
1213
createPlaygroundCopyPlugin,
1314
} from '../../scripts/rsbuild-utils.ts';
1415

@@ -63,6 +64,9 @@ export default defineConfig({
6364
pluginNodePolyfill(),
6465
pluginLess(),
6566
pluginSvgr(),
67+
createCoreReportTemplateReplacementPlugin({
68+
appDir: __dirname,
69+
}),
6670
createPlaygroundCopyPlugin(
6771
path.join(__dirname, 'dist'),
6872
path.join(__dirname, '../../packages/android-playground/static'),

apps/chrome-extension/package.json

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
"@midscene/core": "workspace:*",
1717
"@midscene/playground": "workspace:*",
1818
"@midscene/recorder": "workspace:*",
19-
"@midscene/report": "workspace:*",
2019
"@midscene/shared": "workspace:*",
2120
"@midscene/visualizer": "workspace:*",
2221
"@midscene/web": "workspace:*",
@@ -53,5 +52,19 @@
5352
"typescript": "^5.8.3",
5453
"vitest": "3.0.5",
5554
"web-ext": "9.0.0"
55+
},
56+
"nx": {
57+
"targets": {
58+
"build": {
59+
"dependsOn": [
60+
"^build",
61+
{
62+
"projects": ["@midscene/report"],
63+
"target": "build",
64+
"params": "ignore"
65+
}
66+
]
67+
}
68+
}
5669
}
5770
}

apps/chrome-extension/rsbuild.config.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ import { pluginSvgr } from '@rsbuild/plugin-svgr';
77
import { pluginTypeCheck } from '@rsbuild/plugin-type-check';
88
import { pluginWorkspaceDev } from 'rsbuild-plugin-workspace-dev';
99
import { version } from '../../packages/visualizer/package.json';
10-
import { commonIgnoreWarnings } from '../../scripts/rsbuild-utils.ts';
10+
import {
11+
commonIgnoreWarnings,
12+
createCoreReportTemplateReplacementPlugin,
13+
} from '../../scripts/rsbuild-utils.ts';
1114

1215
export default defineConfig({
1316
tools: {
@@ -119,6 +122,9 @@ export default defineConfig({
119122
pluginNodePolyfill(),
120123
pluginLess(),
121124
pluginSvgr(),
125+
createCoreReportTemplateReplacementPlugin({
126+
appDir: __dirname,
127+
}),
122128
pluginTypeCheck(),
123129
pluginWorkspaceDev({
124130
projects: {

apps/computer-playground/package.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,19 @@
2525
"@types/react-dom": "^18.3.1",
2626
"less": "^4.2.0",
2727
"typescript": "^5.8.3"
28+
},
29+
"nx": {
30+
"targets": {
31+
"build": {
32+
"dependsOn": [
33+
"^build",
34+
{
35+
"projects": ["@midscene/report"],
36+
"target": "build",
37+
"params": "ignore"
38+
}
39+
]
40+
}
41+
}
2842
}
2943
}

apps/computer-playground/rsbuild.config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { pluginWorkspaceDev } from 'rsbuild-plugin-workspace-dev';
99
import { version as playgroundVersion } from '../../packages/playground/package.json';
1010
import {
1111
commonIgnoreWarnings,
12+
createCoreReportTemplateReplacementPlugin,
1213
createPlaygroundCopyPlugin,
1314
} from '../../scripts/rsbuild-utils.ts';
1415

@@ -63,6 +64,9 @@ export default defineConfig({
6364
pluginNodePolyfill(),
6465
pluginLess(),
6566
pluginSvgr(),
67+
createCoreReportTemplateReplacementPlugin({
68+
appDir: __dirname,
69+
}),
6670
createPlaygroundCopyPlugin(
6771
path.join(__dirname, 'dist'),
6872
path.join(__dirname, '../../packages/computer-playground/static'),

apps/playground/package.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,19 @@
3434
"rsbuild-plugin-workspace-dev": "0.0.1",
3535
"tsx": "^4.19.2",
3636
"typescript": "^5.8.3"
37+
},
38+
"nx": {
39+
"targets": {
40+
"build": {
41+
"dependsOn": [
42+
"^build",
43+
{
44+
"projects": ["@midscene/report"],
45+
"target": "build",
46+
"params": "ignore"
47+
}
48+
]
49+
}
50+
}
3751
}
3852
}

0 commit comments

Comments
 (0)