Commit 22e2ac27 by Ryan McKinley Committed by GitHub

grafana/toolkit: copy sass files (#17888)

include sass files in toolkit
parent 874b8abc
......@@ -5,6 +5,8 @@ import chalk from 'chalk';
import { useSpinner } from '../utils/useSpinner';
import { Task, TaskRunner } from './task';
const path = require('path');
let distDir: string, cwd: string;
// @ts-ignore
......@@ -74,6 +76,28 @@ const moveFiles = () => {
})();
};
const copySassFiles = () => {
const files = ['_variables.generated.scss', '_variables.dark.generated.scss', '_variables.light.generated.scss'];
// @ts-ignore
return useSpinner<void>(`Copy scss files ${files.join(', ')} files`, async () => {
const sassDir = path.resolve(cwd, '../../public/sass/');
const promises = files.map(file => {
return new Promise((resolve, reject) => {
const name = file.replace('.generated', '');
fs.copyFile(`${sassDir}/${file}`, `${distDir}/sass/${name}`, err => {
if (err) {
reject(err);
return;
}
resolve();
});
});
});
await Promise.all(promises);
})();
};
const toolkitBuildTaskRunner: TaskRunner<void> = async () => {
cwd = changeCwdToGrafanaToolkit();
distDir = `${cwd}/dist`;
......@@ -84,7 +108,9 @@ const toolkitBuildTaskRunner: TaskRunner<void> = async () => {
await compile();
await preparePackage(pkg);
fs.mkdirSync('./dist/bin');
fs.mkdirSync('./dist/sass');
await moveFiles();
await copySassFiles();
restoreCwd();
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment