@@ -34,9 +34,9 @@ Param: `String`
34
34
Used when you cannot use regular conventions. Handy for examples like ` RegExp ` or ` output.sourcePrefix `
35
35
36
36
``` js
37
- const parseValue = require (" @webpack-cli/webpack-scaffold" ).parseValue ;
37
+ const parseValue = require (' @webpack-cli/webpack-scaffold' ).parseValue ;
38
38
39
- this .configuration .myScaffold .webpackOptions .output .sourcePrefix = parseValue (" \t " );
39
+ this .configuration .myScaffold .webpackOptions .output .sourcePrefix = parseValue (' \t ' );
40
40
// sourcePrefix: '\t'
41
41
```
42
42
@@ -47,9 +47,9 @@ Param: `String`
47
47
Generally used when dealing with an entry point as an arrow function
48
48
49
49
``` js
50
- const createArrowFunction = require (" @webpack-cli/webpack-scaffold" ).createArrowFunction ;
50
+ const createArrowFunction = require (' @webpack-cli/webpack-scaffold' ).createArrowFunction ;
51
51
52
- this .configuration .myScaffold .webpackOptions .entry = createArrowFunction (" app.js" );
52
+ this .configuration .myScaffold .webpackOptions .entry = createArrowFunction (' app.js' );
53
53
// entry: () => 'app.js'
54
54
```
55
55
@@ -60,9 +60,9 @@ Param: `String`
60
60
Used when creating a function that returns a single value
61
61
62
62
``` js
63
- const createRegularFunction = require (" @webpack-cli/webpack-scaffold" ).createRegularFunction ;
63
+ const createRegularFunction = require (' @webpack-cli/webpack-scaffold' ).createRegularFunction ;
64
64
65
- this .configuration .myScaffold .webpackOptions .entry = createRegularFunction (" app.js" );
65
+ this .configuration .myScaffold .webpackOptions .entry = createRegularFunction (' app.js' );
66
66
// entry: function() { return 'app.js' }
67
67
```
68
68
@@ -73,12 +73,12 @@ Param: `Array` | `String`
73
73
Used to create a dynamic entry point
74
74
75
75
``` js
76
- const createDynamicPromise = require (" @webpack-cli/webpack-scaffold" ).createDynamicPromise ;
76
+ const createDynamicPromise = require (' @webpack-cli/webpack-scaffold' ).createDynamicPromise ;
77
77
78
- this .confguration .myScaffold .webpackOptions .entry = createDynamicPromise (" app.js" );
78
+ this .confguration .myScaffold .webpackOptions .entry = createDynamicPromise (' app.js' );
79
79
// entry: () => new Promise((resolve) => resolve('app.js'))
80
80
81
- this .configuration .myScaffold .webpackOptions .entry = createDynamicPromise ([" app.js" , " index.js" ]);
81
+ this .configuration .myScaffold .webpackOptions .entry = createDynamicPromise ([' app.js' , ' index.js' ]);
82
82
// entry: () => new Promise((resolve) => resolve(['app.js','index.js']))
83
83
```
84
84
@@ -89,22 +89,22 @@ Param: `String`
89
89
Used to create an [ assetFilterFunction] ( https://webpack.js.org/configuration/performance/#performance-assetfilter )
90
90
91
91
``` js
92
- const createAssetFilterFunction = require (" @webpack-cli/webpack-scaffold" ).createAssetFilterFunction ;
92
+ const createAssetFilterFunction = require (' @webpack-cli/webpack-scaffold' ).createAssetFilterFunction ;
93
93
94
- this .configuration .myScaffold .webpackOptions .performance .assetFilter = createAssetFilterFunction (" js " );
94
+ this .configuration .myScaffold .webpackOptions .performance .assetFilter = createAssetFilterFunction (' js ' );
95
95
// assetFilter: function (assetFilename) { return assetFilename.endsWith('.js'); }
96
96
```
97
97
98
98
## createExternalFunction
99
99
100
100
Param: ` String `
101
101
102
- Used to create an [ general function from Externals] ( https://webpack.js.org/configuration/externals/#function )
102
+ Used to create a [ general function from Externals] ( https://webpack.js.org/configuration/externals/#function )
103
103
104
104
``` js
105
- const createExternalFunction = require (" @webpack-cli/webpack-scaffold" ).createExternalFunction ;
105
+ const createExternalFunction = require (' @webpack-cli/webpack-scaffold' ).createExternalFunction ;
106
106
107
- this .configuration .myScaffold .webpackOptions .externals = [createExternalFunction (" ^yourregex$" )];
107
+ this .configuration .myScaffold .webpackOptions .externals = [createExternalFunction (' ^yourregex$' )];
108
108
/*
109
109
externals: [
110
110
function(context, request, callback) {
@@ -123,9 +123,9 @@ Param: `String`
123
123
Used to create a module in ` topScope `
124
124
125
125
``` js
126
- const createRequire = require (" @webpack-cli/webpack-scaffold" ).createRequire ;
126
+ const createRequire = require (' @webpack-cli/webpack-scaffold' ).createRequire ;
127
127
128
- this .configuration .myScaffold .topScope = [createRequire (" webpack" )];
128
+ this .configuration .myScaffold .topScope = [createRequire (' webpack' )];
129
129
// const webpack = require('webpack')
130
130
```
131
131
@@ -138,9 +138,9 @@ Param: `name<String>, message<String>, choices<Array>`
138
138
Creates a List from Inquirer
139
139
140
140
``` js
141
- const List = require (" @webpack-cli/webpack-scaffold" ).List ;
141
+ const List = require (' @webpack-cli/webpack-scaffold' ).List ;
142
142
143
- List (" entry" , " what kind of entry do you want?" , [" Array" , " Function" ]);
143
+ List (' entry' , ' what kind of entry do you want?' , [' Array' , ' Function' ]);
144
144
```
145
145
146
146
### RawList
@@ -150,9 +150,9 @@ Param: `name<String>, message<String>, choices<Array>`
150
150
Creates a RawList from Inquirer
151
151
152
152
``` js
153
- const RawList = require (" @webpack-cli/webpack-scaffold" ).RawList ;
153
+ const RawList = require (' @webpack-cli/webpack-scaffold' ).RawList ;
154
154
155
- RawList (" entry" , " what kind of entry do you want?" , [" Array" , " Function" ]);
155
+ RawList (' entry' , ' what kind of entry do you want?' , [' Array' , ' Function' ]);
156
156
```
157
157
158
158
### CheckList
@@ -162,9 +162,9 @@ Param: `name<String>, message<String>, choices<Array>`
162
162
Creates a CheckList(` checkbox ` ) from Inquirer
163
163
164
164
``` js
165
- const CheckList = require (" @webpack-cli/webpack-scaffold" ).CheckList ;
165
+ const CheckList = require (' @webpack-cli/webpack-scaffold' ).CheckList ;
166
166
167
- CheckList (" entry" , " what kind of entry do you want?" , [" Array" , " Function" ]);
167
+ CheckList (' entry' , ' what kind of entry do you want?' , [' Array' , ' Function' ]);
168
168
```
169
169
170
170
### Input
@@ -174,9 +174,9 @@ Param: `name<String>, message<String>, [default<String>]`
174
174
Creates an Input from Inquirer
175
175
176
176
``` js
177
- const Input = require (" @webpack-cli/webpack-scaffold" ).Input ;
177
+ const Input = require (' @webpack-cli/webpack-scaffold' ).Input ;
178
178
179
- Input (" entry" , " what is your entry point?" , " src/index" );
179
+ Input (' entry' , ' what is your entry point?' , ' src/index' );
180
180
```
181
181
182
182
### InputValidate
@@ -186,16 +186,16 @@ Param: `name<String>, message<String>, [validate<Function>, default<String>]`
186
186
Creates an Input from Inquirer
187
187
188
188
``` js
189
- const InputValidate = require (" @webpack-cli/webpack-scaffold" ).InputValidate ;
189
+ const InputValidate = require (' @webpack-cli/webpack-scaffold' ).InputValidate ;
190
190
191
191
const validation = value => {
192
- if (value .length > 4 ) {
193
- return true ;
194
- } else {
195
- return " Your answer must be longer than 4 characters, try again" ;
196
- }
192
+ if (value .length > 4 ) {
193
+ return true ;
194
+ } else {
195
+ return ' Your answer must be longer than 4 characters, try again' ;
196
+ }
197
197
};
198
- InputValidate (" entry" , " what is your entry point?" , validation, " src/index" );
198
+ InputValidate (' entry' , ' what is your entry point?' , validation, ' src/index' );
199
199
```
200
200
201
201
### Confirm
@@ -205,9 +205,9 @@ Param: `name<String>, message<String>, [default<Boolean>]`
205
205
Creates an Input from Inquirer
206
206
207
207
``` js
208
- const Confirm = require (" @webpack-cli/webpack-scaffold" ).Confirm ;
208
+ const Confirm = require (' @webpack-cli/webpack-scaffold' ).Confirm ;
209
209
210
- Confirm (" contextConfirm" , " Is this your context?" );
210
+ Confirm (' contextConfirm' , ' Is this your context?' );
211
211
```
212
212
213
213
[ downloads ] : https://img.shields.io/npm/dm/@webpack-cli/webpack-scaffold.svg
0 commit comments