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'; ...@@ -5,6 +5,8 @@ import chalk from 'chalk';
import { useSpinner } from '../utils/useSpinner'; import { useSpinner } from '../utils/useSpinner';
import { Task, TaskRunner } from './task'; import { Task, TaskRunner } from './task';
const path = require('path');
let distDir: string, cwd: string; let distDir: string, cwd: string;
// @ts-ignore // @ts-ignore
...@@ -74,6 +76,28 @@ const moveFiles = () => { ...@@ -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 () => { const toolkitBuildTaskRunner: TaskRunner<void> = async () => {
cwd = changeCwdToGrafanaToolkit(); cwd = changeCwdToGrafanaToolkit();
distDir = `${cwd}/dist`; distDir = `${cwd}/dist`;
...@@ -84,7 +108,9 @@ const toolkitBuildTaskRunner: TaskRunner<void> = async () => { ...@@ -84,7 +108,9 @@ const toolkitBuildTaskRunner: TaskRunner<void> = async () => {
await compile(); await compile();
await preparePackage(pkg); await preparePackage(pkg);
fs.mkdirSync('./dist/bin'); fs.mkdirSync('./dist/bin');
fs.mkdirSync('./dist/sass');
await moveFiles(); await moveFiles();
await copySassFiles();
restoreCwd(); 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