Minor refactor of cli tasks (core start, gui publishing)
This commit is contained in:
@@ -1,35 +1,30 @@
|
||||
import concurrently from 'concurrently';
|
||||
import { Task } from '..';
|
||||
import { Task, TaskRunner } from './task';
|
||||
|
||||
interface StartTaskOptions {
|
||||
watchThemes: boolean;
|
||||
hot: boolean;
|
||||
}
|
||||
|
||||
const startTask: Task<StartTaskOptions> = async ({ watchThemes, hot }) => {
|
||||
const jobs = [];
|
||||
|
||||
if (watchThemes) {
|
||||
jobs.push({
|
||||
const startTaskRunner: TaskRunner<StartTaskOptions> = async ({ watchThemes, hot }) => {
|
||||
const jobs = [
|
||||
watchThemes && {
|
||||
command: 'nodemon -e ts -w ./packages/grafana-ui/src/themes -x yarn run themes:generate',
|
||||
name: 'SASS variables generator',
|
||||
});
|
||||
}
|
||||
|
||||
if (!hot) {
|
||||
jobs.push({
|
||||
command: 'webpack --progress --colors --watch --mode development --config scripts/webpack/webpack.dev.js',
|
||||
name: 'Webpack',
|
||||
});
|
||||
} else {
|
||||
jobs.push({
|
||||
command: 'webpack-dev-server --progress --colors --mode development --config scripts/webpack/webpack.hot.js',
|
||||
name: 'Dev server',
|
||||
});
|
||||
}
|
||||
},
|
||||
hot
|
||||
? {
|
||||
command: 'webpack-dev-server --progress --colors --mode development --config scripts/webpack/webpack.hot.js',
|
||||
name: 'Dev server',
|
||||
}
|
||||
: {
|
||||
command: 'webpack --progress --colors --watch --mode development --config scripts/webpack/webpack.dev.js',
|
||||
name: 'Webpack',
|
||||
},
|
||||
];
|
||||
|
||||
try {
|
||||
await concurrently(jobs, {
|
||||
await concurrently(jobs.filter(job => !!job), {
|
||||
killOthers: ['failure', 'failure'],
|
||||
});
|
||||
} catch (e) {
|
||||
@@ -38,4 +33,6 @@ const startTask: Task<StartTaskOptions> = async ({ watchThemes, hot }) => {
|
||||
}
|
||||
};
|
||||
|
||||
export default startTask;
|
||||
export const startTask = new Task<StartTaskOptions>();
|
||||
startTask.setName('Core startTask');
|
||||
startTask.setRunner(startTaskRunner);
|
||||
|
||||
Reference in New Issue
Block a user