Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorJohann-S <johann.servoire@gmail.com>2020-05-06 07:52:06 +0300
committerGitHub <noreply@github.com>2020-05-06 07:52:06 +0300
commitd1575b6b6bbdcf7cd2371953b4d3d165ae941c02 (patch)
tree21edcda57609319faebccd49ae9273c41066477d /build
parentf91788548cad3a90e695641b319f49bce952e281 (diff)
ensure build plugins can exit in error (#30744)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
Diffstat (limited to 'build')
-rw-r--r--build/build-plugins.js42
1 files changed, 25 insertions, 17 deletions
diff --git a/build/build-plugins.js b/build/build-plugins.js
index 3a8163ce02..44d155c4f9 100644
--- a/build/build-plugins.js
+++ b/build/build-plugins.js
@@ -56,7 +56,7 @@ const defaultPluginConfig = {
}
}
-function getConfigByPluginKey(pluginKey) {
+const getConfigByPluginKey = pluginKey => {
if (
pluginKey === 'Data' ||
pluginKey === 'Manipulator' ||
@@ -143,7 +143,7 @@ const domObjects = [
'SelectorEngine'
]
-function build(plugin) {
+const build = async plugin => {
console.log(`Building ${plugin} plugin...`)
const { external, globals } = getConfigByPluginKey(plugin)
@@ -158,24 +158,32 @@ function build(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()