1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-30 08:39:56 +02:00

Comply to the new rules

This commit is contained in:
XhmikosR
2020-06-12 21:50:30 +03:00
parent 1c37a2ba77
commit 3be585990c
35 changed files with 606 additions and 574 deletions

View File

@@ -39,7 +39,7 @@ const bsPlugins = {
}
const rootPath = TEST ? '../js/coverage/dist/' : '../js/dist/'
const build = async (plugin) => {
const build = async plugin => {
console.log(`Building ${plugin} plugin...`)
const external = ['jquery', 'popper.js']
@@ -81,7 +81,7 @@ const build = async (plugin) => {
const main = async () => {
try {
await Promise.all(Object.keys(bsPlugins).map((plugin) => build(plugin)))
await Promise.all(Object.keys(bsPlugins).map(plugin => build(plugin)))
} catch (error) {
console.error(error)

View File

@@ -30,18 +30,21 @@ function walkAsync(directory, excludedDirectories, fileCallback, errback) {
if (excludedDirectories.has(path.parse(directory).base)) {
return
}
fs.readdir(directory, (err, names) => {
if (err) {
errback(err)
return
}
names.forEach((name) => {
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()) {
@@ -55,18 +58,19 @@ 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) => {
const updateFile = DRY_RUN ? filepath => {
if (allowedExtensions.has(path.parse(filepath).ext)) {
console.log(`FILE: ${filepath}`)
} else {
console.log(`EXCLUDED:${filepath}`)
}
} : (filepath) => {
} : filepath => {
if (allowedExtensions.has(path.parse(filepath).ext)) {
sh.sed('-i', original, replacement, filepath)
}
}
walkAsync(directory, excludedDirectories, updateFile, (err) => {
walkAsync(directory, excludedDirectories, updateFile, err => {
console.error('ERROR while traversing directory!:')
console.error(err)
process.exit(1)
@@ -79,6 +83,7 @@ function main(args) {
console.error('Got arguments:', args)
process.exit(1)
}
const oldVersion = args[0]
const newVersion = args[1]
const EXCLUDED_DIRS = new Set([

View File

@@ -49,7 +49,7 @@ const files = [
}
]
files.forEach((file) => {
files.forEach(file => {
fs.readFile(file.file, 'utf8', (err, data) => {
if (err) {
throw err

View File

@@ -1,6 +1,6 @@
'use strict'
module.exports = (ctx) => ({
module.exports = ctx => ({
map: ctx.file.dirname.includes('examples') ? false : {
inline: false,
annotation: true,

View File

@@ -43,7 +43,7 @@ sh.cp('-f', [
sh.rm(`${folderName}/index.html`)
// get all examples' HTML files
sh.find(`${folderName}/**/*.html`).forEach((file) => {
sh.find(`${folderName}/**/*.html`).forEach(file => {
const fileContents = sh.cat(file)
.toString()
.replace(new RegExp(`"/docs/${versionShort}/`, 'g'), '"../')