This is the first commit of the project, at the state that runs on timelog.minhtrannhat.com. Changes in this state: - Remove redundant UI text from the sidebar, timer and insights pages. - Show the remaining time and tag in the browser tab title while a session runs. - Put the shared record type and the due and end helpers in src/shared/record.ts. - Remove the startup tag migration and the one-time Forest import script. The live data does not need them. - Remove unused CSS, Playwright ignore rules and duplicate helpers. - Do not track Forest CSV exports, because they contain private data. Co-Authored-By: Claude Opus 5.5 <[email protected]>
24 lines
674 B
TypeScript
24 lines
674 B
TypeScript
import { mkdir } from "node:fs/promises";
|
|
import { dirname } from "node:path";
|
|
import { Database } from "bun:sqlite";
|
|
|
|
const source = process.env.DB_PATH || "./dev.sqlite";
|
|
const destination = Bun.argv[2];
|
|
if (!destination) {
|
|
console.error("Usage: bun scripts/backup.ts /path/to/new-backup.sqlite");
|
|
process.exit(1);
|
|
}
|
|
if (await Bun.file(destination).exists()) {
|
|
console.error(`Backup already exists: ${destination}`);
|
|
process.exit(1);
|
|
}
|
|
|
|
await mkdir(dirname(destination), { recursive: true });
|
|
const db = new Database(source);
|
|
try {
|
|
db.query("VACUUM INTO ?").run(destination);
|
|
console.log(`SQLite backup written to ${destination}`);
|
|
} finally {
|
|
db.close();
|
|
}
|