File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -27,11 +27,8 @@ module.exports = class Generator {
27
27
const api = new GeneratorAPI ( id , this , options , rootOptions || { } )
28
28
apply ( api , options , rootOptions )
29
29
} )
30
- // if the user has chosen so, extract configs from package.json into
31
- // dedicated files.
32
- if ( extractConfigFiles ) {
33
- this . extractConfigFiles ( )
34
- }
30
+ // extract configs from package.json into dedicated files.
31
+ this . extractConfigFiles ( extractConfigFiles )
35
32
}
36
33
37
34
async generate ( ) {
@@ -44,15 +41,23 @@ module.exports = class Generator {
44
41
await writeFileTree ( this . context , this . files )
45
42
}
46
43
47
- extractConfigFiles ( ) {
48
- for ( const key in this . pkg ) {
44
+ extractConfigFiles ( all ) {
45
+ const extract = key => {
49
46
if ( configMap [ key ] ) {
50
47
const value = this . pkg [ key ]
51
48
const { transform, filename } = configMap [ key ]
52
49
this . files [ filename ] = transform ( value )
53
50
delete this . pkg [ key ]
54
51
}
55
52
}
53
+ if ( all ) {
54
+ for ( const key in this . pkg ) {
55
+ extract ( key )
56
+ }
57
+ } else {
58
+ // by default, extract vue.config.js
59
+ extract ( 'vue' )
60
+ }
56
61
}
57
62
58
63
sortPkg ( ) {
You can’t perform that action at this time.
0 commit comments