diff options
Diffstat (limited to 'vendor/twbs/bootstrap/build')
-rw-r--r-- | vendor/twbs/bootstrap/build/banner.mjs (renamed from vendor/twbs/bootstrap/build/banner.js) | 11 | ||||
-rw-r--r-- | vendor/twbs/bootstrap/build/build-plugins.mjs (renamed from vendor/twbs/bootstrap/build/build-plugins.js) | 16 | ||||
-rw-r--r-- | vendor/twbs/bootstrap/build/change-version.mjs (renamed from vendor/twbs/bootstrap/build/change-version.js) | 44 | ||||
-rw-r--r-- | vendor/twbs/bootstrap/build/generate-sri.mjs (renamed from vendor/twbs/bootstrap/build/generate-sri.js) | 17 | ||||
-rw-r--r-- | vendor/twbs/bootstrap/build/postcss.config.mjs (renamed from vendor/twbs/bootstrap/build/postcss.config.js) | 4 | ||||
-rw-r--r-- | vendor/twbs/bootstrap/build/rollup.config.mjs (renamed from vendor/twbs/bootstrap/build/rollup.config.js) | 22 | ||||
-rw-r--r-- | vendor/twbs/bootstrap/build/vnu-jar.mjs (renamed from vendor/twbs/bootstrap/build/vnu-jar.js) | 6 | ||||
-rw-r--r-- | vendor/twbs/bootstrap/build/zip-examples.mjs (renamed from vendor/twbs/bootstrap/build/zip-examples.js) | 21 |
8 files changed, 85 insertions, 56 deletions
diff --git a/vendor/twbs/bootstrap/build/banner.js b/vendor/twbs/bootstrap/build/banner.mjs index a022f1c48..3fea93c8f 100644 --- a/vendor/twbs/bootstrap/build/banner.js +++ b/vendor/twbs/bootstrap/build/banner.mjs @@ -1,6 +1,11 @@ -'use strict' +import fs from 'node:fs/promises' +import path from 'node:path' +import { fileURLToPath } from 'node:url' -const pkg = require('../package.json') +const __dirname = path.dirname(fileURLToPath(import.meta.url)) + +const pkgJson = path.join(__dirname, '../package.json') +const pkg = JSON.parse(await fs.readFile(pkgJson, 'utf8')) const year = new Date().getFullYear() @@ -12,4 +17,4 @@ function getBanner(pluginFilename) { */` } -module.exports = getBanner +export default getBanner diff --git a/vendor/twbs/bootstrap/build/build-plugins.js b/vendor/twbs/bootstrap/build/build-plugins.mjs index b2833a3fb..77e63070c 100644 --- a/vendor/twbs/bootstrap/build/build-plugins.js +++ b/vendor/twbs/bootstrap/build/build-plugins.mjs @@ -6,13 +6,15 @@ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) */ -'use strict' +import path from 'node:path' +import { fileURLToPath } from 'node:url' +import { babel } from '@rollup/plugin-babel' +import globby from 'globby' +import { rollup } from 'rollup' +import banner from './banner.mjs' -const path = require('node:path') -const rollup = require('rollup') -const globby = require('globby') -const { babel } = require('@rollup/plugin-babel') -const banner = require('./banner.js') +const __filename = fileURLToPath(import.meta.url) +const __dirname = path.dirname(fileURLToPath(import.meta.url)) const sourcePath = path.resolve(__dirname, '../js/src/').replace(/\\/g, '/') const jsFiles = globby.sync(`${sourcePath}/**/*.js`) @@ -37,7 +39,7 @@ for (const file of jsFiles) { const build = async plugin => { const globals = {} - const bundle = await rollup.rollup({ + const bundle = await rollup({ input: plugin.src, plugins: [ babel({ diff --git a/vendor/twbs/bootstrap/build/change-version.js b/vendor/twbs/bootstrap/build/change-version.mjs index 9685df589..3c1e70668 100644 --- a/vendor/twbs/bootstrap/build/change-version.js +++ b/vendor/twbs/bootstrap/build/change-version.mjs @@ -6,23 +6,22 @@ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) */ -'use strict' - -const fs = require('node:fs').promises -const path = require('node:path') -const globby = require('globby') +import { execFile } from 'node:child_process' +import fs from 'node:fs/promises' +import process from 'node:process' const VERBOSE = process.argv.includes('--verbose') const DRY_RUN = process.argv.includes('--dry') || process.argv.includes('--dry-run') -// These are the filetypes we only care about replacing the version -const GLOB = [ - '**/*.{css,html,js,json,md,scss,txt,yml}' +// These are the files we only care about replacing the version +const FILES = [ + 'README.md', + 'hugo.yml', + 'js/src/base-component.js', + 'package.js', + 'scss/mixins/_banner.scss', + 'site/data/docs-versions.yml' ] -const GLOBBY_OPTIONS = { - cwd: path.join(__dirname, '..'), - gitignore: true -} // Blame TC39... https://github.com/benjamingr/RegExp.escape/issues/37 function regExpQuote(string) { @@ -53,7 +52,7 @@ async function replaceRecursively(file, oldVersion, newVersion) { } if (VERBOSE) { - console.log(`FILE: ${file}`) + console.log(`Found ${oldVersion} in ${file}`) } if (DRY_RUN) { @@ -63,6 +62,19 @@ async function replaceRecursively(file, oldVersion, newVersion) { await fs.writeFile(file, newString, 'utf8') } +function bumpNpmVersion(newVersion) { + if (DRY_RUN) { + return + } + + execFile('npm', ['version', newVersion, '--no-git-tag'], { shell: true }, error => { + if (error) { + console.error(error) + process.exit(1) + } + }) +} + function showUsage(args) { console.error('USAGE: change-version old_version new_version [--verbose] [--dry[-run]]') console.error('Got arguments:', args) @@ -86,11 +98,11 @@ async function main(args) { showUsage(args) } - try { - const files = await globby(GLOB, GLOBBY_OPTIONS) + bumpNpmVersion(newVersion) + try { await Promise.all( - files.map(file => replaceRecursively(file, oldVersion, newVersion)) + FILES.map(file => replaceRecursively(file, oldVersion, newVersion)) ) } catch (error) { console.error(error) diff --git a/vendor/twbs/bootstrap/build/generate-sri.js b/vendor/twbs/bootstrap/build/generate-sri.mjs index 2e2292475..e2b1554f1 100644 --- a/vendor/twbs/bootstrap/build/generate-sri.js +++ b/vendor/twbs/bootstrap/build/generate-sri.mjs @@ -9,12 +9,13 @@ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) */ -'use strict' +import crypto from 'node:crypto' +import fs from 'node:fs' +import path from 'node:path' +import { fileURLToPath } from 'node:url' +import sh from 'shelljs' -const crypto = require('node:crypto') -const fs = require('node:fs') -const path = require('node:path') -const sh = require('shelljs') +const __dirname = path.dirname(fileURLToPath(import.meta.url)) sh.config.fatal = true @@ -52,9 +53,9 @@ for (const { file, configPropertyName } of files) { throw error } - const algo = 'sha384' - const hash = crypto.createHash(algo).update(data, 'utf8').digest('base64') - const integrity = `${algo}-${hash}` + const algorithm = 'sha384' + const hash = crypto.createHash(algorithm).update(data, 'utf8').digest('base64') + const integrity = `${algorithm}-${hash}` console.log(`${configPropertyName}: ${integrity}`) diff --git a/vendor/twbs/bootstrap/build/postcss.config.js b/vendor/twbs/bootstrap/build/postcss.config.mjs index 7f8186d10..7717cfc3f 100644 --- a/vendor/twbs/bootstrap/build/postcss.config.js +++ b/vendor/twbs/bootstrap/build/postcss.config.mjs @@ -1,12 +1,10 @@ -'use strict' - const mapConfig = { inline: false, annotation: true, sourcesContent: true } -module.exports = context => { +export default context => { return { map: context.file.dirname.includes('examples') ? false : mapConfig, plugins: { diff --git a/vendor/twbs/bootstrap/build/rollup.config.js b/vendor/twbs/bootstrap/build/rollup.config.mjs index f01918ebf..dd6c7d13e 100644 --- a/vendor/twbs/bootstrap/build/rollup.config.js +++ b/vendor/twbs/bootstrap/build/rollup.config.mjs @@ -1,15 +1,17 @@ -'use strict' +import path from 'node:path' +import process from 'node:process' +import { fileURLToPath } from 'node:url' +import { babel } from '@rollup/plugin-babel' +import { nodeResolve } from '@rollup/plugin-node-resolve' +import replace from '@rollup/plugin-replace' +import banner from './banner.mjs' -const path = require('node:path') -const { babel } = require('@rollup/plugin-babel') -const { nodeResolve } = require('@rollup/plugin-node-resolve') -const replace = require('@rollup/plugin-replace') -const banner = require('./banner.js') +const __dirname = path.dirname(fileURLToPath(import.meta.url)) const BUNDLE = process.env.BUNDLE === 'true' const ESM = process.env.ESM === 'true' -let fileDestination = `bootstrap${ESM ? '.esm' : ''}` +let destinationFile = `bootstrap${ESM ? '.esm' : ''}` const external = ['@popperjs/core'] const plugins = [ babel({ @@ -24,7 +26,7 @@ const globals = { } if (BUNDLE) { - fileDestination += '.bundle' + destinationFile += '.bundle' // Remove last entry in external array to bundle Popper external.pop() delete globals['@popperjs/core'] @@ -41,7 +43,7 @@ const rollupConfig = { input: path.resolve(__dirname, `../js/index.${ESM ? 'esm' : 'umd'}.js`), output: { banner: banner(), - file: path.resolve(__dirname, `../dist/js/${fileDestination}.js`), + file: path.resolve(__dirname, `../dist/js/${destinationFile}.js`), format: ESM ? 'esm' : 'umd', globals, generatedCode: 'es2015' @@ -54,4 +56,4 @@ if (!ESM) { rollupConfig.output.name = 'bootstrap' } -module.exports = rollupConfig +export default rollupConfig diff --git a/vendor/twbs/bootstrap/build/vnu-jar.js b/vendor/twbs/bootstrap/build/vnu-jar.mjs index 22956cb7e..b66356032 100644 --- a/vendor/twbs/bootstrap/build/vnu-jar.js +++ b/vendor/twbs/bootstrap/build/vnu-jar.mjs @@ -6,10 +6,8 @@ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) */ -'use strict' - -const { execFile, spawn } = require('node:child_process') -const vnu = require('vnu-jar') +import { execFile, spawn } from 'node:child_process' +import vnu from 'vnu-jar' execFile('java', ['-version'], (error, stdout, stderr) => { if (error) { diff --git a/vendor/twbs/bootstrap/build/zip-examples.js b/vendor/twbs/bootstrap/build/zip-examples.mjs index 613376a97..6b44d45b1 100644 --- a/vendor/twbs/bootstrap/build/zip-examples.js +++ b/vendor/twbs/bootstrap/build/zip-examples.mjs @@ -7,12 +7,15 @@ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) */ -'use strict' +import fs from 'node:fs/promises' +import path from 'node:path' +import { fileURLToPath } from 'node:url' +import sh from 'shelljs' -const path = require('node:path') -const sh = require('shelljs') +const __dirname = path.dirname(fileURLToPath(import.meta.url)) -const pkg = require('../package.json') +const pkgJson = path.join(__dirname, '../package.json') +const pkg = JSON.parse(await fs.readFile(pkgJson, 'utf8')) const versionShort = pkg.config.version_short const distFolder = `bootstrap-${pkg.version}-examples` @@ -34,6 +37,9 @@ const imgFiles = [ 'bootstrap-logo.svg', 'bootstrap-logo-white.svg' ] +const staticJsFiles = [ + 'color-modes.js' +] sh.config.fatal = true @@ -52,7 +58,8 @@ sh.mkdir('-p', [ distFolder, `${distFolder}/assets/brand/`, `${distFolder}/assets/dist/css/`, - `${distFolder}/assets/dist/js/` + `${distFolder}/assets/dist/js/`, + `${distFolder}/assets/js/` ]) sh.cp('-Rf', `${docsDir}/examples/*`, distFolder) @@ -69,6 +76,10 @@ for (const file of imgFiles) { sh.cp('-f', `${docsDir}/assets/brand/${file}`, `${distFolder}/assets/brand/`) } +for (const file of staticJsFiles) { + sh.cp('-f', `${docsDir}/assets/js/${file}`, `${distFolder}/assets/js/`) +} + sh.rm(`${distFolder}/index.html`) // get all examples' HTML files |