summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-06-24 12:44:40 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-06-24 12:44:49 +0000
commitdb46bfc03f3a22752ef6bd91ae577d893872a216 (patch)
tree89d924513bc95e6bac4dc8e26f0da84caa477b7b /build
parentReleasing debian version 5.2.3+dfsg-8. (diff)
downloadbootstrap-html-db46bfc03f3a22752ef6bd91ae577d893872a216.tar.xz
bootstrap-html-db46bfc03f3a22752ef6bd91ae577d893872a216.zip
Merging upstream version 5.3.0+dfsg.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'build')
-rw-r--r--build/.eslintrc.json15
-rw-r--r--build/banner.js1
-rw-r--r--build/build-plugins.js7
-rw-r--r--build/change-version.js42
-rw-r--r--build/generate-sri.js15
-rw-r--r--build/rollup.config.js2
-rw-r--r--build/vnu-jar.js10
-rw-r--r--build/zip-examples.js4
8 files changed, 52 insertions, 44 deletions
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)