- docs/管理台.md 扩写 25→156 行(原文要点全保留,131 增 0 删):四集合
总表、块编辑九类(字段+示例 yaml+预览限制)、页面排版覆盖(含整页换字体
的体积成本提醒)、theme 17 旋钮分组约束、首页三字段、开源页六字段 +
include 未命中排查 + README 回落矩阵四级(把 T5 的"相对链接不重写/
徽章不阻断"两条限制落到用户文档)
- docs/写作指南.md:首页可配项补三行、新增「页面块」字段速查节(含 ≤24
块/≤4000 字/未知块跳过/空则回落 intro 的边界)、字体子集化段
(694KB→420KB −40% + subset-fonts.py 命令)、加字流程第④步挂子集化
- 后台 hint 49→64:九类块型说明、tagline/blurb、font 下拉体积提醒、scale
取值范围
- **修 config.yml 结构缺陷(重要)**:typography 对象被插进双语字段的
name: 与 widget: object 之间,导致重复键 widget/fields(后者覆盖前者)→
后台 tagline/blurb 退化成字符串写入、排版选择器字段被劫持。已挪到双语
字段之后,恢复 object+zh/en 结构(重复键检测:修前 4 处 → 修后 0)
- 新增 scripts/build-perf/config-check.py:用自定义 StrictLoader 在解析阶段
对重复键报错(Python 默认 safe_load 静默覆盖是本次漏检根因)+ hint 覆盖
率体检;build.sh 守卫挂载([ -f ] 先行,与既有闸门同级)
验证: 构建 48 页 exit 0;E2E 37/37;content-lint 49 页 0/0/0;对比度闸门
4 项 PASS;config-check 五文件全 OK + 206 字段/64 hint
Spec: 2026-11-02_blog-5g-pages (T6)
Co-authored-by: GLM-5.3
58 lines
3.5 KiB
Bash
Executable File
58 lines
3.5 KiB
Bash
Executable File
#!/bin/sh
|
||
# 构建管线(Phase 5c 裸 clone 改造):构建源 = origin/main 硬跟,非本地工作树。
|
||
#
|
||
# 为什么:此前直接构建 ~/Code/Github/my-blog 工作树——分支/未提交状态会
|
||
# 意外上线(Sveltia 冒烟期实测发生过);且 Sveltia 的 main 提交无法自动
|
||
# 发布。改为独立构建仓 fetch+reset 硬跟 main:线上=远端 main,确定性闭环。
|
||
# blog 仓已公开,匿名 fetch 无需凭据。
|
||
set -e
|
||
# 抓取 URL:默认公网;同机构建可由宿主环境变量覆盖为内网
|
||
# (2026-10-26 事故:ESA 边缘对 git.wait4x.online 522 时公网 fetch 失败,
|
||
# set -e 下静默死、staging 冻结——内网通道必须可用)
|
||
BLOG_GIT_URL="${BLOG_GIT_URL:-https://git.wait4x.online/wait4x/blog.git}"
|
||
BUILD_REPO="$HOME/docker_apps/blog/build-repo"
|
||
STAGING="$HOME/docker_apps/blog/www-staging"
|
||
|
||
if [ ! -d "$BUILD_REPO/.git" ]; then
|
||
echo "[build] 首次克隆构建仓"
|
||
git clone "$BLOG_GIT_URL" "$BUILD_REPO"
|
||
fi
|
||
|
||
cd "$BUILD_REPO"
|
||
# 每次构建把 origin 指向配置的 URL(同机构建走内网通道;公网 522 时仍可发布)
|
||
git remote set-url origin "$BLOG_GIT_URL"
|
||
git fetch origin main
|
||
git reset --hard origin/main
|
||
git clean -fd --exclude node_modules
|
||
SHA=$(git rev-parse --short HEAD)
|
||
echo "[build] 构建源: origin/main @ $SHA"
|
||
|
||
pnpm install --frozen-lockfile >/dev/null
|
||
pnpm astro build
|
||
|
||
# 按页字体 CSS 子集化(车道 A 任务 1):裁 @font-face 声明数,构建仓与本地同链;
|
||
# 存在性守卫:新文件未推送到 main 前构建仓无此脚本,绝不让发布链因车道在途文件断掉
|
||
[ -f scripts/build-perf/subset-font-css.mjs ] && node scripts/build-perf/subset-font-css.mjs dist || echo "[build] subset 脚本未就绪,跳过"
|
||
[ -f scripts/build-perf/config-check.py ] && python3 scripts/build-perf/config-check.py || echo "[build] config-check 未就绪,跳过"
|
||
[ -f scripts/build-perf/contrast-check.mjs ] && node scripts/build-perf/contrast-check.mjs dist || echo "[build] contrast 脚本未就绪,跳过"
|
||
# 首页阻塞 CSS 内联(车道 D):守卫先行同上——脚本未到 main 前绝不炸链
|
||
[ -f scripts/build-perf/gen-sw-precache.mjs ] && node scripts/build-perf/gen-sw-precache.mjs dist || echo "[build] sw-precache 生成器未就绪,跳过"
|
||
[ -f scripts/build-perf/inline-home-css.mjs ] && node scripts/build-perf/inline-home-css.mjs || echo "[build] inline-home 脚本未就绪,跳过"
|
||
|
||
# 内容 lint(T3):断链/缺图在部署前拦截;CONTENT_LINT=skip|warn 逃生门见脚本头注
|
||
[ -f scripts/build-perf/content-lint.mjs ] && node scripts/build-perf/content-lint.mjs dist || echo "[build] content-lint 未就绪,跳过"
|
||
|
||
echo "[build] rsync -> $STAGING"
|
||
mkdir -p "$STAGING"
|
||
rsync -a --delete "$BUILD_REPO/dist/" "$STAGING/"
|
||
ORIG="$HOME/docker_apps/blog/photos-originals"
|
||
if [ -d "$ORIG" ]; then rsync -a "$ORIG/" "$STAGING/photos-originals/"; fi
|
||
printf 'built %s at %s\n' "$SHA" "$(date -Is)" > "$STAGING/.build-stamp"
|
||
echo "[build] done: $(find "$STAGING" -name '*.html' | wc -l) html files @ $SHA"
|
||
|
||
# 生产冒烟(T3):staging 三断言。首版容忍失败(robots 待 T1 落地,smoke FAIL 属预期),
|
||
# T1 收编后改硬门:去掉 `|| echo` 让断言失败直接炸构建
|
||
if [ -f scripts/build-perf/prod-smoke.sh ] && [ "${SMOKE_BASE:-http://127.0.0.1:18743}" != "off" ]; then
|
||
bash scripts/build-perf/prod-smoke.sh "${SMOKE_BASE:-http://127.0.0.1:18743}" || echo "[build] prod-smoke 未过(见上;T1 robots 落地后转硬门)"
|
||
fi
|