Add Prettier and ESLint tooling (Refs #77)

This commit is contained in:
2026-10-09 15:56:13 -04:00
parent 8ed059b8d3
commit 16469e2d43
711 changed files with 99737 additions and 28286 deletions
+27 -10
View File
@@ -4,13 +4,30 @@ import { statSync } from 'node:fs';
const path = process.argv[2] ?? process.env.DB_PATH ?? './data/cherry.db';
const db = new Database(path, { readonly: true, fileMustExist: true });
try {
console.table(['', '-wal', '-shm'].map(suffix => {
try { return { file: path + suffix, bytes: statSync(path + suffix).size }; }
catch (error) { if (error.code !== 'ENOENT') throw error; return { file: path + suffix, bytes: 0 }; }
}));
console.table(db.prepare(`SELECT name, ROUND(SUM(pgsize)/1048576.0, 2) AS mib
FROM dbstat GROUP BY name ORDER BY SUM(pgsize) DESC LIMIT 20`).all());
console.table(['page_size', 'page_count', 'freelist_count', 'auto_vacuum'].map(pragma => ({
pragma, value: db.pragma(pragma, { simple: true })
})));
} finally { db.close(); }
console.table(
['', '-wal', '-shm'].map((suffix) => {
try {
return { file: path + suffix, bytes: statSync(path + suffix).size };
} catch (error) {
if (error.code !== 'ENOENT') throw error;
return { file: path + suffix, bytes: 0 };
}
})
);
console.table(
db
.prepare(
`SELECT name, ROUND(SUM(pgsize)/1048576.0, 2) AS mib
FROM dbstat GROUP BY name ORDER BY SUM(pgsize) DESC LIMIT 20`
)
.all()
);
console.table(
['page_size', 'page_count', 'freelist_count', 'auto_vacuum'].map((pragma) => ({
pragma,
value: db.pragma(pragma, { simple: true })
}))
);
} finally {
db.close();
}