diff options
author | Max Kostikov <max@kostikov.co> | 2020-07-19 14:58:19 +0200 |
---|---|---|
committer | Max Kostikov <max@kostikov.co> | 2020-07-19 14:58:19 +0200 |
commit | 5ea7196e78d08550b3ec93d3b708f915b3b0057f (patch) | |
tree | 07e5f865b6c83898d7ac508302a227509e8207fd /vendor/twbs/bootstrap/build | |
parent | d0c7c99d5e1eb27281431231640c7e8c019b90e1 (diff) | |
parent | fcc47e69e424635fa54b2684329623d4f7694436 (diff) | |
download | volse-hubzilla-5ea7196e78d08550b3ec93d3b708f915b3b0057f.tar.gz volse-hubzilla-5ea7196e78d08550b3ec93d3b708f915b3b0057f.tar.bz2 volse-hubzilla-5ea7196e78d08550b3ec93d3b708f915b3b0057f.zip |
Merge branch 'dev' into 'dev'
Dev sync
See merge request kostikov/core!1
Diffstat (limited to 'vendor/twbs/bootstrap/build')
-rw-r--r-- | vendor/twbs/bootstrap/build/.eslintrc.json | 1 | ||||
-rw-r--r-- | vendor/twbs/bootstrap/build/babel-helpers.js | 13 | ||||
-rw-r--r-- | vendor/twbs/bootstrap/build/build-plugins.js | 58 | ||||
-rw-r--r-- | vendor/twbs/bootstrap/build/change-version.js | 9 | ||||
-rw-r--r-- | vendor/twbs/bootstrap/build/generate-sri.js | 4 | ||||
-rw-r--r-- | vendor/twbs/bootstrap/build/rollup.config.js | 15 | ||||
-rw-r--r-- | vendor/twbs/bootstrap/build/ship.sh | 35 | ||||
-rw-r--r-- | vendor/twbs/bootstrap/build/vnu-jar.js | 6 | ||||
-rw-r--r-- | vendor/twbs/bootstrap/build/zip-examples.js | 63 |
9 files changed, 143 insertions, 61 deletions
diff --git a/vendor/twbs/bootstrap/build/.eslintrc.json b/vendor/twbs/bootstrap/build/.eslintrc.json index 76e7f37b6..e406f9f69 100644 --- a/vendor/twbs/bootstrap/build/.eslintrc.json +++ b/vendor/twbs/bootstrap/build/.eslintrc.json @@ -12,7 +12,6 @@ "func-style": "off", "no-console": "off", "no-magic-numbers": "off", - "no-process-env": "off", "no-process-exit": "off", "no-sync": "off", "spaced-comment": "off" diff --git a/vendor/twbs/bootstrap/build/babel-helpers.js b/vendor/twbs/bootstrap/build/babel-helpers.js new file mode 100644 index 000000000..d444628f6 --- /dev/null +++ b/vendor/twbs/bootstrap/build/babel-helpers.js @@ -0,0 +1,13 @@ +'use strict' + +// These are the babel helpers we whitelist +const helpers = [ + 'createClass', + 'createSuper', + 'defineProperties', + 'defineProperty', + 'inheritsLoose', + 'objectSpread2' +] + +module.exports = helpers 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() diff --git a/vendor/twbs/bootstrap/build/change-version.js b/vendor/twbs/bootstrap/build/change-version.js index f068e2a70..ec3c77857 100644 --- a/vendor/twbs/bootstrap/build/change-version.js +++ b/vendor/twbs/bootstrap/build/change-version.js @@ -2,8 +2,8 @@ /*! * Script to update version number references in the project. - * Copyright 2017-2019 The Bootstrap Authors - * Copyright 2017-2019 Twitter, Inc. + * Copyright 2017-2020 The Bootstrap Authors + * Copyright 2017-2020 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) */ @@ -17,11 +17,11 @@ sh.config.fatal = true // Blame TC39... https://github.com/benjamingr/RegExp.escape/issues/37 function regExpQuote(string) { - return string.replace(/[-\\^$*+?.()|[\]{}]/g, '\\$&') + return string.replace(/[$()*+.?[\\\]^{|}-]/g, '\\$&') } function regExpQuoteReplacement(string) { - return string.replace(/[$]/g, '$$') + return string.replace(/\$/g, '$$') } const DRY_RUN = false @@ -95,7 +95,6 @@ function main(args) { '.js', '.json', '.md', - '.nuspec', '.scss', '.txt', '.yml' diff --git a/vendor/twbs/bootstrap/build/generate-sri.js b/vendor/twbs/bootstrap/build/generate-sri.js index 66544d4ad..ca2920ef2 100644 --- a/vendor/twbs/bootstrap/build/generate-sri.js +++ b/vendor/twbs/bootstrap/build/generate-sri.js @@ -5,8 +5,8 @@ * Remember to use the same vendor files as the CDN ones, * otherwise the hashes won't match! * - * Copyright 2017-2019 The Bootstrap Authors - * Copyright 2017-2019 Twitter, Inc. + * Copyright 2017-2020 The Bootstrap Authors + * Copyright 2017-2020 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) */ diff --git a/vendor/twbs/bootstrap/build/rollup.config.js b/vendor/twbs/bootstrap/build/rollup.config.js index 0dfa5d48a..2d43194fe 100644 --- a/vendor/twbs/bootstrap/build/rollup.config.js +++ b/vendor/twbs/bootstrap/build/rollup.config.js @@ -2,8 +2,9 @@ const path = require('path') const babel = require('rollup-plugin-babel') -const resolve = require('rollup-plugin-node-resolve') +const resolve = require('@rollup/plugin-node-resolve') const banner = require('./banner.js') +const babelHelpers = require('./babel-helpers.js') const BUNDLE = process.env.BUNDLE === 'true' @@ -11,14 +12,10 @@ let fileDest = 'bootstrap.js' const external = ['jquery', 'popper.js'] 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 globals = { diff --git a/vendor/twbs/bootstrap/build/ship.sh b/vendor/twbs/bootstrap/build/ship.sh index 289284383..f1c5e38e3 100644 --- a/vendor/twbs/bootstrap/build/ship.sh +++ b/vendor/twbs/bootstrap/build/ship.sh @@ -1,4 +1,7 @@ #!/usr/bin/env bash + +set -e + # # Usage # --------------- @@ -18,35 +21,35 @@ end=$'\e[0m' current_version=$(node -p "require('./package.json').version") if [[ $# -lt 1 ]]; then - printf "\n%s⚠️ Shipping aborted. You must specify a version.\n%s" $red $end + printf "\n%s⚠️ Shipping aborted. You must specify a version.\n%s" "$red" "$end" exit 1 fi # Pulling latest changes, just to be sure -printf "\n%s=======================================================%s" $magenta $end -printf "\n%sPulling latest changes...%s" $magenta $end -printf "\n%s=======================================================\n\n%s" $magenta $end +printf "\n%s=======================================================%s" "$magenta" "$end" +printf "\n%sPulling latest changes...%s" "$magenta" "$end" +printf "\n%s=======================================================\n\n%s" "$magenta" "$end" git pull origin v4-dev # Update version number -printf "\n%s=======================================================%s" $magenta $end -printf "\n%sUpdating version number...%s" $magenta $end -printf "\n%s=======================================================\n%s" $magenta $end +printf "\n%s=======================================================%s" "$magenta" "$end" +printf "\n%sUpdating version number...%s" "$magenta" "$end" +printf "\n%s=======================================================\n%s" "$magenta" "$end" npm run release-version "$current_version" "$1" # Build release -printf "\n%s=======================================================%s" $magenta $end -printf "\n%sBuilding release...%s" $magenta $end -printf "\n%s=======================================================\n%s" $magenta $end +printf "\n%s=======================================================%s" "$magenta" "$end" +printf "\n%sBuilding release...%s" "$magenta" "$end" +printf "\n%s=======================================================\n%s" "$magenta" "$end" npm run release # Copy the contents of the built docs site over to `bs-docs` repo -printf "\n%s=======================================================%s" $magenta $end -printf "\n%sCopy it over...%s" $magenta $end -printf "\n%s=======================================================\n%s" $magenta $end +printf "\n%s=======================================================%s" "$magenta" "$end" +printf "\n%sCopy it over...%s" "$magenta" "$end" +printf "\n%s=======================================================\n%s" "$magenta" "$end" cp -rf _gh_pages/. ../bs-docs/ printf "\nDone!\n" -printf "\n%s=======================================================%s" $green $end -printf "\n%sSuccess, $1 is ready to review and publish.%s" $green $end -printf "\n%s=======================================================\n\n%s" $green $end +printf "\n%s=======================================================%s" "$green" "$end" +printf "\n%sSuccess, $1 is ready to review and publish.%s" "$green" "$end" +printf "\n%s=======================================================\n\n%s" "$green" "$end" diff --git a/vendor/twbs/bootstrap/build/vnu-jar.js b/vendor/twbs/bootstrap/build/vnu-jar.js index 8567ba89d..ebd027adc 100644 --- a/vendor/twbs/bootstrap/build/vnu-jar.js +++ b/vendor/twbs/bootstrap/build/vnu-jar.js @@ -2,8 +2,8 @@ /*! * Script to run vnu-jar if Java is available. - * Copyright 2017-2019 The Bootstrap Authors - * Copyright 2017-2019 Twitter, Inc. + * Copyright 2017-2020 The Bootstrap Authors + * Copyright 2017-2020 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) */ @@ -18,7 +18,7 @@ childProcess.exec('java -version', (error, stdout, stderr) => { return } - const is32bitJava = !stderr.match(/64-Bit/) + const is32bitJava = !/64-Bit/.test(stderr) // vnu-jar accepts multiple ignores joined with a `|`. // Also note that the ignores are regular expressions. diff --git a/vendor/twbs/bootstrap/build/zip-examples.js b/vendor/twbs/bootstrap/build/zip-examples.js new file mode 100644 index 000000000..3f7fb9abb --- /dev/null +++ b/vendor/twbs/bootstrap/build/zip-examples.js @@ -0,0 +1,63 @@ +#!/usr/bin/env node + +/*! + * Script to create the built examples zip archive; + * requires the `zip` command to be present! + * Copyright 2020 The Bootstrap Authors + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + */ + +'use strict' + +const path = require('path') +const sh = require('shelljs') + +const { + version, version_short: versionShort +} = require('../package.json') + +const folderName = `bootstrap-${version}-examples` + +sh.config.fatal = true + +if (!sh.test('-d', '_gh_pages')) { + throw new Error('The "_gh_pages" folder does not exist, did you forget building the docs?') +} + +// switch to the root dir +sh.cd(path.join(__dirname, '..')) + +// remove any previously created folder with the same name +sh.rm('-rf', folderName) +// create any folders so that `cp` works +sh.mkdir('-p', folderName) +sh.mkdir('-p', `${folderName}/assets/brand/`) + +sh.cp('-Rf', `_gh_pages/docs/${versionShort}/examples/*`, folderName) +sh.cp('-Rf', `_gh_pages/docs/${versionShort}/dist/`, `${folderName}/assets/`) +// also copy the two brand images we use in the examples +sh.cp('-f', [ + `_gh_pages/docs/${versionShort}/assets/brand/bootstrap-outline.svg`, + `_gh_pages/docs/${versionShort}/assets/brand/bootstrap-solid.svg` +], `${folderName}/assets/brand/`) +sh.rm(`${folderName}/index.html`) + +// get all examples' HTML files +sh.find(`${folderName}/**/*.html`).forEach((file) => { + const fileContents = sh.cat(file) + .toString() + .replace(new RegExp(`"/docs/${versionShort}/`, 'g'), '"../') + .replace(/"..\/dist\//g, '"../assets/dist/') + .replace(/(<link href="\.\.\/.*) integrity=".*>/g, '$1>') + .replace(/(<script src="\.\.\/.*) integrity=".*>/g, '$1></script>') + .replace(/( +)<!-- favicons(.|\n)+<style>/i, ' <style>') + new sh.ShellString(fileContents).to(file) +}) + +// create the zip file +sh.exec(`zip -r9 "${folderName}.zip" "${folderName}"`, { + fatal: true +}) + +// remove the folder we created +sh.rm('-rf', folderName) |