feat: 初始化星元智灵人脸识别回收箱项目

This commit is contained in:
FinleyHsu
2026-07-28 10:48:03 +08:00
commit 32a31f0909
112 changed files with 28469 additions and 0 deletions
@@ -0,0 +1,45 @@
import assert from "node:assert/strict";
import { access, readFile, readdir } from "node:fs/promises";
import test from "node:test";
test("builds the finished operations console assets", async () => {
const [page, layout, clientFiles, hosting] = await Promise.all([
readFile(new URL("../app/page.tsx", import.meta.url), "utf8"),
readFile(new URL("../app/layout.tsx", import.meta.url), "utf8"),
readdir(new URL("../dist/client/assets/", import.meta.url)),
readFile(new URL("../dist/.openai/hosting.json", import.meta.url), "utf8"),
]);
assert.match(page, /AdminConsole/);
assert.match(layout, /智能回收运营平台/);
assert.match(layout, /og\.png/);
assert.ok(clientFiles.some((file) => file.startsWith("AdminConsole-") && file.endsWith(".js")));
assert.equal(JSON.parse(hosting).d1, "DB");
await access(new URL("../dist/client/og.png", import.meta.url));
});
test("removes starter preview and includes persistent API routes", async () => {
const [client, consoleApi, deviceApi, packageJson, readme] = await Promise.all([
readFile(new URL("../app/AdminConsole.tsx", import.meta.url), "utf8"),
readFile(new URL("../app/api/console/route.ts", import.meta.url), "utf8"),
readFile(new URL("../app/api/v1/[...path]/route.ts", import.meta.url), "utf8"),
readFile(new URL("../package.json", import.meta.url), "utf8"),
readFile(new URL("../README.md", import.meta.url), "utf8"),
]);
assert.match(client, /废料称重/);
assert.match(client, /地磅核对/);
assert.match(client, /导体追溯/);
assert.match(client, /人员设备/);
assert.match(client, /终端模拟/);
assert.match(consoleApi, /person\.face/);
assert.match(consoleApi, /alert\.status/);
assert.match(deviceApi, /heartbeat/);
assert.match(deviceApi, /deliveries/);
assert.match(deviceApi, /people/);
assert.doesNotMatch(packageJson, /react-loading-skeleton/);
assert.match(readme, /Docker Compose/);
await assert.rejects(access(new URL("../app/_sites-preview", import.meta.url)));
await access(new URL("../drizzle/", import.meta.url));
});