Files
zhanjunhao 2aa9d73325 chore(repo): 移除重复版权文件头并纳入共享单测
集中保留原版权声明,移除文件头检查和全局测试忽略规则。验证:全量单测、受影响用例复测及静态检查通过。
2026-11-20 11:23:49 +08:00

23 lines
771 B
JavaScript

import { preview } from 'vite';
import { fileURLToPath } from 'node:url';
import { positiveInteger } from './playwright-runtime.mjs';
import { verifyBuild } from './verify-build.mjs';
const directory =
process.env.PW_DIST_DIR ||
fileURLToPath(new URL('../dist/', import.meta.url));
const portIndex = process.argv.indexOf('--port');
const port = positiveInteger(
portIndex === -1 ? 4176 : process.argv[portIndex + 1],
'port',
);
if (port > 65535) throw new Error('port must be <= 65535');
await verifyBuild(directory);
const server = await preview({
build: { outDir: directory },
preview: { host: '127.0.0.1', port, strictPort: true },
});
server.printUrls();
for (const signal of ['SIGTERM', 'SIGINT'])
process.on(signal, () => server.httpServer.close());