diff options
author | Mario <mario@mariovavti.com> | 2020-06-13 10:00:50 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2020-06-13 10:00:50 +0000 |
commit | dc3b09c8f38872ef8b792a4b551671a6105754cc (patch) | |
tree | 554f130cc2d5a00088cad6c9a75ae0a8f2d558f8 /vendor/twbs/bootstrap/build/build-plugins.js | |
parent | c8c4513af98a9dd2a6d9331ba4b3ab3af0e95a5f (diff) | |
download | volse-hubzilla-dc3b09c8f38872ef8b792a4b551671a6105754cc.tar.gz volse-hubzilla-dc3b09c8f38872ef8b792a4b551671a6105754cc.tar.bz2 volse-hubzilla-dc3b09c8f38872ef8b792a4b551671a6105754cc.zip |
composer update bootstrap
Diffstat (limited to 'vendor/twbs/bootstrap/build/build-plugins.js')
-rw-r--r-- | vendor/twbs/bootstrap/build/build-plugins.js | 58 |
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() |