}
}
-function getConfigByPluginKey(pluginKey) {
+const getConfigByPluginKey = pluginKey => {
if (
pluginKey === 'Data' ||
pluginKey === 'Manipulator' ||
'SelectorEngine'
]
-function build(plugin) {
+const build = async plugin => {
console.log(`Building ${plugin} plugin...`)
const { external, globals } = getConfigByPluginKey(plugin)
pluginPath = `${rootPath}/dom/`
}
- rollup.rollup({
+ const bundle = await rollup.rollup({
input: bsPlugins[plugin],
plugins,
external
- }).then(bundle => {
- bundle.write({
- banner: banner(pluginFilename),
- format: 'umd',
- name: plugin,
- sourcemap: true,
- globals,
- file: path.resolve(__dirname, `${pluginPath}/${pluginFilename}`)
- })
- .then(() => console.log(`Building ${plugin} plugin... Done!`))
- .catch(error => console.error(`${plugin}: ${error}`))
})
- .catch(error => console.error(`${plugin}: ${error}`))
+
+ await bundle.write({
+ banner: banner(pluginFilename),
+ format: 'umd',
+ name: plugin,
+ sourcemap: true,
+ globals,
+ file: path.resolve(__dirname, `${pluginPath}/${pluginFilename}`)
+ })
+
+ console.log(`Building ${plugin} plugin... Done!`)
+}
+
+const main = async () => {
+ try {
+ await Promise.all(Object.keys(bsPlugins).map(plugin => build(plugin)))
+ } catch (error) {
+ console.error(error)
+
+ process.exit(1)
+ }
}
-Object.keys(bsPlugins)
- .forEach(plugin => build(plugin))
+main()