1ed3ac062a
Plan 4 Task 5:build.service snapshotting 后接真实构建——building 态进 pipeline.ts(spawn `pnpm --filter @sf/theme-pilot-minimal exec astro build` (SF_BUILD_INPUT env;非零退出+stderr 标记判据)→ dist 定位与 target_file 完整性 → 媒体 copyPath→dist/public_path(sha256 全量校验)→ sitemap.xml/ robots.txt(编码 URL 原样)→ route-manifest.json(§12.1 字段面、哈希链复用) → build_artifacts dist/manifest 登记)→ validating(空,Task 6) → 报告+report 行 → succeeded;失败任何一步 failed+error_code/error_summary(stderr 摘要) +input/dist 清残。 dist 双位置纪律:主题包 dist 是暂存,产物汇齐后拷出 <artifactsRoot>/jobs/ <jobId>/dist(job 级权威),暂存随即清空。无网证明:ASTRO_TELEMETRY_DISABLED=1 (实测 @astrojs/telemetry 构建期真调 fetch)+ NODE_OPTIONS 透传(测试注入 fetch/net stub 构建仍成功)。主题集成补面:ProductList 模板 + /products/ 主列表分派特判(DB 物化形状 targetContentId=null,Task 4 夹具曾被占位绕过)。 测试:tests/integration/build-pipeline.test.ts 五用例(全链/夹具直跑/五禁 断言/失败路径);build-snapshot 状态机补 building + 清场补 build_artifacts。 root 359 + theme 26 全绿。 Co-Authored-By: Claude Code <noreply@anthropic.com>
34 lines
1.9 KiB
TypeScript
34 lines
1.9 KiB
TypeScript
// pilot 主题清单(spec §9.1;类型面 = contracts 冻结的 ThemeManifest——守卫 isThemeManifest
|
||
// 在测试里钉死通过)。import type 编译期擦除:astro build 不产生对 @sf/contracts 的运行时依赖。
|
||
//
|
||
// appliesTo 约定(声明性提示,派发真值在 Task 4 的模板分派器):
|
||
// 'route:<path>' 精确路由命中(home= '/',not-found = '/404')
|
||
// 'type:<typeKey>' 按内容类型分派(详情页)
|
||
// 'path-prefix:<pfx>' 按路径前缀分派(列表页;product-list 的 /category/ 别名前缀
|
||
// 由 Task 4 分派器一并处理——单一 appliesTo 字符串不承载多前缀;
|
||
// /products/ 产品主列表同此先例:Task 5 集成补面的 ProductList
|
||
// 模板由分派器精确路由特判,不另立模板键)
|
||
import type { ThemeManifest } from '@sf/contracts'
|
||
|
||
export const themeManifest: ThemeManifest = {
|
||
key: 'pilot-minimal',
|
||
version: '0.1.0',
|
||
renderContractVersion: '1',
|
||
// 快线三类内容(与 build_input_snapshots 物化面一致);'basic_page' 覆盖 generic page
|
||
supportedContentTypes: ['news_article', 'product', 'basic_page'],
|
||
// site.json 必须提供的键(publish 首版 config v1 恰好满足;brand 刻意不在必填列——
|
||
// Task 1 审查移交:brand 恒可能 {},主题对 brand 全缺省容忍)
|
||
requiredSiteConfig: ['name', 'origin', 'locale'],
|
||
templates: [
|
||
{ key: 'home', appliesTo: 'route:/' },
|
||
{ key: 'page', appliesTo: 'type:basic_page' },
|
||
{ key: 'product-list', appliesTo: 'path-prefix:/product-category/' },
|
||
{ key: 'product-detail', appliesTo: 'type:product' },
|
||
{ key: 'news-list', appliesTo: 'path-prefix:/news/' },
|
||
{ key: 'news-detail', appliesTo: 'type:news_article' },
|
||
{ key: 'not-found', appliesTo: 'route:/404' },
|
||
],
|
||
}
|
||
|
||
export default themeManifest
|