2023-03-19 22:22:14 +09:00
|
|
|
import { readFile, writeFile } from 'node:fs/promises';
|
|
|
|
import { resolve } from 'node:path';
|
|
|
|
import * as JSON5 from 'json5';
|
|
|
|
|
2023-03-21 02:05:00 +09:00
|
|
|
const keys = [
|
|
|
|
'_dark',
|
|
|
|
'_light',
|
|
|
|
'l-light',
|
|
|
|
'l-coffee',
|
|
|
|
'l-apricot',
|
|
|
|
'l-rainy',
|
|
|
|
'l-botanical',
|
|
|
|
'l-vivid',
|
|
|
|
'l-cherry',
|
|
|
|
'l-sushi',
|
|
|
|
'l-u0',
|
|
|
|
'd-dark',
|
|
|
|
'd-persimmon',
|
|
|
|
'd-astro',
|
|
|
|
'd-future',
|
|
|
|
'd-botanical',
|
|
|
|
'd-green-lime',
|
|
|
|
'd-green-orange',
|
|
|
|
'd-cherry',
|
|
|
|
'd-ice',
|
|
|
|
'd-u0',
|
|
|
|
]
|
|
|
|
|
|
|
|
Promise.all(keys.map((key) => readFile(resolve(__dirname, `../src/themes/${key}.json5`), 'utf8'))).then((sources) => {
|
2023-03-19 22:22:14 +09:00
|
|
|
writeFile(
|
2023-03-21 02:05:00 +09:00
|
|
|
resolve(__dirname, './themes.ts'),
|
2023-03-19 22:22:14 +09:00
|
|
|
`export default ${JSON.stringify(
|
2023-03-21 02:05:00 +09:00
|
|
|
Object.fromEntries(sources.map((source, i) => [keys[i], JSON5.parse(source)])),
|
2023-03-19 22:22:14 +09:00
|
|
|
undefined,
|
|
|
|
2,
|
|
|
|
)} as const;`,
|
|
|
|
'utf8'
|
|
|
|
);
|
|
|
|
});
|