Skip to content

Commit

Permalink
chore(merge main): latest patched commit → 220139a
Browse files Browse the repository at this point in the history
  • Loading branch information
LE DIOURON Kevin committed Mar 29, 2021
1 parent bca3a33 commit b63960a
Show file tree
Hide file tree
Showing 129 changed files with 18,771 additions and 3,309 deletions.
8 changes: 2 additions & 6 deletions .browserslistrc
Expand Up @@ -5,11 +5,7 @@ last 2 major versions
not dead
Chrome >= 60
Firefox >= 60
# needed since Legacy Edge still has usage; 79 was the first Chromium Edge version
# should be removed in the future when its usage drops or when it's moved to dead browsers
not Edge < 79
Firefox ESR
iOS >= 10
Safari >= 10
Android >= 6
iOS >= 12
Safari >= 12
not Explorer <= 11
4 changes: 2 additions & 2 deletions .bundlewatch.config.json
Expand Up @@ -26,11 +26,11 @@
},
{
"path": "./dist/css/boosted.css",
"maxSize": "26.6 kB"
"maxSize": "26.7 kB"
},
{
"path": "./dist/css/boosted.min.css",
"maxSize": "24.3 kB"
"maxSize": "24.4 kB"
},
{
"path": "./dist/js/boosted.bundle.js",
Expand Down
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Expand Up @@ -34,7 +34,7 @@ This Code of Conduct applies both within project spaces and in public spaces whe

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at mdo@getbootstrap.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at kevin.lediouron.ext@orange.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.

Expand Down
4 changes: 2 additions & 2 deletions build/build-plugins.js
Expand Up @@ -35,7 +35,7 @@ const bsPlugins = {
Collapse: path.resolve(__dirname, '../js/src/collapse.js'),
Dropdown: path.resolve(__dirname, '../js/src/dropdown.js'),
Modal: path.resolve(__dirname, '../js/src/modal.js'),
OffCanvas: path.resolve(__dirname, '../js/src/offcanvas.js'),
Offcanvas: path.resolve(__dirname, '../js/src/offcanvas.js'),
Popover: path.resolve(__dirname, '../js/src/popover.js'),
ScrollSpy: path.resolve(__dirname, '../js/src/scrollspy.js'),
Tab: path.resolve(__dirname, '../js/src/tab.js'),
Expand Down Expand Up @@ -72,7 +72,7 @@ const getConfigByPluginKey = pluginKey => {
}
}

if (pluginKey === 'Alert' || pluginKey === 'Tab' || pluginKey === 'OffCanvas') {
if (pluginKey === 'Alert' || pluginKey === 'Tab' || pluginKey === 'Offcanvas') {
return defaultPluginConfig
}

Expand Down
121 changes: 45 additions & 76 deletions build/change-version.js
Expand Up @@ -9,11 +9,21 @@

'use strict'

const fs = require('fs')
const fs = require('fs').promises
const path = require('path')
const sh = require('shelljs')

sh.config.fatal = true
const globby = require('globby')

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}'
]
const GLOBBY_OPTIONS = {
cwd: path.join(__dirname, '..'),
gitignore: true
}

// Blame TC39... https://github.com/benjamingr/RegExp.escape/issues/37
function regExpQuote(string) {
Expand All @@ -24,89 +34,48 @@ function regExpQuoteReplacement(string) {
return string.replace(/\$/g, '$$')
}

const DRY_RUN = false
async function replaceRecursively(file, oldVersion, newVersion) {
const originalString = await fs.readFile(file, 'utf8')
const newString = originalString.replace(
new RegExp(regExpQuote(oldVersion), 'g'), regExpQuoteReplacement(newVersion)
)

function walkAsync(directory, excludedDirectories, fileCallback, errback) {
if (excludedDirectories.has(path.parse(directory).base)) {
// No need to move any further if the strings are identical
if (originalString === newString) {
return
}

fs.readdir(directory, (err, names) => {
if (err) {
errback(err)
return
}

names.forEach(name => {
const filepath = path.join(directory, name)
fs.lstat(filepath, (err, stats) => {
if (err) {
process.nextTick(errback, err)
return
}

if (stats.isDirectory()) {
process.nextTick(walkAsync, filepath, excludedDirectories, fileCallback, errback)
} else if (stats.isFile()) {
process.nextTick(fileCallback, filepath)
}
})
})
})
}
if (VERBOSE) {
console.log(`FILE: ${file}`)
}

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)) {
console.log(`FILE: ${filepath}`)
} else {
console.log(`EXCLUDED:${filepath}`)
}
} :
filepath => {
if (allowedExtensions.has(path.parse(filepath).ext)) {
sh.sed('-i', original, replacement, filepath)
}
}

walkAsync(directory, excludedDirectories, updateFile, err => {
console.error('ERROR while traversing directory!:')
console.error(err)
process.exit(1)
})
if (DRY_RUN) {
return
}

await fs.writeFile(file, newString, 'utf8')
}

function main(args) {
if (args.length !== 2) {
console.error('USAGE: change-version old_version new_version')
async function main(args) {
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',
'_site',
'node_modules',
'resources'
])
const INCLUDED_EXTENSIONS = new Set([
// This extension allowlist is how we avoid modifying binary files
'',
'.css',
'.html',
'.js',
'.json',
'.md',
'.scss',
'.txt',
'.yml'
])
replaceRecursively('.', EXCLUDED_DIRS, INCLUDED_EXTENSIONS, oldVersion, newVersion)
// Strip any leading `v` from arguments because otherwise we will end up with duplicate `v`s
[oldVersion, newVersion].map(arg => arg.startsWith('v') ? arg.slice(1) : arg)

try {
const files = await globby(GLOB, GLOBBY_OPTIONS)

await Promise.all(files.map(file => replaceRecursively(file, oldVersion, newVersion)))
} catch (error) {
console.error(error)
process.exit(1)
}
}

main(process.argv.slice(2))
8 changes: 7 additions & 1 deletion build/rollup.config.js
Expand Up @@ -28,7 +28,13 @@ if (BUNDLE) {
// Remove last entry in external array to bundle Popper
external.pop()
delete globals['@popperjs/core']
plugins.push(replace({ 'process.env.NODE_ENV': '"production"' }), nodeResolve())
plugins.push(
replace({
'process.env.NODE_ENV': '"production"',
preventAssignment: true
}),
nodeResolve()
)
}

const rollupConfig = {
Expand Down

0 comments on commit b63960a

Please sign in to comment.