Files
ledgerly-docs/scripts/ts/capture-all.ts
T
rosercode b1fb2c68a9 docs: 新增日历页文档并补充记账直接新建分类/标签/渠道说明
补上此前已完成但未提交的文档更新:新增「日历」页面使用文档,并把登录后默认落地页由统计面板调整为日历,同步页面流程与偏好说明;同时补充记账弹窗内可直接新建分类/标签/渠道的说明,并登记相应截图场景。

变更内容:
- 新增 guide/calendar.md,并在 .vitepress/config.mts 侧边栏与 guide/pages.md、guide/index.md 登记日历页
- index.md、guide/getting-started.md、guide/dashboard.md、guide/pages.md 同步日历为登录后默认落地页与页面流程
- dev/preferences.md 新增日历偏好 ledgerly.calendar.view/year/month/statsScope 说明
- guide/transactions.md 补充记账弹窗内直接新建分类/标签/渠道的说明,guide/ai.md、guide/categories-tags.md、guide/channels.md 同步相关描述
- scripts/ts/capture-all.ts、capture-pages.ts、capture-elements.ts 增加日历与新建分类等截图场景,captureModals 支持按场景过滤
2026-10-13 12:52:08 +08:00

49 lines
2.0 KiB
TypeScript

// 一键重新截图:覆盖文档站全部配图(整页 + 元素 + 卡片 + 账单解析预览)。
//
// 可重复执行,重新生成并替换已有截图。运行前请确保:
// - 应用实例已启动且测试库中已配置 AI(用于截取启用 AI 后的界面);
// - scripts/samples/alipay_sample.zip 样例账单存在。
import { mkdir } from 'node:fs/promises'
import { injectSession, launchBrowser, login, newContext } from './browser.js'
import { captureAddRecord, captureAiRule, captureBillParse, captureCalendarDetail, captureCalendarMonth, captureCalendarYear, captureCards, captureEditRecord, captureInlineCreate, captureModals, captureSettingsPanels, captureTrendJump } from './capture-elements.js'
import { capturePages } from './capture-pages.js'
import { ELEM_DIR } from './config.js'
async function main(): Promise<void> {
await mkdir(ELEM_DIR, { recursive: true })
const browser = await launchBrowser()
try {
// 1. 未登录状态:登录/注册卡片(独立上下文,不注入登录态)
const guestContext = await newContext(browser, { width: 1440, height: 900 })
const guestPage = await guestContext.newPage()
await captureCards(guestPage)
await guestContext.close()
// 2. 登录态上下文:整页 + 弹窗 + 账单解析预览
const token = await login()
const context = await newContext(browser)
await injectSession(context, token)
const page = await context.newPage()
await capturePages(page)
await captureCalendarMonth(page)
await captureCalendarYear(page)
await captureCalendarDetail(page)
await captureAddRecord(page)
await captureModals(page)
await captureEditRecord(page)
await captureInlineCreate(page)
await captureAiRule(page)
await captureSettingsPanels(page)
await captureBillParse(page)
await captureTrendJump(page)
await context.close()
} finally {
await browser.close()
}
}
main().catch((err) => {
console.error('FAIL', err)
process.exit(1)
})