Search code examples
javascriptgulpaureliagulp-shell

Aurelia CLI and Gulp Shell


Is there a way to execute au build from the context of a specific folder?

My folder structure is:

- UI
  |-main
  | | <aurelia_project_here>
  |
  |-another
  | | <aurelia_project_here>
  |
  |-gulpfile.js

My gulpfile.js looks something like:

var gulp = require('gulp'),
    shell = require('gulp-shell');

gulp.task('build-main', shell.task(['cd main', 'au build', 'cd ..']));
gulp.task('build-another', shell.task(['cd another', 'au build', 'cd ..']));

gulp.task('build', gulp.parallel('build-main', 'build-another', done => done()));

I need to execute the shell in the context of the respective aurelia project directories.... Unless you can specify them to the the aurelia cli


Solution

  • Use the cwd option of gulp-shell:

    gulp.task('build-main', shell.task('au build', {cwd:'main'}));
    gulp.task('build-another', shell.task('au build', {cwd:'another'}));