feat(verify-runner): archiveScreenshots() 归档到 docs/{app}/verification/

Co-Authored-By: Claude <[email protected]>
This commit is contained in:
sswandClaude committed 2026-06-16 11:49:43 +08:00
1 parent 2f562fcc5c
commit c5d34142eb
1 file changed
+26
+26
View File
@@ -141,3 +141,29 @@ export async function runVerify(
})
})
}
/**
* 截图归档: 从 verify-form.ts 临时目录复制到 docs/{app}/verification/{enCode}-{ts}/
* 返归档后路径列表
*/
export function archiveScreenshots(
sourceDir: string,
appCode: string,
enCode: string
): string[] {
if (!existsSync(sourceDir)) return []
const ts = new Date().toISOString().replace(/[-:T.]/g, '').slice(0, 14) // 20260616153045
const targetDir = join(WORK_DIR, 'docs', appCode, 'verification', `${enCode}-${ts}`)
mkdirSync(targetDir, { recursive: true })
const archived: string[] = []
for (const file of readdirSync(sourceDir)) {
if (file.endsWith('.png') || file.endsWith('.json')) {
const src = join(sourceDir, file)
const dst = join(targetDir, file)
copyFileSync(src, dst)
archived.push(dst)
}
}
return archived
}