From c1d5a801b4bc66e3866f815be00e11d1b20d3539 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 24 Jun 2023 14:44:36 +0200 Subject: Adding upstream version 5.3.0+dfsg. Signed-off-by: Daniel Baumann --- build/.eslintrc.json | 15 --------------- build/banner.js | 1 + build/build-plugins.js | 7 +++---- build/change-version.js | 42 +++++++++++++++++++++++++++++++----------- build/generate-sri.js | 15 +++++++-------- build/rollup.config.js | 2 +- build/vnu-jar.js | 10 +++++++--- build/zip-examples.js | 4 ++-- 8 files changed, 52 insertions(+), 44 deletions(-) delete mode 100644 build/.eslintrc.json (limited to 'build') diff --git a/build/.eslintrc.json b/build/.eslintrc.json deleted file mode 100644 index dec6323..0000000 --- a/build/.eslintrc.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "env": { - "browser": false, - "node": true - }, - "parserOptions": { - "sourceType": "script" - }, - "extends": "../.eslintrc.json", - "rules": { - "no-console": "off", - "strict": "error", - "unicorn/prefer-top-level-await": "off" - } -} diff --git a/build/banner.js b/build/banner.js index df82ff3..a022f1c 100644 --- a/build/banner.js +++ b/build/banner.js @@ -1,6 +1,7 @@ 'use strict' const pkg = require('../package.json') + const year = new Date().getFullYear() function getBanner(pluginFilename) { diff --git a/build/build-plugins.js b/build/build-plugins.js index a160209..b2833a3 100644 --- a/build/build-plugins.js +++ b/build/build-plugins.js @@ -2,8 +2,7 @@ /*! * Script to build our plugins to use them separately. - * Copyright 2020-2022 The Bootstrap Authors - * Copyright 2020-2022 Twitter, Inc. + * Copyright 2020-2023 The Bootstrap Authors * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) */ @@ -16,7 +15,7 @@ const { babel } = require('@rollup/plugin-babel') const banner = require('./banner.js') const sourcePath = path.resolve(__dirname, '../js/src/').replace(/\\/g, '/') -const jsFiles = globby.sync(sourcePath + '/**/*.js') +const jsFiles = globby.sync(`${sourcePath}/**/*.js`) // Array which holds the resolved plugins const resolvedPlugins = [] @@ -27,7 +26,7 @@ const filenameToEntity = filename => filename.replace('.js', '') for (const file of jsFiles) { resolvedPlugins.push({ - src: file.replace('.js', ''), + src: file, dist: file.replace('src', 'dist'), fileName: path.basename(file), className: filenameToEntity(path.basename(file)) diff --git a/build/change-version.js b/build/change-version.js index 57c5fde..9685df5 100644 --- a/build/change-version.js +++ b/build/change-version.js @@ -2,8 +2,7 @@ /*! * Script to update version number references in the project. - * Copyright 2017-2022 The Bootstrap Authors - * Copyright 2017-2022 Twitter, Inc. + * Copyright 2017-2023 The Bootstrap Authors * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) */ @@ -36,9 +35,17 @@ function regExpQuoteReplacement(string) { async function replaceRecursively(file, oldVersion, newVersion) { const originalString = await fs.readFile(file, 'utf8') - const newString = originalString.replace( - new RegExp(regExpQuote(oldVersion), 'g'), regExpQuoteReplacement(newVersion) - ) + const newString = originalString + .replace( + new RegExp(regExpQuote(oldVersion), 'g'), + regExpQuoteReplacement(newVersion) + ) + // Also replace the version used by the rubygem, + // which is using periods (`.`) instead of hyphens (`-`) + .replace( + new RegExp(regExpQuote(oldVersion.replace(/-/g, '.')), 'g'), + regExpQuoteReplacement(newVersion.replace(/-/g, '.')) + ) // No need to move any further if the strings are identical if (originalString === newString) { @@ -56,22 +63,35 @@ async function replaceRecursively(file, oldVersion, newVersion) { await fs.writeFile(file, newString, 'utf8') } +function showUsage(args) { + console.error('USAGE: change-version old_version new_version [--verbose] [--dry[-run]]') + console.error('Got arguments:', args) + process.exit(1) +} + async function main(args) { let [oldVersion, newVersion] = args if (!oldVersion || !newVersion) { - console.error('USAGE: change-version old_version new_version [--verbose] [--dry[-run]]') - console.error('Got arguments:', args) - process.exit(1) + showUsage(args) } - // Strip any leading `v` from arguments because otherwise we will end up with duplicate `v`s - [oldVersion, newVersion] = [oldVersion, newVersion].map(arg => arg.startsWith('v') ? arg.slice(1) : arg) + // Strip any leading `v` from arguments because + // otherwise we will end up with duplicate `v`s + [oldVersion, newVersion] = [oldVersion, newVersion].map(arg => { + return arg.startsWith('v') ? arg.slice(1) : arg + }) + + if (oldVersion === newVersion) { + showUsage(args) + } try { const files = await globby(GLOB, GLOBBY_OPTIONS) - await Promise.all(files.map(file => replaceRecursively(file, oldVersion, newVersion))) + await Promise.all( + files.map(file => replaceRecursively(file, oldVersion, newVersion)) + ) } catch (error) { console.error(error) process.exit(1) diff --git a/build/generate-sri.js b/build/generate-sri.js index ef1b39f..2e22924 100644 --- a/build/generate-sri.js +++ b/build/generate-sri.js @@ -5,8 +5,7 @@ * Remember to use the same vendor files as the CDN ones, * otherwise the hashes won't match! * - * Copyright 2017-2022 The Bootstrap Authors - * Copyright 2017-2022 Twitter, Inc. + * Copyright 2017-2023 The Bootstrap Authors * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) */ @@ -19,11 +18,11 @@ const sh = require('shelljs') sh.config.fatal = true -const configFile = path.join(__dirname, '../config.yml') +const configFile = path.join(__dirname, '../hugo.yml') // Array of objects which holds the files to generate SRI hashes for. // `file` is the path from the root folder -// `configPropertyName` is the config.yml variable's name of the file +// `configPropertyName` is the hugo.yml variable's name of the file const files = [ { file: 'dist/css/bootstrap.min.css', @@ -47,8 +46,8 @@ const files = [ } ] -for (const file of files) { - fs.readFile(file.file, 'utf8', (error, data) => { +for (const { file, configPropertyName } of files) { + fs.readFile(file, 'utf8', (error, data) => { if (error) { throw error } @@ -57,8 +56,8 @@ for (const file of files) { const hash = crypto.createHash(algo).update(data, 'utf8').digest('base64') const integrity = `${algo}-${hash}` - console.log(`${file.configPropertyName}: ${integrity}`) + console.log(`${configPropertyName}: ${integrity}`) - sh.sed('-i', new RegExp(`^(\\s+${file.configPropertyName}:\\s+["'])\\S*(["'])`), `$1${integrity}$2`, configFile) + sh.sed('-i', new RegExp(`^(\\s+${configPropertyName}:\\s+["'])\\S*(["'])`), `$1${integrity}$2`, configFile) }) } diff --git a/build/rollup.config.js b/build/rollup.config.js index 27f12ac..f01918e 100644 --- a/build/rollup.config.js +++ b/build/rollup.config.js @@ -40,7 +40,7 @@ if (BUNDLE) { const rollupConfig = { input: path.resolve(__dirname, `../js/index.${ESM ? 'esm' : 'umd'}.js`), output: { - banner, + banner: banner(), file: path.resolve(__dirname, `../dist/js/${fileDestination}.js`), format: ESM ? 'esm' : 'umd', globals, diff --git a/build/vnu-jar.js b/build/vnu-jar.js index f29eeb7..22956cb 100644 --- a/build/vnu-jar.js +++ b/build/vnu-jar.js @@ -2,8 +2,7 @@ /*! * Script to run vnu-jar if Java is available. - * Copyright 2017-2022 The Bootstrap Authors - * Copyright 2017-2022 Twitter, Inc. + * Copyright 2017-2023 The Bootstrap Authors * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) */ @@ -14,10 +13,13 @@ const vnu = require('vnu-jar') execFile('java', ['-version'], (error, stdout, stderr) => { if (error) { - console.error('Skipping vnu-jar test; Java is missing.') + console.error('Skipping vnu-jar test; Java is probably missing.') + console.error(error) return } + console.log('Running vnu-jar validation...') + const is32bitJava = !/64-Bit/.test(stderr) // vnu-jar accepts multiple ignores joined with a `|`. @@ -49,6 +51,8 @@ execFile('java', ['-version'], (error, stdout, stderr) => { args.splice(0, 0, '-Xss512k') } + console.log(`command used: java ${args.join(' ')}`) + return spawn('java', args, { shell: true, stdio: 'inherit' diff --git a/build/zip-examples.js b/build/zip-examples.js index 077901e..613376a 100644 --- a/build/zip-examples.js +++ b/build/zip-examples.js @@ -3,7 +3,7 @@ /*! * Script to create the built examples zip archive; * requires the `zip` command to be present! - * Copyright 2020-2022 The Bootstrap Authors + * Copyright 2020-2023 The Bootstrap Authors * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) */ @@ -84,7 +84,7 @@ for (const file of sh.find(`${distFolder}/**/*.html`)) { } // create the zip file -sh.exec(`zip -r9 "${distFolder}.zip" "${distFolder}"`) +sh.exec(`zip -qr9 "${distFolder}.zip" "${distFolder}"`) // remove the folder we created sh.rm('-rf', distFolder) -- cgit v1.2.3