feat: 补齐模板编译扩展性门禁与演练模板
- 新增第二行业演练模板 drill-consultant,验证新增行业无需修改编译器和运行��� - 补充 override 冲突与显式覆盖测试,产物校验覆盖 wxss - 修复 --template-dir 模板被误判引用其他模板组件的问题 - 修复运行时排除规则误删 TDesign 深层 src 目录,增加 miniprogram_npm 完整性回归 - 模板目录校验统一复用 template-contract,新增 template:check 并接入 pnpm check - tabBar 配色归属模板包,清理编译器过期排除项和旧 fixture - ADR 0015 明确对 0005/0008/0009 的替换范围 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
e2e2340bfe
commit
a97cc860cf
31 files changed
+418
-158
No files matched your search
@@ -1,11 +1,8 @@
|
||||
const fs = require("node:fs");
|
||||
const path = require("node:path");
|
||||
const os = require("node:os");
|
||||
const { execFileSync } = require("node:child_process");
|
||||
const root = path.resolve(__dirname, "..");
|
||||
const requestSource = fs.readFileSync(path.join(root, "utils/request.js"), "utf8");
|
||||
const configSource = fs.readFileSync(path.join(root, "utils/config.js"), "utf8");
|
||||
const runtimeRequestSource = fs.readFileSync(path.join(root, "utils/request.js"), "utf8");
|
||||
if (
|
||||
!requestSource.includes('path.startsWith("/public/")') ||
|
||||
!requestSource.includes("brandSlug") ||
|
||||
@@ -15,8 +12,8 @@ if (
|
||||
process.exit(1);
|
||||
}
|
||||
if (
|
||||
!runtimeRequestSource.includes('path.startsWith("/customer/session/wechat")') ||
|
||||
!runtimeRequestSource.includes('"customerToken:" + config.brandSlug')
|
||||
!requestSource.includes('path.startsWith("/customer/session/wechat")') ||
|
||||
!requestSource.includes('"customerToken:" + config.brandSlug')
|
||||
) {
|
||||
console.error("miniapp: customer sessions must be brand-scoped");
|
||||
process.exit(1);
|
||||
@@ -41,10 +38,7 @@ for (const term of ["林境门", "亲自主理量房", "拒绝流水线拼装",
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
const fixtureFiles = ["linjing-door.json", "doors-industry.json"];
|
||||
const fixtures = fixtureFiles.map((file) =>
|
||||
JSON.parse(fs.readFileSync(path.join(__dirname, "fixtures", file), "utf8")),
|
||||
);
|
||||
// 各模板的页面完整性由 template-contract 与 test:visual-fixture(自动发现全部模板并编译)负责。
|
||||
const doorsContent = JSON.parse(
|
||||
fs.readFileSync(path.join(__dirname, "fixtures", "doors-content.json"), "utf8"),
|
||||
);
|
||||
@@ -60,42 +54,6 @@ if (!doorsContent.offerings.every((item) => item.kind === "product" || item.kind
|
||||
console.error("doors: offerings must use shared product or service kinds");
|
||||
process.exit(1);
|
||||
}
|
||||
for (const fixture of fixtures) {
|
||||
const pageMap = {
|
||||
home: "pages/index/index",
|
||||
offerings: "pages/services/index",
|
||||
detail: "pages/offering/detail",
|
||||
inquiry: "pages/inquiry/index",
|
||||
success: "pages/inquiry-success/index",
|
||||
records: "pages/records/index",
|
||||
profile: "pages/bookings/index",
|
||||
};
|
||||
const templateKey = fixture.templateKey.startsWith("acheng")
|
||||
? "acheng-campus-food"
|
||||
: "linjing-editorial";
|
||||
const output = fs.mkdtempSync(path.join(os.tmpdir(), "personal-brand-fixture-"));
|
||||
execFileSync(
|
||||
process.execPath,
|
||||
[
|
||||
path.resolve(root, "../../packages/template-compiler/src/cli.mjs"),
|
||||
"--template",
|
||||
templateKey,
|
||||
"--out",
|
||||
output,
|
||||
],
|
||||
{ stdio: "ignore" },
|
||||
);
|
||||
const missingPages = fixture.pages.filter(
|
||||
(key) => !fs.existsSync(path.join(output, `${pageMap[key]}.json`)),
|
||||
);
|
||||
if (missingPages.length) {
|
||||
console.error(`${fixture.templateKey}: missing page manifests: ${missingPages.join(", ")}`);
|
||||
process.exit(1);
|
||||
}
|
||||
console.log(
|
||||
`Fixture ${fixture.templateKey}@${fixture.version} passed: ${fixture.pages.length} pages.`,
|
||||
);
|
||||
}
|
||||
console.log(
|
||||
`Content fixture doors passed: ${doorsContent.offerings.length} offerings, ${doorsContent.trustContent.length} trust entries, ${doorsContent.inquiryFields.length} inquiry fields.`,
|
||||
);
|
||||
Reference in new issue
Block a user