nomadro/apps/miniprogram/weapp/scripts/_check_preface.py
eric 3e5b7c2098 Monorepo super-optimize: src layout, workspace scripts, docs.
Collapse portal under src/, unify pnpm workspace/scripts, thin VIP topic re-exports, drop orphan vip scaffolds and one-shot scripts, ignore xhs/release, document root commands.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-01 00:34:04 +08:00

15 lines
654 B
Python

# -*- coding: utf-8 -*-
import re
from pathlib import Path
t = Path("apps/miniprogram/tt/src/data/nomadCodeBook.ts").read_text(encoding="utf-8")
contents = re.findall(r'"content":\s*"((?:\\.|[^"\\])*)"', t)
s = contents[0]
out = Path("apps/miniprogram/scripts/_preface_check.txt")
out.write_text(
f"chapters={len(contents)}\nlen0={len(s)}\nqrcode={'qrcode_for_gh' in s}\noa_line={'公众号: 异度' in s or '公众号:异度' in s}\nplaceholders={t.count('完整图见公众号')}\n---\n"
+ s.replace("\\n", "\n"),
encoding="utf-8",
)
print("ok", len(contents), len(s), "qr", "qrcode_for_gh" in s, "ph", t.count("完整图见公众号"))