aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/twbs/bootstrap/build/build-plugins.js
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2020-06-14 15:39:00 +0200
committerMario Vavti <mario@mariovavti.com>2020-06-14 15:39:00 +0200
commit7270da6a28f836f94f6d98557df9532e587c3646 (patch)
tree86bc0a8d3956ae4bff86dcbb96bb3b88b68e5daa /vendor/twbs/bootstrap/build/build-plugins.js
parent8cd66145bdd8bf0f43c2a1774181c974335fc494 (diff)
parent92ee27349cb62e0a78f25686c3fe64cd8dd4130c (diff)
downloadvolse-hubzilla-7270da6a28f836f94f6d98557df9532e587c3646.tar.gz
volse-hubzilla-7270da6a28f836f94f6d98557df9532e587c3646.tar.bz2
volse-hubzilla-7270da6a28f836f94f6d98557df9532e587c3646.zip
Merge branch 'dev' of https://framagit.org/hubzilla/core into dev
Diffstat (limited to 'vendor/twbs/bootstrap/build/build-plugins.js')
-rw-r--r--vendor/twbs/bootstrap/build/build-plugins.js58
1 files changed, 33 insertions, 25 deletions
diff --git a/vendor/twbs/bootstrap/build/build-plugins.js b/vendor/twbs/bootstrap/build/build-plugins.js
index 877621636..9e4f2e1c3 100644
--- a/vendor/twbs/bootstrap/build/build-plugins.js
+++ b/vendor/twbs/bootstrap/build/build-plugins.js
@@ -1,7 +1,9 @@
+#!/usr/bin/env node
+
/*!
* Script to build our plugins to use them separately.
- * Copyright 2019 The Bootstrap Authors
- * Copyright 2019 Twitter, Inc.
+ * Copyright 2020 The Bootstrap Authors
+ * Copyright 2020 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
@@ -11,18 +13,15 @@ const path = require('path')
const rollup = require('rollup')
const babel = require('rollup-plugin-babel')
const banner = require('./banner.js')
+const babelHelpers = require('./babel-helpers.js')
const TEST = process.env.NODE_ENV === 'test'
const plugins = [
babel({
- exclude: 'node_modules/**', // Only transpile our source code
- externalHelpersWhitelist: [ // Include only required helpers
- 'defineProperties',
- 'createClass',
- 'inheritsLoose',
- 'defineProperty',
- 'objectSpread2'
- ]
+ // Only transpile our source code
+ exclude: 'node_modules/**',
+ // Include only required helpers
+ externalHelpersWhitelist: babelHelpers
})
]
const bsPlugins = {
@@ -41,7 +40,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']
@@ -63,23 +62,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()