Yeoman generator now installs NPM/DNX dependencies and runs webpack

This commit is contained in:
SteveSandersonMS
2016-04-29 11:26:25 +01:00
parent 4de2e9673f
commit b51a035c68

View File

@@ -36,7 +36,7 @@ class MyGenerator extends yeoman.Base {
this._answers.namePascalCase = toPascalCase(answers.name); this._answers.namePascalCase = toPascalCase(answers.name);
this._answers.projectGuid = uuid.v4(); this._answers.projectGuid = uuid.v4();
done(); done();
}) });
} }
writing() { writing() {
@@ -52,6 +52,26 @@ class MyGenerator extends yeoman.Base {
); );
}); });
} }
installingDeps() {
// Strictly speaking, with DNX, the 'prepare' script runs 'npm install' anyway so we don't really need
// to run it from here. But it will be needed with RC2, and it doesn't make the setup take much longer
// because the second run is almost a no-op, so it's OK to leave it here for now.
this.installDependencies({
npm: true,
bower: false,
callback: () => {
this.spawnCommandSync('dnu', ['restore']);
// With DNX, the 'prepare' script builds the vendor files automatically so the following is not
// required. With RC2 and the 'dotnet' tooling, that won't happen automatically, so the following
// will be required:
// this.spawnCommandSync('./node_modules/.bin/webpack', ['--config', 'webpack.config.vendor.js']);
this.spawnCommandSync('./node_modules/.bin/webpack');
}
});
}
} }
declare var module: any; declare var module: any;