28 lines
1.3 KiB
TypeScript
28 lines
1.3 KiB
TypeScript
/**
|
|
* The app's icons, made from the PWA's icon (`apps/rosea/public/icon.svg`) before every build
|
|
* (tauri-platforms.md D8). They are build output, never committed: the only images in git are
|
|
* the source SVG and optimised art under art/final/ (CLAUDE.md §5.2). The icon is still a
|
|
* placeholder; the real one comes through the art pipeline (GAP_ANALYSIS G0.21).
|
|
*
|
|
* tsx scripts/icons.ts makes them when missing or older than the SVG
|
|
*/
|
|
import { existsSync, statSync } from 'node:fs';
|
|
import { join } from 'node:path';
|
|
import { PACKAGE, SRC_TAURI, tauri } from './tauri.js';
|
|
|
|
const SOURCE = join(PACKAGE, '..', 'rosea', 'public', 'icon.svg');
|
|
const MARK = join(SRC_TAURI, 'icons', 'icon.ico');
|
|
const ANDROID = join(SRC_TAURI, 'gen', 'android');
|
|
const ANDROID_MARK = join(ANDROID, 'app', 'src', 'main', 'res', 'mipmap-mdpi', 'ic_launcher.png');
|
|
|
|
const stale = (file: string): boolean => !existsSync(file) || statSync(file).mtimeMs < statSync(SOURCE).mtimeMs;
|
|
|
|
// `tauri icon` writes the Android launcher icons into gen/android only when that exists, so it
|
|
// runs again after `tauri android init` (which puts Tauri's own logo there).
|
|
if (stale(MARK) || (existsSync(ANDROID) && stale(ANDROID_MARK))) {
|
|
tauri('icon', SOURCE);
|
|
console.log('icons: made from apps/rosea/public/icon.svg');
|
|
} else {
|
|
console.log('icons: up to date');
|
|
}
|