mirror of https://github.com/grafana/grafana
parent
06bae9aa46
commit
a09250a309
@ -0,0 +1,22 @@ |
|||||||
|
import program from 'commander'; |
||||||
|
import { startTask } from './start'; |
||||||
|
import chalk from 'chalk'; |
||||||
|
|
||||||
|
program |
||||||
|
.option('-h, --hot', 'Runs front-end with hot reload enabled') |
||||||
|
.option('-t, --theme', 'Watches for theme changes and regenerates variables.scss files') |
||||||
|
.option('-d, --depreciate <scripts>', 'Inform about npm script deprecation', v => v.split(',')) |
||||||
|
.parse(process.argv); |
||||||
|
|
||||||
|
if (program.depreciate && program.depreciate.length === 2) { |
||||||
|
console.log( |
||||||
|
chalk.yellow.bold( |
||||||
|
`[NPM script depreciation] ${program.depreciate[0]} is deprecated! Use ${program.depreciate[1]} instead!` |
||||||
|
) |
||||||
|
); |
||||||
|
} |
||||||
|
|
||||||
|
startTask({ |
||||||
|
watchThemes: !!program.theme, |
||||||
|
hot: !!program.hot, |
||||||
|
}); |
||||||
@ -1,23 +0,0 @@ |
|||||||
const concurrently = require('concurrently'); |
|
||||||
|
|
||||||
const startTask = async () => { |
|
||||||
try { |
|
||||||
const res = await concurrently([ |
|
||||||
{ |
|
||||||
command: 'nodemon -e ts -w ./packages/grafana-ui/src/themes -x yarn run themes:generate', |
|
||||||
name: 'SASS variables generator', |
|
||||||
}, |
|
||||||
{ |
|
||||||
command: 'webpack-dev-server --progress --colors --mode development --config scripts/webpack/webpack.hot.js', |
|
||||||
name: 'Dev server', |
|
||||||
}, |
|
||||||
], { |
|
||||||
killOthers: ['failure', 'failure'], |
|
||||||
}); |
|
||||||
} catch (e) { |
|
||||||
console.error(e); |
|
||||||
process.exit(1); |
|
||||||
} |
|
||||||
}; |
|
||||||
|
|
||||||
startTask(); |
|
||||||
@ -0,0 +1,32 @@ |
|||||||
|
const concurrently = require('concurrently'); |
||||||
|
|
||||||
|
export const startTask = async ({ watchThemes, hot }: { watchThemes: boolean; hot: boolean }) => { |
||||||
|
const jobs = []; |
||||||
|
if (watchThemes) { |
||||||
|
jobs.push({ |
||||||
|
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', |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
try { |
||||||
|
await concurrently(jobs, { |
||||||
|
killOthers: ['failure', 'failure'], |
||||||
|
}); |
||||||
|
} catch (e) { |
||||||
|
console.error(e); |
||||||
|
process.exit(1); |
||||||
|
} |
||||||
|
}; |
||||||
Loading…
Reference in new issue