2019-12-23 15:54:32 +01:00
|
|
|
import * as fs from 'fs-extra';
|
|
|
|
import * as path from 'path';
|
|
|
|
|
|
|
|
import {generateTheme} from '@moxer/vscode-theme-generator';
|
|
|
|
import {ThemeSetting} from './types';
|
|
|
|
import {getColorSet} from './color-set';
|
2019-12-26 11:30:46 +01:00
|
|
|
import {BUILD_FOLDER_PATH} from '../../src/env';
|
2019-12-23 15:54:32 +01:00
|
|
|
|
|
|
|
const THEME_BUILD_PATH = path.join(BUILD_FOLDER_PATH, 'themes');
|
2023-08-26 13:48:42 +02:00
|
|
|
const themes = ['default', 'darker', 'lighter', 'ocean', 'palenight', 'deepforest'];
|
2019-12-23 15:54:32 +01:00
|
|
|
|
|
|
|
const withHC = themes.reduce((acc, src) => {
|
|
|
|
acc = acc.concat(`${src}-hc`);
|
|
|
|
return acc;
|
|
|
|
}, themes);
|
|
|
|
|
|
|
|
const themeModules = withHC.map(async theme => import(`./settings/specific/${theme}`).then(res => res.default));
|
|
|
|
|
|
|
|
const generate = async (): Promise<void> => {
|
|
|
|
await fs.mkdirp(THEME_BUILD_PATH);
|
|
|
|
const modules = await Promise.all(themeModules) as ThemeSetting[];
|
|
|
|
modules.forEach(theme => {
|
|
|
|
const colorSet = getColorSet(theme);
|
|
|
|
generateTheme(theme.name, colorSet, path.join(THEME_BUILD_PATH, `${theme.name}.json`));
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2019-12-23 17:34:01 +01:00
|
|
|
const run = async (): Promise<void> => {
|
|
|
|
try {
|
|
|
|
await generate();
|
|
|
|
} catch (error) {
|
|
|
|
console.error('ERROR build:generate-themes', error);
|
|
|
|
process.exit(1);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2023-08-26 13:22:40 +02:00
|
|
|
void run();
|