refactor: 拆分品牌业务类型与页面方案
CI / Static checks (push) Has been cancelled
CI / Production build (push) Has been cancelled
CI / API integration (push) Has been cancelled
CI / Taro builds (acheng-campus-food) (push) Has been cancelled
CI / Taro builds (atelier-solopreneur) (push) Has been cancelled
CI / Taro builds (linjing-editorial) (push) Has been cancelled
CI / Browser regression (push) Has been cancelled
CI / Static checks (push) Has been cancelled
CI / Production build (push) Has been cancelled
CI / API integration (push) Has been cancelled
CI / Taro builds (acheng-campus-food) (push) Has been cancelled
CI / Taro builds (atelier-solopreneur) (push) Has been cancelled
CI / Taro builds (linjing-editorial) (push) Has been cancelled
CI / Browser regression (push) Has been cancelled
This commit is contained in:
1 parent
f02e2cafbb
commit
0d9f4a7d6f
86 files changed
+4111
-1543
No files matched your search
@@ -0,0 +1,25 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { existsSync, readFileSync } from "node:fs";
|
||||
import path from "node:path";
|
||||
import { test } from "node:test";
|
||||
|
||||
const projectRoot = path.resolve(import.meta.dirname, "../../..");
|
||||
const seedPath = path.join(projectRoot, "apps/api/prisma/seed.ts");
|
||||
const assetDirectory = path.join(projectRoot, "apps/api/prisma/assets");
|
||||
|
||||
test("开发 seed 引用的本地媒体都有随仓库分发的源文件", () => {
|
||||
const seed = readFileSync(seedPath, "utf8");
|
||||
const references = [...seed.matchAll(/["'](\/media\/seed\/[^"']+)["']/g)].map(
|
||||
([, mediaPath]) => mediaPath,
|
||||
);
|
||||
|
||||
assert.ok(references.length > 0, "seed 中没有找到本地媒体引用");
|
||||
for (const mediaPath of new Set(references)) {
|
||||
const filename = path.basename(mediaPath);
|
||||
assert.equal(
|
||||
existsSync(path.join(assetDirectory, filename)),
|
||||
true,
|
||||
`seed 引用的媒体缺少源文件: ${mediaPath}`,
|
||||
);
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user