From 0cbe6a013289b1c4a9786149f924b4124e63d07d Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Tue, 12 Jan 2021 16:46:24 +0200 Subject: [PATCH 01/23] Tweak change-version.js --- build/change-version.js | 44 ++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/build/change-version.js b/build/change-version.js index 8086ed774..97e2edbb2 100644 --- a/build/change-version.js +++ b/build/change-version.js @@ -15,6 +15,11 @@ const sh = require('shelljs') sh.config.fatal = true +const VERBOSE = process.argv.includes('--verbose') +const DRY_RUN = process.argv.includes('--dry') || process.argv.includes('--dry-run') + +const ROOT_DIR = path.join(__dirname, '..') + // Blame TC39... https://github.com/benjamingr/RegExp.escape/issues/37 function regExpQuote(string) { return string.replace(/[$()*+-.?[\\\]^{|}]/g, '\\$&') @@ -24,8 +29,6 @@ function regExpQuoteReplacement(string) { return string.replace(/\$/g, '$$') } -const DRY_RUN = false - function walkAsync(directory, excludedDirectories, fileCallback, errback) { if (excludedDirectories.has(path.parse(directory).base)) { return @@ -56,21 +59,21 @@ function walkAsync(directory, excludedDirectories, fileCallback, errback) { } function replaceRecursively(directory, excludedDirectories, allowedExtensions, original, replacement) { - original = new RegExp(regExpQuote(original), 'g') - replacement = regExpQuoteReplacement(replacement) - const updateFile = DRY_RUN ? - filepath => { - if (allowedExtensions.has(path.parse(filepath).ext)) { + const updateFile = filepath => { + if (allowedExtensions.has(path.parse(filepath).ext)) { + if (VERBOSE) { console.log(`FILE: ${filepath}`) - } else { - console.log(`EXCLUDED:${filepath}`) } - } : - filepath => { - if (allowedExtensions.has(path.parse(filepath).ext)) { - sh.sed('-i', original, replacement, filepath) + + if (DRY_RUN) { + return } + + sh.sed('-i', new RegExp(regExpQuote(original), 'g'), regExpQuoteReplacement(replacement), filepath) + } else if (VERBOSE) { + console.log(`EXCLUDED: ${filepath}`) } + } walkAsync(directory, excludedDirectories, updateFile, err => { console.error('ERROR while traversing directory!:') @@ -80,22 +83,22 @@ function replaceRecursively(directory, excludedDirectories, allowedExtensions, o } function main(args) { - if (args.length !== 2) { - console.error('USAGE: change-version old_version new_version') + const [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) } - const oldVersion = args[0] - const newVersion = args[1] const EXCLUDED_DIRS = new Set([ '.git', '_gh_pages', 'node_modules', - 'vendor' + 'resources' ]) const INCLUDED_EXTENSIONS = new Set([ - // This extension allowlist is how we avoid modifying binary files + // This extensions list is how we avoid modifying binary files '', '.css', '.html', @@ -106,7 +109,8 @@ function main(args) { '.txt', '.yml' ]) - replaceRecursively('.', EXCLUDED_DIRS, INCLUDED_EXTENSIONS, oldVersion, newVersion) + + replaceRecursively(ROOT_DIR, EXCLUDED_DIRS, INCLUDED_EXTENSIONS, oldVersion, newVersion) } main(process.argv.slice(2)) From 55b081606027612a9e24460d7704ff595bd4d462 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Tue, 12 Jan 2021 17:36:28 +0200 Subject: [PATCH 02/23] Remove shelljs --- build/change-version.js | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/build/change-version.js b/build/change-version.js index 97e2edbb2..abd7a288a 100644 --- a/build/change-version.js +++ b/build/change-version.js @@ -11,9 +11,6 @@ const fs = require('fs') const path = require('path') -const sh = require('shelljs') - -sh.config.fatal = true const VERBOSE = process.argv.includes('--verbose') const DRY_RUN = process.argv.includes('--dry') || process.argv.includes('--dry-run') @@ -60,7 +57,29 @@ function walkAsync(directory, excludedDirectories, fileCallback, errback) { function replaceRecursively(directory, excludedDirectories, allowedExtensions, original, replacement) { const updateFile = filepath => { - if (allowedExtensions.has(path.parse(filepath).ext)) { + if (!allowedExtensions.has(path.parse(filepath).ext) && VERBOSE) { + console.log(`EXCLUDED: ${filepath}`) + return + } + + fs.readFile(filepath, 'utf8', (error, originalData) => { + if (error) { + throw error + } + + const newData = originalData.replace( + new RegExp(regExpQuote(original), 'g'), + regExpQuoteReplacement(replacement) + ) + + if (originalData === newData) { + if (VERBOSE) { + console.log(`SKIPPED: ${filepath}`) + } + + return + } + if (VERBOSE) { console.log(`FILE: ${filepath}`) } @@ -69,10 +88,12 @@ function replaceRecursively(directory, excludedDirectories, allowedExtensions, o return } - sh.sed('-i', new RegExp(regExpQuote(original), 'g'), regExpQuoteReplacement(replacement), filepath) - } else if (VERBOSE) { - console.log(`EXCLUDED: ${filepath}`) - } + fs.writeFile(filepath, newData, 'utf8', err => { + if (err) { + throw err + } + }) + }) } walkAsync(directory, excludedDirectories, updateFile, err => { From ed5ddca5ba6436a6234e1b9dfa0883382c84f0db Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Wed, 13 Jan 2021 10:52:41 +0200 Subject: [PATCH 03/23] Stylelint: disallow some property values (#32756) * `border: none` * `outline: none` --- .stylelintrc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.stylelintrc b/.stylelintrc index 1c9ee1811..c068d30b5 100644 --- a/.stylelintrc +++ b/.stylelintrc @@ -3,6 +3,10 @@ "stylelint-config-twbs-bootstrap/scss" ], "rules": { + "declaration-property-value-disallowed-list": { + "border": "none", + "outline": "none" + }, "function-disallowed-list": [ "calc", "lighten", From f43133ac412eb47111d09e89750a130cc79b9835 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Wed, 13 Jan 2021 13:20:49 +0200 Subject: [PATCH 04/23] .gitignore: remove Ruby/Jekyll entries (#32770) Our currently supported branches, v4-dev and main, use Hugo. --- .gitignore | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/.gitignore b/.gitignore index 6208c57d7..0a0f88d15 100644 --- a/.gitignore +++ b/.gitignore @@ -1,19 +1,8 @@ # Ignore docs files /_gh_pages/ -# This is the old Jekyll docs dist folder; -# keeping it here so that when we switch branches it doesn't show up -/site/docs/**/dist/ -# Jekyll's cache folder; keeping it for the same reason as above -/site/.jekyll-cache/ # Hugo resources folder /resources/ -# Ignore ruby/bundler files; -# keeping them here so that when we switch branches they don't show up -/.bundle/ -/vendor/ -/.ruby-version - # Numerous always-ignore extensions *.diff *.err From 408b2558dcdacfbe5754103519e5d67d9c1c149b Mon Sep 17 00:00:00 2001 From: Marcin Kasperski Date: Wed, 13 Jan 2021 18:05:25 +0100 Subject: [PATCH 05/23] Update toasts.md (#32782) * dropped mention of `backdrop-filter` * changed mention of `.text-white` to `.btn-close-white` on close button --- site/content/docs/5.0/components/toasts.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/site/content/docs/5.0/components/toasts.md b/site/content/docs/5.0/components/toasts.md index b6f7e3893..bd7bcae9c 100644 --- a/site/content/docs/5.0/components/toasts.md +++ b/site/content/docs/5.0/components/toasts.md @@ -43,7 +43,7 @@ Toasts are as flexible as you need and have very little required markup. At a mi ### Translucent -Toasts are slightly translucent, too, so they blend over whatever they might appear over. For browsers that support the `backdrop-filter` CSS property, we'll also attempt to blur the elements under a toast. +Toasts are slightly translucent, too, so they blend over whatever they might appear over. {{< example class="bg-dark" >}}