@@ -56,7 +56,7 @@ const defaultPluginConfig = {
56
56
}
57
57
}
58
58
59
- function getConfigByPluginKey ( pluginKey ) {
59
+ const getConfigByPluginKey = pluginKey => {
60
60
if (
61
61
pluginKey === 'Data' ||
62
62
pluginKey === 'Manipulator' ||
@@ -143,7 +143,7 @@ const domObjects = [
143
143
'SelectorEngine'
144
144
]
145
145
146
- function build ( plugin ) {
146
+ const build = async plugin => {
147
147
console . log ( `Building ${ plugin } plugin...` )
148
148
149
149
const { external, globals } = getConfigByPluginKey ( plugin )
@@ -158,24 +158,32 @@ function build(plugin) {
158
158
pluginPath = `${ rootPath } /dom/`
159
159
}
160
160
161
- rollup . rollup ( {
161
+ const bundle = await rollup . rollup ( {
162
162
input : bsPlugins [ plugin ] ,
163
163
plugins,
164
164
external
165
- } ) . then ( bundle => {
166
- bundle . write ( {
167
- banner : banner ( pluginFilename ) ,
168
- format : 'umd' ,
169
- name : plugin ,
170
- sourcemap : true ,
171
- globals,
172
- file : path . resolve ( __dirname , `${ pluginPath } /${ pluginFilename } ` )
173
- } )
174
- . then ( ( ) => console . log ( `Building ${ plugin } plugin... Done!` ) )
175
- . catch ( error => console . error ( `${ plugin } : ${ error } ` ) )
176
165
} )
177
- . catch ( error => console . error ( `${ plugin } : ${ error } ` ) )
166
+
167
+ await bundle . write ( {
168
+ banner : banner ( pluginFilename ) ,
169
+ format : 'umd' ,
170
+ name : plugin ,
171
+ sourcemap : true ,
172
+ globals,
173
+ file : path . resolve ( __dirname , `${ pluginPath } /${ pluginFilename } ` )
174
+ } )
175
+
176
+ console . log ( `Building ${ plugin } plugin... Done!` )
177
+ }
178
+
179
+ const main = async ( ) => {
180
+ try {
181
+ await Promise . all ( Object . keys ( bsPlugins ) . map ( plugin => build ( plugin ) ) )
182
+ } catch ( error ) {
183
+ console . error ( error )
184
+
185
+ process . exit ( 1 )
186
+ }
178
187
}
179
188
180
- Object . keys ( bsPlugins )
181
- . forEach ( plugin => build ( plugin ) )
189
+ main ( )
0 commit comments