@@ -5,8 +5,10 @@ module.exports = (api, _options) => {
5
5
const browserExtension = Object . assign ( { } , _options )
6
6
delete browserExtension . registry
7
7
delete browserExtension . components
8
- // const hasRouter = api.hasPlugin('router')
9
- // const hasVuex = api.hasPlugin('vuex')
8
+ delete browserExtension . generateSigningKey
9
+
10
+ const hasRouter = api . hasPlugin ( 'router' )
11
+ const hasVuex = api . hasPlugin ( 'vuex' )
10
12
const hasTs = api . hasPlugin ( 'typescript' )
11
13
const hasLint = api . hasPlugin ( 'eslint' )
12
14
const fileExt = hasTs ? 'ts' : 'js'
@@ -48,51 +50,44 @@ module.exports = (api, _options) => {
48
50
const options = Object . assign ( { } , _options )
49
51
options . name = name
50
52
options . description = description
51
- // options.hasRouter = hasRouter
52
- // options.hasVuex = hasVuex
53
+ options . hasRouter = hasRouter
54
+ options . hasVuex = hasVuex
53
55
options . hasTs = hasTs
54
56
options . hasLint = hasLint
55
57
options . fileExt = fileExt
56
58
57
59
api . render ( './template/base-app' , options )
58
- api . render ( { './src/components/HelloWorld.vue' : `./template/HelloWorld.${ fileExt } .vue` } , options )
60
+ const additionalFiles = { './src/components/HelloWorld.vue' : `./template/HelloWorld.${ fileExt } .vue` }
59
61
60
62
if ( options . components . background ) {
61
- api . render (
62
- {
63
- [ `./src/background.${ fileExt } ` ] : `./template/background/src/background.js`
64
- } ,
65
- options
66
- )
63
+ additionalFiles [ `./src/background.${ fileExt } ` ] = './template/background/src/background.js'
67
64
}
68
65
69
66
if ( options . components . contentScripts ) {
70
- api . render (
71
- {
72
- [ `./src/content-scripts/content-script.${ fileExt } ` ] : `./template/content-scripts/src/content-scripts/content-script.js`
73
- } ,
74
- options
75
- )
67
+ additionalFiles [ `./src/content-scripts/content-script.${ fileExt } ` ] =
68
+ './template/content-scripts/src/content-scripts/content-script.js'
76
69
}
77
70
71
+ api . render ( additionalFiles , options )
72
+
78
73
if ( options . components . popup ) {
79
- renderDomain ( { title : 'Popup' , ext : fileExt , options, api } )
74
+ renderDomain ( { title : 'Popup' , fileExt, options, api, hasMinimumSize : true } )
80
75
}
81
76
82
77
if ( options . components . options ) {
83
- renderDomain ( { title : 'Options' , ext : fileExt , options, api } )
78
+ renderDomain ( { title : 'Options' , fileExt, options, api, hasMinimumSize : true } )
84
79
}
85
80
86
81
if ( options . components . override ) {
87
- renderDomain ( { title : 'Override' , ext : fileExt , options, api } )
82
+ renderDomain ( { title : 'Override' , fileExt, options, api } )
88
83
}
89
84
90
85
if ( options . components . standalone ) {
91
- renderDomain ( { title : 'Standalone' , filename : 'index.html' , ext : fileExt , options, api } )
86
+ renderDomain ( { title : 'Standalone' , filename : 'index.html' , fileExt, options, api } )
92
87
}
93
88
94
89
if ( options . components . devtools ) {
95
- renderDomain ( { title : 'Devtools' , ext : fileExt , options, api } )
90
+ renderDomain ( { title : 'Devtools' , fileExt, options, api } )
96
91
}
97
92
98
93
if ( options . generateSigningKey === true ) {
0 commit comments