Skip to content

Commit b51a035

Browse files
Yeoman generator now installs NPM/DNX dependencies and runs webpack
1 parent 4de2e96 commit b51a035

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

  • templates/yeoman/src/generator/app

templates/yeoman/src/generator/app/index.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class MyGenerator extends yeoman.Base {
3636
this._answers.namePascalCase = toPascalCase(answers.name);
3737
this._answers.projectGuid = uuid.v4();
3838
done();
39-
})
39+
});
4040
}
4141

4242
writing() {
@@ -52,6 +52,26 @@ class MyGenerator extends yeoman.Base {
5252
);
5353
});
5454
}
55+
56+
installingDeps() {
57+
// Strictly speaking, with DNX, the 'prepare' script runs 'npm install' anyway so we don't really need
58+
// to run it from here. But it will be needed with RC2, and it doesn't make the setup take much longer
59+
// because the second run is almost a no-op, so it's OK to leave it here for now.
60+
this.installDependencies({
61+
npm: true,
62+
bower: false,
63+
callback: () => {
64+
this.spawnCommandSync('dnu', ['restore']);
65+
66+
// With DNX, the 'prepare' script builds the vendor files automatically so the following is not
67+
// required. With RC2 and the 'dotnet' tooling, that won't happen automatically, so the following
68+
// will be required:
69+
// this.spawnCommandSync('./node_modules/.bin/webpack', ['--config', 'webpack.config.vendor.js']);
70+
71+
this.spawnCommandSync('./node_modules/.bin/webpack');
72+
}
73+
});
74+
}
5575
}
5676

5777
declare var module: any;

0 commit comments

Comments
 (0)