nerdstein / nerdstein-design-library

Design Library for the 2017 Nerdstein Site Redesign
6 stars 4 forks source link

Gulp-shell is blacklisted. Needs to be replaced with gulp-exec or npm child_process #35

Open iris-i opened 6 years ago

iris-i commented 6 years ago

The npm library being used to start the PL server & export files has been blacklisted for using anti-patterns: Blacklist: https://github.com/gulpjs/plugins/blob/master/src/blackList.json Issue: https://github.com/sun-zheng-an/gulp-shell/issues/55

Fwiw the author doesn't agree with this: https://github.com/gulpjs/gulp/issues/1353 https://github.com/sun-zheng-an/gulp-shell/issues/82

I am testing this to replace the task, but my gulpfile is outside of the PL directory. Will submit a PR once I fine-tune how it works and change it to work from within the PL directory:

gulp.task('start-server', function() {
  var options = {
    continueOnError: false, // default = false, true means don't emit error event
    pipeStdout: false, // default = false, true means stdout is written to file.contents
  };
  var reportOptions = {
    err: true, // default = true, false means don't write err
    stderr: true, // default = true, false means don't write stderr
    stdout: true // default = true, false means don't write stdout
  };
  return gulp.src('./design-library')
    .pipe(exec('cd <%= file.path %> && php core/console --server --with-watch', options))
    .pipe(exec.reporter(reportOptions));
});

I got this from the gulp-exec readme and I'm still trying to figure out how to log the patternlab console messages that tell you that the server has been started and the localhost url to open. Gulp docs: https://github.com/gulpjs/gulp/blob/4.0/docs/recipes/running-shell-commands.md Gulp exec docs: https://github.com/robrich/gulp-exec