Skip to content

Commit

Permalink
chore: better defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
evenstensberg committed Jan 3, 2019
1 parent 78436ff commit 0b6bab3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion bin/convert-argv.js
Expand Up @@ -77,7 +77,7 @@ module.exports = function(...args) {
const resolvedPath = path.resolve(pathToWebpackConfig);
configFiles.push({
path: resolvedPath,
ext: resolvedPath.split(".").pop(),
ext: resolvedPath.split(".").pop()
});
}
}
Expand Down
7 changes: 1 addition & 6 deletions bin/prompt-command.js
Expand Up @@ -35,12 +35,7 @@ module.exports = function promptForInstallation(packages, ...args) {
try {
const path = require("path");
const fs = require("fs");
pathForCmd = path.resolve(
process.cwd(),
"node_modules",
"@webpack-cli",
packages
);
pathForCmd = path.resolve(process.cwd(), "node_modules", "@webpack-cli", packages);
if (!fs.existsSync(pathForCmd)) {
const globalModules = require("global-modules");
pathForCmd = globalModules + "/@webpack-cli/" + packages;
Expand Down
14 changes: 11 additions & 3 deletions packages/generators/init-generator.ts
Expand Up @@ -96,6 +96,14 @@ export default class InitGenerator extends Generator {
return entryQuestions(self, entryTypeAnswer);
})
.then((entryOptions: object | string) => {
if(typeof entryOptions === 'string' && entryOptions.length > 0) {
return this.prompt([
Input(
"outputType",
"Which folder will your generated bundles be in? [default: dist]:",
),
]);
}
if (entryOptions !== "\"\"") {
this.configuration.config.webpackOptions.entry = entryOptions;
}
Expand Down Expand Up @@ -132,9 +140,9 @@ export default class InitGenerator extends Generator {
.then((_: void) => {
this.isProd = this.usingDefaults ? true : false;
this.configuration.config.configName = this.isProd ? "prod" : "dev";
this.configuration.config.webpackOptions.mode = this.isProd
? "'production'"
: "'development'";
if(!this.isProd) {
this.configuration.config.webpackOptions.mode = "'development'";
}
this.configuration.config.webpackOptions.plugins = this.isProd ? [] : getDefaultPlugins();
return this.prompt([
Confirm("babelConfirm", "Will you be using ES2015?"),
Expand Down

0 comments on commit 0b6bab3

Please sign in to comment.