Skip to content

Commit b5716c2

Browse files
chore: install deps after startup script changes
1 parent 42491ad commit b5716c2

File tree

8 files changed

+199
-127
lines changed

8 files changed

+199
-127
lines changed

federated-css-react-ssr/scripts/start-exposes.cjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@ async function main() {
1616
const pServe = run('pnpm', ['--filter', '"federated-css-react-ssr_expose-*"', '-r', 'run', 'serve']);
1717
process.on('SIGINT', () => pServe.kill('SIGINT'));
1818
process.on('SIGTERM', () => pServe.kill('SIGTERM'));
19+
// keep process alive
20+
await new Promise(() => {});
1921
}
2022

2123
main().catch(err => {
2224
console.error(err);
2325
process.exit(1);
2426
});
25-

federated-css-react-ssr/scripts/start-shells.cjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@ async function main() {
3131

3232
process.on('SIGINT', () => pServe.kill('SIGINT'));
3333
process.on('SIGTERM', () => pServe.kill('SIGTERM'));
34+
// keep process alive
35+
await new Promise(() => {});
3436
}
3537

3638
main().catch(err => {
3739
console.error(err);
3840
process.exit(1);
3941
});
40-

federated-css/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"e2e:headed": "playwright test --headed"
2727
},
2828
"devDependencies": {
29-
"@playwright/test": "^1.54.2"
29+
"@playwright/test": "^1.54.2",
30+
"wait-on": "7.2.0"
3031
}
3132
}

federated-css/playwright.config.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export default defineConfig({
88
expect: {
99
timeout: 15_000,
1010
},
11+
workers: process.env.CI ? 1 : undefined,
1112
fullyParallel: true,
1213
forbidOnly: !!process.env.CI,
1314
retries: process.env.CI ? 1 : 0,
@@ -31,20 +32,12 @@ export default defineConfig({
3132
],
3233
webServer: [
3334
{
34-
// Exposes must serve static bundles on fixed 400x ports to match remotes in consumers
35-
command: 'pnpm --filter "federated-css-mono_expose-*" --parallel serve',
36-
cwd: __dirname,
37-
port: 4000,
38-
reuseExistingServer: reuseExisting,
39-
timeout: 240_000,
40-
},
41-
{
42-
// Next.js consumers listen on 8081-8084; wait for the first to be ready
43-
command: 'pnpm --filter "@federated-css/*" --parallel start',
35+
// Build/serve exposes and consumers-react; start next consumers; wait for all ports
36+
command: 'node scripts/start-all.cjs',
4437
cwd: __dirname,
4538
port: 8081,
4639
reuseExistingServer: reuseExisting,
47-
timeout: 240_000,
40+
timeout: 300_000,
4841
},
4942
],
5043
});
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
const { spawn } = require('node:child_process');
2+
const waitOn = require('wait-on');
3+
const path = require('node:path');
4+
5+
const root = path.resolve(__dirname, '..');
6+
7+
function run(cmd, args) {
8+
return spawn(cmd, args, { stdio: 'inherit', cwd: root, shell: true });
9+
}
10+
11+
async function main() {
12+
// Build consumers-react and exposes, then serve both groups; start Next consumers (dev)
13+
await new Promise((res, rej) => {
14+
const p = run('pnpm', ['--filter', '"@federated-css/*"', '-r', 'run', 'build']);
15+
p.on('exit', c => (c === 0 ? res() : rej(new Error('build consumers failed'))));
16+
});
17+
await new Promise((res, rej) => {
18+
const p = run('pnpm', ['--filter', '"federated-css-mono_expose-*"', '-r', 'run', 'build']);
19+
p.on('exit', c => (c === 0 ? res() : rej(new Error('build exposes failed'))));
20+
});
21+
22+
const pReact = run('pnpm', ['--filter', '"@federated-css/*"', '-r', 'run', 'serve']);
23+
const pExposes = run('pnpm', ['--filter', '"federated-css-mono_expose-*"', '-r', 'run', 'serve']);
24+
const pNext = run('pnpm', ['--filter', '"@federated-css/next-*"', '-r', 'run', 'start']);
25+
26+
await waitOn({
27+
resources: [
28+
// consumers-react ports
29+
'http://localhost:3001', 'http://localhost:3002', 'http://localhost:3003',
30+
'http://localhost:3004', 'http://localhost:3005', 'http://localhost:3006', 'http://localhost:3007',
31+
// exposes ports
32+
'http://localhost:4000', 'http://localhost:4001', 'http://localhost:4002', 'http://localhost:4003',
33+
'http://localhost:4004', 'http://localhost:4005', 'http://localhost:4006', 'http://localhost:4007',
34+
// next consumers
35+
'http://localhost:8081', 'http://localhost:8082', 'http://localhost:8083', 'http://localhost:8084'
36+
],
37+
timeout: 300000,
38+
validateStatus: s => s >= 200 && s < 500,
39+
});
40+
41+
const killAll = sig => { pReact.kill(sig); pExposes.kill(sig); pNext.kill(sig); };
42+
process.on('SIGINT', () => killAll('SIGINT'));
43+
process.on('SIGTERM', () => killAll('SIGTERM'));
44+
45+
await new Promise(() => {});
46+
}
47+
48+
main().catch(err => { console.error(err); process.exit(1); });
49+

pnpm-lock.yaml

Lines changed: 114 additions & 111 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vue2-in-vue3/playwright.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ export default defineConfig({
1212
video: 'retain-on-failure',
1313
},
1414
webServer: {
15-
command: 'pnpm start',
15+
command: 'node scripts/start-all.cjs',
1616
cwd: __dirname,
1717
port: 3001,
1818
reuseExistingServer: !process.env.CI,
19-
timeout: 240_000,
19+
timeout: 300_000,
2020
},
2121
projects: [
2222
{

vue2-in-vue3/scripts/start-all.cjs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
const { spawn } = require('node:child_process');
2+
const waitOn = require('wait-on');
3+
const path = require('node:path');
4+
5+
const root = path.resolve(__dirname, '..');
6+
7+
function run(cmd, args) {
8+
return spawn(cmd, args, { stdio: 'inherit', cwd: root, shell: true });
9+
}
10+
11+
async function main() {
12+
await new Promise((res, rej) => {
13+
const p = run('pnpm', ['--filter', '"vue2-in-vue3_vue*"', '-r', 'run', 'build']);
14+
p.on('exit', c => (c === 0 ? res() : rej(new Error('build failed'))));
15+
});
16+
const pServe = run('pnpm', ['--filter', '"vue2-in-vue3_vue*"', '-r', 'run', 'serve']);
17+
await waitOn({ resources: ['http://localhost:3001', 'http://localhost:3002'], timeout: 180000 });
18+
process.on('SIGINT', () => pServe.kill('SIGINT'));
19+
process.on('SIGTERM', () => pServe.kill('SIGTERM'));
20+
await new Promise(() => {});
21+
}
22+
23+
main().catch(err => { console.error(err); process.exit(1); });
24+

0 commit comments

Comments
 (0)