chore(tooling): 对齐协作规范与浏览器验收工具

验证:713 项单测、8 视口环境、代码及格式检查通过;未运行生产构建。
This commit is contained in:
zhanjunhao
2026-11-17 14:48:50 +08:00
parent ac9bbfd472
commit d0ef462921
30 changed files with 2089 additions and 160 deletions
+41
View File
@@ -0,0 +1,41 @@
/*
Copyright (C) 2025 QuantumNous
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
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());