2026-08-06 16:53:48 +02:00
|
|
|
import { readFile, writeFile } from 'node:fs/promises';
|
|
|
|
|
|
|
|
|
|
const source = await readFile(new URL('../packages/web-ui/dist/styles.css', import.meta.url), 'utf8');
|
2026-10-19 21:46:52 +00:00
|
|
|
// The token import may be written with single or double quotes, and with or without the semicolon.
|
|
|
|
|
const tokenImport = /^@import\s+(['"])@gabriel20xx\/design-tokens\/theme\.css\1\s*;?$/;
|
2026-08-06 16:53:48 +02:00
|
|
|
const componentStyles = source
|
|
|
|
|
.split(/\r?\n/)
|
2026-10-19 21:46:52 +00:00
|
|
|
.filter((line) => !tokenImport.test(line.trim()))
|
2026-08-06 16:53:48 +02:00
|
|
|
.join('\n')
|
|
|
|
|
.trimStart();
|
|
|
|
|
|
|
|
|
|
await writeFile(
|
|
|
|
|
new URL('../shared-styles.css', import.meta.url),
|
|
|
|
|
`@import './packages/design-tokens/theme.css';\n\n${componentStyles}`,
|
|
|
|
|
'utf8'
|
|
|
|
|
);
|