vsc-material-theme/scripts/generator/index.ts
Alessio Occhipinti 72a12df8e1 Feat/generator 4 iteration (#400)
* chore: move env into src for better build

* chore: removed unused things from webviews

* feat: a better "defaults" - material-theme.config.json

* chore: fix paths for scripts

* feat: new folder "core" with managers

* chore: cleanup all useless things

* chore: update messages to be messages

* refactor: new setAccent command and better material.theme.config entry
2019-12-26 11:30:46 +01:00

37 lines
1.1 KiB
TypeScript

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';
import {BUILD_FOLDER_PATH} from '../../src/env';
const THEME_BUILD_PATH = path.join(BUILD_FOLDER_PATH, 'themes');
const themes = ['default', 'darker', 'lighter', 'ocean', 'palenight'];
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`));
});
};
const run = async (): Promise<void> => {
try {
await generate();
} catch (error) {
console.error('ERROR build:generate-themes', error);
process.exit(1);
}
};
run();