diff options
author | XhmikosR <xhmikosr@gmail.com> | 2017-12-16 15:00:38 +0300 |
---|---|---|
committer | XhmikosR <xhmikosr@gmail.com> | 2018-01-11 19:48:46 +0300 |
commit | 80d0943b95984bfaf4997d2198d467876d294bd8 (patch) | |
tree | fa2eb4c869753b6e20c771a928da460587f38fdf /build | |
parent | 6d336502c7e26c4cc5b35f1d7a19c067b774cb1f (diff) |
Comply to the new rules.
Diffstat (limited to 'build')
-rwxr-xr-x | build/change-version.js | 32 | ||||
-rw-r--r-- | build/generate-sri.js | 2 | ||||
-rw-r--r-- | build/postcss.config.js | 4 | ||||
-rw-r--r-- | build/rollup.config.js | 11 | ||||
-rw-r--r-- | build/saucelabs-unit-test.js | 2 | ||||
-rw-r--r-- | build/vnu-jar.js | 2 | ||||
-rw-r--r-- | build/workbox.js | 1 |
7 files changed, 29 insertions, 25 deletions
diff --git a/build/change-version.js b/build/change-version.js index ab4579072b..dc0b0c5dfd 100755 --- a/build/change-version.js +++ b/build/change-version.js @@ -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) => { diff --git a/build/generate-sri.js b/build/generate-sri.js index 708e6dfbf8..2ace46e05f 100644 --- a/build/generate-sri.js +++ b/build/generate-sri.js @@ -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) }) }) diff --git a/build/postcss.config.js b/build/postcss.config.js index c7c9a17b05..157291ffd2 100644 --- a/build/postcss.config.js +++ b/build/postcss.config.js @@ -7,6 +7,8 @@ module.exports = (ctx) => ({ sourcesContent: true }, plugins: { - autoprefixer: { cascade: false } + autoprefixer: { + cascade: false + } } }) diff --git a/build/rollup.config.js b/build/rollup.config.js index 0b59aef652..c97e3761c1 100644 --- a/build/rollup.config.js +++ b/build/rollup.config.js @@ -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()) diff --git a/build/saucelabs-unit-test.js b/build/saucelabs-unit-test.js index 0b4a3b5f0e..3ec68a95b2 100644 --- a/build/saucelabs-unit-test.js +++ b/build/saucelabs-unit-test.js @@ -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') } diff --git a/build/vnu-jar.js b/build/vnu-jar.js index 991d5c1c09..eefcb64ebf 100644 --- a/build/vnu-jar.js +++ b/build/vnu-jar.js @@ -64,5 +64,5 @@ childProcess.exec('java -version', (error, stdout, stderr) => { shell: true, stdio: 'inherit' }) - .on('exit', process.exit) + .on('exit', process.exit) }) diff --git a/build/workbox.js b/build/workbox.js index 17129ec8c3..e51cf6dcbd 100644 --- a/build/workbox.js +++ b/build/workbox.js @@ -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') |