- npm run backup: SQLite online backup + attachments copy, keep last BACKUP_KEEP (default 14), atomic via temp dir; tests included - docs/operations/backup.md: schedule, restore steps, single-instance limits (restore verified once against a scratch copy) - .github/workflows/ci.yml: npm ci, lint, format:check, typecheck, test - e2e: test:e2e:prepare (build + reset/migrate/seed e2e DB) and test:e2e (next start only); shared env in tests/e2e/env.ts; PLAYWRIGHT_CHANNEL to use the installed Chrome/Edge - CLAUDE.md: commands, code layout, domain import rule - Prettier fix in transaction.test.ts Tasks 6.1-7.2 done. 5.2 pending: the home test passes, but Playwright hangs on Chrome profile cleanup in this environment; to be verified in a normal terminal. Co-Authored-By: Claude Opus 5.5 <[email protected]>
23 lines
641 B
TypeScript
23 lines
641 B
TypeScript
import "./load-env";
|
|
import { createBackup } from "@/server/backup";
|
|
import { getEnv } from "@/server/env";
|
|
|
|
async function main() {
|
|
const env = getEnv();
|
|
const { dir, removed } = await createBackup({
|
|
databasePath: env.DATABASE_PATH,
|
|
attachmentsDir: env.ATTACHMENTS_DIR,
|
|
backupDir: env.BACKUP_DIR,
|
|
keep: env.BACKUP_KEEP,
|
|
});
|
|
console.log(`備份完成:${dir}`);
|
|
if (removed.length > 0) {
|
|
console.log(`已刪除 ${removed.length} 份舊備份(保留 ${env.BACKUP_KEEP} 份)`);
|
|
}
|
|
}
|
|
|
|
main().catch((error: unknown) => {
|
|
console.error(error instanceof Error ? error.message : error);
|
|
process.exit(1);
|
|
});
|