1
0
elk/scripts/prepare.ts

17 lines
977 B
TypeScript
Raw Normal View History

2023-01-16 19:26:19 +09:00
import fs from 'fs-extra'
import { emojiPrefix, iconifyEmojiPackage } from '../config/emojis'
2023-01-16 19:26:19 +09:00
import { colorsMap } from './generate-themes'
2022-11-24 12:42:03 +09:00
const dereference = process.platform === 'win32' ? true : undefined
2023-01-16 19:26:19 +09:00
await fs.copy('node_modules/shiki-es/dist/assets', 'public/shiki/', {
2022-11-24 12:42:03 +09:00
dereference,
filter: src => src === 'node_modules/shiki/' || src.includes('languages') || src.includes('dist'),
})
2023-01-16 19:26:19 +09:00
await fs.copy('node_modules/theme-vitesse/themes', 'public/shiki/themes', { dereference })
await fs.copy('node_modules/theme-vitesse/themes', 'node_modules/shiki/themes', { overwrite: true, dereference })
await fs.copy(`node_modules/${iconifyEmojiPackage}/icons`, `public/emojis/${emojiPrefix}`, { overwrite: true, dereference })
await fs.writeJSON('constants/themes.json', colorsMap, { spaces: 2, EOL: '\n' })
await fs.writeFile('styles/default-theme.css', `:root {\n${Object.entries(colorsMap[0][1]).map(([k, v]) => ` ${k}: ${v};`).join('\n')}\n}\n`, { encoding: 'utf-8' })