Search code examples
gulpyeomanyeoman-generator

Run Yeoman generator in debug using gulp


I'm trying to create a gulp task that will execute Yeoman generator I'm developing. I've got this working using the following task, but I'm trying to find a way to not pass in the fully qualified path to the location of my globally installed NPM modules.

The gulp plugins I've seen (gulp-shell & gulp-run) execute a command (such as npm root -g) but I can't figure out how to read the text into a variable or if there's another / easier way to get this value.

gulp.task('run-yo', function () {
  spawn('node', [
    '--debug',
    '/Users/ac/.npm-packages/lib/node_modules/yo/lib/cli.js',
    'nodehttps'], { stdio: 'inherit' });
});

Solution

  • You can use node which

    var which = require('which');
    which.sync('yo');