feat: 分离模板演示数据并校验预览资源

This commit is contained in:
que01 committed 2026-10-16 17:55:52 +08:00
1 parent 6edde5a8d6
commit b60174885e
31 files changed
+1785 -69

No files matched your search

+13 -6
View File
@@ -1,17 +1,24 @@
import assert from "node:assert/strict";
import { execFileSync } from "node:child_process";
import { mkdtempSync, readFileSync, rmSync } from "node:fs";
import { existsSync, mkdtempSync, readFileSync, readdirSync, rmSync } from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
import test from "node:test";
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
const script = path.join(root, "scripts/template-pack.cjs");
const templatePackages = [
["acheng-campus-food", "1.0.0"],
["atelier-solopreneur", "1.1.0"],
["linjing-editorial", "1.0.0"],
];
const templatePackages = readdirSync(path.join(root, "packages"))
.filter(
(name) =>
name.startsWith("template-") &&
existsSync(path.join(root, "packages", name, "template.json")),
)
.map((name) => {
const manifest = JSON.parse(
readFileSync(path.join(root, "packages", name, "template.json"), "utf8"),
);
return [manifest.packageKey, manifest.version];
});
for (const [packageKey, version] of templatePackages) {
test(`${packageKey} produces a stable package directory and archive`, () => {