mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-27 07:14:36 +02:00
Comply to the new rules.
This commit is contained in:
@@ -18,8 +18,13 @@ const sh = require('shelljs')
|
||||
sh.config.fatal = true
|
||||
|
||||
// Blame TC39... https://github.com/benjamingr/RegExp.escape/issues/37
|
||||
RegExp.quote = (string) => string.replace(/[-\\^$*+?.()|[\]{}]/g, '\\$&')
|
||||
RegExp.quoteReplacement = (string) => string.replace(/[$]/g, '$$')
|
||||
function regExpQuote(string) {
|
||||
return string.replace(/[-\\^$*+?.()|[\]{}]/g, '\\$&')
|
||||
}
|
||||
|
||||
function regExpQuoteReplacement(string) {
|
||||
return string.replace(/[$]/g, '$$')
|
||||
}
|
||||
|
||||
const DRY_RUN = false
|
||||
|
||||
@@ -39,13 +44,9 @@ function walkAsync(directory, excludedDirectories, fileCallback, errback) {
|
||||
process.nextTick(errback, err)
|
||||
return
|
||||
}
|
||||
if (stats.isSymbolicLink()) {
|
||||
return
|
||||
}
|
||||
else if (stats.isDirectory()) {
|
||||
if (stats.isDirectory()) {
|
||||
process.nextTick(walkAsync, filepath, excludedDirectories, fileCallback, errback)
|
||||
}
|
||||
else if (stats.isFile()) {
|
||||
} else if (stats.isFile()) {
|
||||
process.nextTick(fileCallback, filepath)
|
||||
}
|
||||
})
|
||||
@@ -54,18 +55,17 @@ function walkAsync(directory, excludedDirectories, fileCallback, errback) {
|
||||
}
|
||||
|
||||
function replaceRecursively(directory, excludedDirectories, allowedExtensions, original, replacement) {
|
||||
original = new RegExp(RegExp.quote(original), 'g')
|
||||
replacement = RegExp.quoteReplacement(replacement)
|
||||
const updateFile = !DRY_RUN ? (filepath) => {
|
||||
original = new RegExp(regExpQuote(original), 'g')
|
||||
replacement = regExpQuoteReplacement(replacement)
|
||||
const updateFile = DRY_RUN ? (filepath) => {
|
||||
if (allowedExtensions.has(path.parse(filepath).ext)) {
|
||||
sh.sed('-i', original, replacement, filepath)
|
||||
console.log(`FILE: ${filepath}`)
|
||||
} else {
|
||||
console.log(`EXCLUDED:${filepath}`)
|
||||
}
|
||||
} : (filepath) => {
|
||||
if (allowedExtensions.has(path.parse(filepath).ext)) {
|
||||
console.log(`FILE: ${filepath}`)
|
||||
}
|
||||
else {
|
||||
console.log(`EXCLUDED:${filepath}`)
|
||||
sh.sed('-i', original, replacement, filepath)
|
||||
}
|
||||
}
|
||||
walkAsync(directory, excludedDirectories, updateFile, (err) => {
|
||||
|
@@ -55,6 +55,6 @@ files.forEach((file) => {
|
||||
|
||||
console.log(`${file.configPropertyName}: ${integrity}`)
|
||||
|
||||
sh.sed('-i', new RegExp(`(\\s${file.configPropertyName}:\\s+"|')(\\S+)("|')`), '$1' + integrity + '$3', configFile)
|
||||
sh.sed('-i', new RegExp(`(\\s${file.configPropertyName}:\\s+"|')(\\S+)("|')`), `$1${integrity}$3`, configFile)
|
||||
})
|
||||
})
|
||||
|
@@ -7,6 +7,8 @@ module.exports = (ctx) => ({
|
||||
sourcesContent: true
|
||||
},
|
||||
plugins: {
|
||||
autoprefixer: { cascade: false }
|
||||
autoprefixer: {
|
||||
cascade: false
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@@ -3,16 +3,17 @@
|
||||
const path = require('path')
|
||||
const babel = require('rollup-plugin-babel')
|
||||
const resolve = require('rollup-plugin-node-resolve')
|
||||
|
||||
const pkg = require(path.resolve(__dirname, '../package.json'))
|
||||
const BUNDLE = process.env.BUNDLE === 'true'
|
||||
const year = new Date().getFullYear()
|
||||
|
||||
let fileDest = 'bootstrap.js'
|
||||
const external = ['jquery', 'popper.js']
|
||||
const external = ['jquery', 'popper.js']
|
||||
const plugins = [
|
||||
babel({
|
||||
exclude: 'node_modules/**', // only transpile our source code
|
||||
externalHelpersWhitelist: [ // include only required helpers
|
||||
exclude: 'node_modules/**', // Only transpile our source code
|
||||
externalHelpersWhitelist: [ // Include only required helpers
|
||||
'defineProperties',
|
||||
'createClass',
|
||||
'inheritsLoose',
|
||||
@@ -21,13 +22,13 @@ const plugins = [
|
||||
})
|
||||
]
|
||||
const globals = {
|
||||
jquery: 'jQuery', // ensure we use jQuery which is always available even in noConflict mode
|
||||
jquery: 'jQuery', // Ensure we use jQuery which is always available even in noConflict mode
|
||||
'popper.js': 'Popper'
|
||||
}
|
||||
|
||||
if (BUNDLE) {
|
||||
fileDest = 'bootstrap.bundle.js'
|
||||
// remove last entry in external array to bundle Popper
|
||||
// Remove last entry in external array to bundle Popper
|
||||
external.pop()
|
||||
delete globals['popper.js']
|
||||
plugins.push(resolve())
|
||||
|
@@ -91,7 +91,7 @@ jsUnitSaucelabs.on('tunnelCreated', () => {
|
||||
if (typeof success !== 'undefined') {
|
||||
const taskIds = success['js tests']
|
||||
|
||||
if (!taskIds || !taskIds.length) {
|
||||
if (!taskIds || taskIds.length === 0) {
|
||||
throw new Error('Error starting tests through Sauce Labs API')
|
||||
}
|
||||
|
||||
|
@@ -64,5 +64,5 @@ childProcess.exec('java -version', (error, stdout, stderr) => {
|
||||
shell: true,
|
||||
stdio: 'inherit'
|
||||
})
|
||||
.on('exit', process.exit)
|
||||
.on('exit', process.exit)
|
||||
})
|
||||
|
@@ -4,6 +4,7 @@ const fs = require('fs')
|
||||
const path = require('path')
|
||||
const swBuild = require('workbox-build')
|
||||
const config = require('./workbox.config.json')
|
||||
|
||||
const buildPrefix = '_gh_pages/'
|
||||
|
||||
const workboxSWSrcPath = require.resolve('workbox-sw')
|
||||
|
Reference in New Issue
Block a user