Family bookkeeping PWA modelled on 木木记账
Hono + SQLite server and a React/shadcn PWA with two-level categories, who-spent/who-paid splits, settlement, one-line and voice entry, budget alerts (Web Push and Bark), monthly/annual reports, and 木木 import tools. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
// Downloads the Fluent Emoji 3D icons referenced in server/src/icons.ts
|
||||
// into web/public/icons/<slug>.png. Run once; the PNGs are committed.
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
|
||||
const root = path.dirname(path.dirname(new URL(import.meta.url).pathname));
|
||||
const src = fs.readFileSync(path.join(root, 'server/src/icons.ts'), 'utf8');
|
||||
const names = [...new Set([...src.matchAll(/'([A-Z][^']*)'/g)].map((m) => m[1]))];
|
||||
const out = path.join(root, 'web/public/icons');
|
||||
fs.mkdirSync(out, { recursive: true });
|
||||
|
||||
const base = 'https://cdn.jsdelivr.net/gh/microsoft/fluentui-emoji@main/assets';
|
||||
for (const name of names) {
|
||||
const slug = name.toLowerCase().replace(/\s+/g, '-');
|
||||
const file = path.join(out, `${slug}.png`);
|
||||
if (fs.existsSync(file)) continue;
|
||||
const snake = name.toLowerCase().replace(/\s+/g, '_');
|
||||
const candidates = [`${name}/3D/${snake}_3d.png`, `${name}/Default/3D/${snake}_3d_default.png`];
|
||||
let ok = false;
|
||||
for (const c of candidates) {
|
||||
const res = await fetch(`${base}/${c.split('/').map(encodeURIComponent).join('/')}`);
|
||||
if (!res.ok) continue;
|
||||
if (res.headers.get('content-type') !== 'image/png') continue;
|
||||
fs.writeFileSync(file, Buffer.from(await res.arrayBuffer()));
|
||||
ok = true;
|
||||
break;
|
||||
}
|
||||
console.log(ok ? 'ok ' : 'MISSING', name);
|
||||
}
|
||||
Reference in New Issue
Block a user