Files
ONE-OS/axhub-make/scripts/smoke-shell-boundaries.mjs
王冕 a27e3b8e43 feat: sync full workspace including web modules, docs, and configurations to Gitea
Optimized the root .gitignore to exclude virtual environments, node modules,
and temp folders to ensure clean and lightweight version tracking.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-09 18:12:25 +08:00

50 lines
1.2 KiB
JavaScript

#!/usr/bin/env node
const baseUrl = process.argv[2] || 'http://localhost:51720';
const rootUrl = new URL('/', baseUrl).toString();
const previewUrl = new URL('/prototypes/ref-antd-copy', baseUrl).toString();
let hasFailure = false;
async function checkHtml(url, expected) {
const response = await fetch(url, {
redirect: 'follow',
headers: { Accept: 'text/html' },
});
const html = await response.text();
const result = {
ok: response.ok,
hasViteClient: html.includes('/@vite/client'),
hasReactRefreshPreamble: html.includes('/@react-refresh'),
};
const matches = expected(result);
if (!matches) {
hasFailure = true;
console.error(`[shell-boundary] FAIL ${url}`);
console.error(` status=${response.status}`);
console.error(` hasViteClient=${result.hasViteClient}`);
console.error(` hasReactRefreshPreamble=${result.hasReactRefreshPreamble}`);
return;
}
console.log(`[shell-boundary] OK ${url}`);
}
await checkHtml(rootUrl, (result) => (
result.ok
&& !result.hasViteClient
&& !result.hasReactRefreshPreamble
));
await checkHtml(previewUrl, (result) => (
result.ok
&& result.hasViteClient
&& result.hasReactRefreshPreamble
));
if (hasFailure) {
process.exitCode = 1;
}