Skip to content

Commit fb23aa4

Browse files
committedMay 28, 2019
misc(init-generator): improve types & defaults
1 parent 9856bab commit fb23aa4

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed
 

‎INIT.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# webpack-cli init
22

3-
`webpack-cli init` is used to initialize `webpack` projects quickly by scaffolding configuration and a runnable project with all the dependencies based on the user preferences.
3+
`webpack-cli init` is used to initialize `webpack` projects quickly by scaffolding configuration and creating a runnable project with all the dependencies based on the user preferences.
44

55
## Initial Setup
66

‎packages/generators/init-generator.ts

+8-4
Original file line numberDiff line numberDiff line change
@@ -151,15 +151,19 @@ export default class InitGenerator extends Generator {
151151
return this.prompt([
152152
Confirm("multiEntries", "Will your application have multiple bundles?", false),
153153
])
154-
.then((multiEntriesAnswer: any) =>
154+
.then((multiEntriesAnswer: {
155+
multiEntries: boolean,
156+
}) =>
155157
entryQuestions(self, multiEntriesAnswer.multiEntries),
156158
)
157159
.then((entryOption: object | string) => {
158160
if (typeof entryOption === "string" && entryOption.length > 0) {
159161
this.configuration.config.webpackOptions.entry = `${entryOption}`;
162+
} else if (typeof entryOption === "object") {
163+
this.configuration.config.webpackOptions.entry = entryOption;
160164
}
161165
})
162-
.then((_: void) =>
166+
.then(() =>
163167
this.prompt([
164168
Input(
165169
"outputDir",
@@ -191,7 +195,7 @@ export default class InitGenerator extends Generator {
191195
`path.resolve(__dirname, '${outputDirAnswer.outputDir}')`;
192196
}
193197
})
194-
.then((_: void) =>
198+
.then(() =>
195199
this.prompt([
196200
Confirm("useBabel", "Will you be using ES2015?"),
197201
]),
@@ -210,7 +214,7 @@ export default class InitGenerator extends Generator {
210214
);
211215
}
212216
})
213-
.then((_: void) =>
217+
.then(() =>
214218
this.prompt([
215219
List("stylingType", "Will you use one of the below CSS solutions?", [
216220
"No",

‎packages/generators/utils/entry.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export default function entry(self: CustomGenerator, multiEntries: boolean): Pro
104104
`${entryProp}`,
105105
`What is the location of "${entryProp}"?`,
106106
validate,
107-
`./src/${entryProp}`,
107+
`src/${entryProp}`,
108108
),
109109
]),
110110
).then((entryPropAnswer: object): object => {

0 commit comments

Comments
 (0)
Please sign in to comment.