mirror of
https://github.com/grafana/grafana.git
synced 2024-11-29 12:14:08 -06:00
742e0d56eb
* Move cli to grafana-toolkit * Moving packages, fixing ts * Add basics of plugin build task * Add toolkit build task * Circle - use node 10 for test-frontend * Prettier fix * First attempt for having shared tsconfig for plugins * Add enzyme as peer depencency * Do not expose internal commands when using toolkit from npm package * Introduce plugin linting * Fix missing file * Fix shim extenstion * Remove rollup typings * Add tslint as dependency * Toolkit - use the same versions of enzyme and tslint as core does * Remove include property from plugin tsconfig * Take failed suites into consideration when tests failed * Set ts-jest preset for jest * Cleanup tsconfig.plugins * Add plugin:test task * Rename file causing build failute * Fixing those missed renames * Add ts as peer dependency * Remove enzyme dependency and tweak test plugin task * Allow jest options overrides via package.json config * Improvements * Remove rollup node packages * TMP : Fix ts errors when linked * use local tslint if it exists * support coverage commands * Fix merge * fix build * Some minors * Make jest pass when no tests discovered
40 lines
1.5 KiB
TypeScript
40 lines
1.5 KiB
TypeScript
import * as fs from 'fs';
|
|
import darkTheme from '@grafana/ui/src/themes/dark';
|
|
import lightTheme from '@grafana/ui/src/themes/light';
|
|
import defaultTheme from '@grafana/ui/src/themes/default';
|
|
import { darkThemeVarsTemplate } from '@grafana/ui/src/themes/_variables.dark.scss.tmpl';
|
|
import { lightThemeVarsTemplate } from '@grafana/ui/src/themes/_variables.light.scss.tmpl';
|
|
import { commonThemeVarsTemplate } from '@grafana/ui/src/themes/_variables.scss.tmpl';
|
|
|
|
const darkThemeVariablesPath = __dirname + '/../../public/sass/_variables.dark.generated.scss';
|
|
const lightThemeVariablesPath = __dirname + '/../../public/sass/_variables.light.generated.scss';
|
|
const defaultThemeVariablesPath = __dirname + '/../../public/sass/_variables.generated.scss';
|
|
|
|
const writeVariablesFile = async (path: string, data: string) => {
|
|
return new Promise((resolve, reject) => {
|
|
fs.writeFile(path, data, e => {
|
|
if (e) {
|
|
reject(e);
|
|
} else {
|
|
resolve(data);
|
|
}
|
|
});
|
|
});
|
|
};
|
|
|
|
const generateSassVariableFiles = async () => {
|
|
try {
|
|
await Promise.all([
|
|
writeVariablesFile(darkThemeVariablesPath, darkThemeVarsTemplate(darkTheme)),
|
|
writeVariablesFile(lightThemeVariablesPath, lightThemeVarsTemplate(lightTheme)),
|
|
writeVariablesFile(defaultThemeVariablesPath, commonThemeVarsTemplate(defaultTheme)),
|
|
]);
|
|
console.log('\nSASS variable files generated');
|
|
} catch (error) {
|
|
console.error('\nWriting SASS variable files failed', error);
|
|
process.exit(1);
|
|
}
|
|
};
|
|
|
|
generateSassVariableFiles();
|