core.start.ts 961 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import concurrently from 'concurrently';
  2. import { Task } from '..';
  3. interface StartTaskOptions {
  4. watchThemes: boolean;
  5. hot: boolean;
  6. }
  7. const startTask: Task<StartTaskOptions> = async ({ watchThemes, hot }) => {
  8. const jobs = [];
  9. if (watchThemes) {
  10. jobs.push({
  11. command: 'nodemon -e ts -w ./packages/grafana-ui/src/themes -x yarn run themes:generate',
  12. name: 'SASS variables generator',
  13. });
  14. }
  15. if (!hot) {
  16. jobs.push({
  17. command: 'webpack --progress --colors --watch --mode development --config scripts/webpack/webpack.dev.js',
  18. name: 'Webpack',
  19. });
  20. } else {
  21. jobs.push({
  22. command: 'webpack-dev-server --progress --colors --mode development --config scripts/webpack/webpack.hot.js',
  23. name: 'Dev server',
  24. });
  25. }
  26. try {
  27. await concurrently(jobs, {
  28. killOthers: ['failure', 'failure'],
  29. });
  30. } catch (e) {
  31. console.error(e);
  32. process.exit(1);
  33. }
  34. };
  35. export default startTask;