Skip to content

Commit fb5dfda

Browse files
committed
misc(add): variable parity, prettify
1 parent 8787043 commit fb5dfda

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

lib/generators/add-generator.js

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ const entryQuestions = require("./utils/entry");
1818
* Replaces the string with a substring at the given index
1919
* https://gist.github.com/efenacigiray/9367920
2020
*
21-
* @param {String} string - string to be modified
22-
* @param {Number} index - index to replace from
23-
* @param {String} replace - string to replace starting from index
21+
* @param {String} string - string to be modified
22+
* @param {Number} index - index to replace from
23+
* @param {String} replace - string to replace starting from index
2424
*
25-
* @returns {String} string - The newly mutated string
25+
* @returns {String} string - The newly mutated string
2626
*
2727
*/
2828
function replaceAt(string, index, replace) {
@@ -33,10 +33,10 @@ function replaceAt(string, index, replace) {
3333
*
3434
* Checks if the given array has a given property
3535
*
36-
* @param {Array} arr - array to check
37-
* @param {String} prop - property to check existence of
36+
* @param {Array} arr - array to check
37+
* @param {String} prop - property to check existence of
3838
*
39-
* @returns {Boolean} hasProp - Boolean indicating if the property
39+
* @returns {Boolean} hasProp - Boolean indicating if the property
4040
* is present
4141
*/
4242
const traverseAndGetProperties = (arr, prop) => {
@@ -52,9 +52,9 @@ const traverseAndGetProperties = (arr, prop) => {
5252
/**
5353
*
5454
* Generator for adding properties
55-
* @class AddGenerator
56-
* @extends Generator
57-
* @returns {Void} After execution, transforms are triggered
55+
* @class AddGenerator
56+
* @extends Generator
57+
* @returns {Void} After execution, transforms are triggered
5858
*
5959
*/
6060

@@ -65,7 +65,9 @@ module.exports = class AddGenerator extends Generator {
6565
this.configuration = {
6666
config: {
6767
webpackOptions: {},
68-
topScope: ["const webpack = require('webpack')"]
68+
topScope: [
69+
"const webpack = require('webpack')"
70+
]
6971
}
7072
};
7173
}
@@ -76,6 +78,7 @@ module.exports = class AddGenerator extends Generator {
7678
let self = this;
7779
let manualOrListInput = action =>
7880
Input("actionAnswer", `what do you want to add to ${action}?`);
81+
7982
// first index indicates if it has a deep prop, 2nd indicates what kind of
8083
let isDeepProp = [false, false];
8184

@@ -104,7 +107,7 @@ module.exports = class AddGenerator extends Generator {
104107
return entryQuestions(self, entryTypeAnswer);
105108
})
106109
.then(entryOptions => {
107-
this.configuration.config.webpackOptions[action] = entryOptions;
110+
this.configuration.config.webpackOptions.entry = entryOptions;
108111
this.configuration.config.item = action;
109112
});
110113
}

0 commit comments

Comments
 (0)