diff options
| author | Johann-S <[email protected]> | 2020-05-06 06:52:06 +0200 |
|---|---|---|
| committer | XhmikosR <[email protected]> | 2020-05-07 09:31:49 +0300 |
| commit | 015aaf3c3d52f9e28786f598f90f8a5a0884e7a0 (patch) | |
| tree | 4afd8b549b8efd37067a48d4d8634eb4fb208c62 | |
| parent | 22f75ca2e328ad232dd2afafd15dc0c79a908410 (diff) | |
| download | bootstrap-015aaf3c3d52f9e28786f598f90f8a5a0884e7a0.tar.xz bootstrap-015aaf3c3d52f9e28786f598f90f8a5a0884e7a0.zip | |
ensure build plugins can exit in error (#30744)
Co-authored-by: XhmikosR <[email protected]>
| -rw-r--r-- | build/build-plugins.js | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/build/build-plugins.js b/build/build-plugins.js index ad2d91a75..110df1646 100644 --- a/build/build-plugins.js +++ b/build/build-plugins.js @@ -38,7 +38,7 @@ const bsPlugins = { } const rootPath = TEST ? '../js/coverage/dist/' : '../js/dist/' -function build(plugin) { +const build = async (plugin) => { console.log(`Building ${plugin} plugin...`) const external = ['jquery', 'popper.js'] @@ -60,23 +60,32 @@ function build(plugin) { } const pluginFilename = `${plugin.toLowerCase()}.js` - - 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, `${rootPath}${pluginFilename}`) - }) - .then(() => console.log(`Building ${plugin} plugin... Done!`)) - .catch((err) => console.error(`${plugin}: ${err}`)) }) + + await bundle.write({ + banner: banner(pluginFilename), + format: 'umd', + name: plugin, + sourcemap: true, + globals, + file: path.resolve(__dirname, `${rootPath}${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() |
