add: meal ingestion CLI for images and metadata
All checks were successful
Deploy on push / deploy (push) Has been skipped

This commit is contained in:
2026-03-22 20:09:23 -07:00
parent 21c3a0c4b2
commit 8f9a7eda2f
6 changed files with 308 additions and 12 deletions

View File

@@ -182,6 +182,18 @@ function writeManifest(manifest) {
async function main() {
const options = parseArgs(process.argv.slice(2));
const summary = await buildThumbnails(options);
console.log(
`Thumbnail build complete: ${summary.generated} generated, ${summary.skipped} skipped, ${summary.removed} removed`
);
}
async function buildThumbnails(options = {}) {
const settings = {
force: false,
...options,
};
const meals = loadMeals();
const manifest = loadManifest();
const nextManifest = {};
@@ -194,7 +206,7 @@ async function main() {
let skipped = 0;
for (const meal of meals) {
const result = await generateThumbnail(meal, manifest, options);
const result = await generateThumbnail(meal, manifest, settings);
nextManifest[getManifestKey(meal.id)] = result.manifestEntry;
if (result.changed) {
@@ -206,12 +218,21 @@ async function main() {
writeManifest(nextManifest);
console.log(
`Thumbnail build complete: ${generated} generated, ${skipped} skipped, ${removed} removed`
);
return {
generated,
removed,
skipped,
total: meals.length,
};
}
main().catch((error) => {
console.error(error.message);
process.exitCode = 1;
});
if (require.main === module) {
main().catch((error) => {
console.error(error.message);
process.exitCode = 1;
});
}
module.exports = {
buildThumbnails,
};