Skip to content

Commit ee46c4a

Browse files
committed
refactor(core): move report template out of core js output
1 parent 9048895 commit ee46c4a

42 files changed

Lines changed: 862 additions & 484 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
@@ -58,6 +58,9 @@ jobs:
5858

5959
- name: Build project
6060
run: pnpm run build
61+
62+
- name: Verify report template asset
63+
run: pnpm run verify:report-template
6164

6265
- name: Type check tests
6366
run: pnpm run type-check:tests

.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
@@ -24,5 +24,19 @@
2424
"@types/react-dom": "^18.3.1",
2525
"less": "^4.2.0",
2626
"typescript": "^5.8.3"
27+
},
28+
"nx": {
29+
"targets": {
30+
"build": {
31+
"dependsOn": [
32+
"^build",
33+
{
34+
"projects": ["@midscene/report"],
35+
"target": "build",
36+
"params": "ignore"
37+
}
38+
]
39+
}
40+
}
2741
}
2842
}

apps/android-playground/rsbuild.config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { pluginWorkspaceDev } from 'rsbuild-plugin-workspace-dev';
88
import { version as playgroundVersion } from '../../packages/playground/package.json';
99
import {
1010
commonIgnoreWarnings,
11+
createCoreReportTemplateReplacementPlugin,
1112
createPlaygroundCopyPlugin,
1213
createTypeCheckPlugin,
1314
} from '../../scripts/rsbuild-utils.ts';
@@ -66,6 +67,9 @@ export default defineConfig({
6667
pluginNodePolyfill(),
6768
pluginLess(),
6869
pluginSvgr(),
70+
createCoreReportTemplateReplacementPlugin({
71+
appDir: __dirname,
72+
}),
6973
createPlaygroundCopyPlugin(
7074
path.join(__dirname, 'dist'),
7175
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:*",
@@ -52,5 +51,19 @@
5251
"typescript": "^5.8.3",
5352
"vitest": "3.0.5",
5453
"web-ext": "9.0.0"
54+
},
55+
"nx": {
56+
"targets": {
57+
"build": {
58+
"dependsOn": [
59+
"^build",
60+
{
61+
"projects": ["@midscene/report"],
62+
"target": "build",
63+
"params": "ignore"
64+
}
65+
]
66+
}
67+
}
5568
}
5669
}

apps/chrome-extension/rsbuild.config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { pluginWorkspaceDev } from 'rsbuild-plugin-workspace-dev';
88
import { version } from '../../packages/visualizer/package.json';
99
import {
1010
commonIgnoreWarnings,
11+
createCoreReportTemplateReplacementPlugin,
1112
createTypeCheckPlugin,
1213
} from '../../scripts/rsbuild-utils.ts';
1314

@@ -123,6 +124,9 @@ export default defineConfig({
123124
pluginLess(),
124125
pluginSvgr(),
125126
createTypeCheckPlugin(),
127+
createCoreReportTemplateReplacementPlugin({
128+
appDir: __dirname,
129+
}),
126130
pluginWorkspaceDev({
127131
projects: {
128132
'@midscene/report': {

apps/computer-playground/package.json

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

apps/computer-playground/rsbuild.config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { pluginWorkspaceDev } from 'rsbuild-plugin-workspace-dev';
88
import { version as playgroundVersion } from '../../packages/playground/package.json';
99
import {
1010
commonIgnoreWarnings,
11+
createCoreReportTemplateReplacementPlugin,
1112
createPlaygroundCopyPlugin,
1213
createTypeCheckPlugin,
1314
} from '../../scripts/rsbuild-utils.ts';
@@ -66,6 +67,9 @@ export default defineConfig({
6667
pluginNodePolyfill(),
6768
pluginLess(),
6869
pluginSvgr(),
70+
createCoreReportTemplateReplacementPlugin({
71+
appDir: __dirname,
72+
}),
6973
createPlaygroundCopyPlugin(
7074
path.join(__dirname, 'dist'),
7175
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
@@ -33,5 +33,19 @@
3333
"rsbuild-plugin-workspace-dev": "0.0.1",
3434
"tsx": "^4.19.2",
3535
"typescript": "^5.8.3"
36+
},
37+
"nx": {
38+
"targets": {
39+
"build": {
40+
"dependsOn": [
41+
"^build",
42+
{
43+
"projects": ["@midscene/report"],
44+
"target": "build",
45+
"params": "ignore"
46+
}
47+
]
48+
}
49+
}
3650
}
3751
}

0 commit comments

Comments
 (0)