Relocate the existing Astro website and preserve its assets and hosting configuration. Add the consumer/backend scaffold and themed Flutter package with consumer tests. Related to #1.
15 lines
1.1 KiB
JavaScript
15 lines
1.1 KiB
JavaScript
import { readFileSync, writeFileSync } from 'node:fs';
|
|
const tokens = JSON.parse(
|
|
readFileSync(new URL('../design/tokens.json', import.meta.url), 'utf8'),
|
|
);
|
|
const kebab = (name) => name.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`);
|
|
const colors = Object.entries(tokens.colors);
|
|
writeFileSync(
|
|
new URL('../src/styles/tokens.css', import.meta.url),
|
|
`/* Generated by npm run tokens. Edit design/tokens.json. */\n:root {\n${colors.map(([k, v]) => ` --${kebab(k)}: ${v};`).join('\n')}\n --radius: ${tokens.website.radius.card}px;\n --font-family: '${tokens.typography.family}', Arial, sans-serif;\n}\n`,
|
|
);
|
|
writeFileSync(
|
|
new URL('../flutter/brand_palette.dart', import.meta.url),
|
|
`// Generated brand palette reference. Optional for the Flutter application.\n// This is not an application theme: choose component styling independently.\nimport 'dart:ui';\n\nabstract final class SxchngeBrand {\n${colors.map(([k, v]) => ` static const ${k} = Color(0xFF${v.slice(1).toUpperCase()});`).join('\n')}\n static const fontFamily = '${tokens.typography.family}';\n}\n`,
|
|
);
|