diff options
author | XhmikosR <xhmikosr@gmail.com> | 2019-02-26 14:20:34 +0300 |
---|---|---|
committer | XhmikosR <xhmikosr@gmail.com> | 2019-03-11 18:01:28 +0300 |
commit | 46c037410b8c7eaab3cf50a5cf44093aa2fd41f4 (patch) | |
tree | cb8c857562c4d3f819a5a8fcc563bc8f2c126e4e /build | |
parent | 44e6abcba50309df4fae56a9c7ef79145b64a356 (diff) |
Comply to the new rules.
Diffstat (limited to 'build')
-rw-r--r-- | build/build-plugins.js | 26 | ||||
-rwxr-xr-x | build/change-version.js | 31 | ||||
-rw-r--r-- | build/generate-sri.js | 2 | ||||
-rw-r--r-- | build/postcss.config.js | 14 | ||||
-rw-r--r-- | build/rollup.config.js | 16 |
5 files changed, 50 insertions, 39 deletions
diff --git a/build/build-plugins.js b/build/build-plugins.js index 1339684963..8569e979f1 100644 --- a/build/build-plugins.js +++ b/build/build-plugins.js @@ -7,16 +7,18 @@ 'use strict' -const path = require('path') -const rollup = require('rollup') -const babel = require('rollup-plugin-babel') -const banner = require('./banner.js') +const path = require('path') +const rollup = require('rollup') +const babel = require('rollup-plugin-babel') +const banner = require('./banner.js') -const TEST = process.env.NODE_ENV === 'test' +const TEST = process.env.NODE_ENV === 'test' const plugins = [ babel({ - exclude: 'node_modules/**', // Only transpile our source code - externalHelpersWhitelist: [ // Include only required helpers + // Only transpile our source code + exclude: 'node_modules/**', + // Include only required helpers + externalHelpersWhitelist: [ 'defineProperties', 'createClass', 'inheritsLoose', @@ -147,9 +149,7 @@ function getConfigByPluginKey(pluginKey) { function build(plugin) { console.log(`Building ${plugin} plugin...`) - const config = getConfigByPluginKey(plugin) - const external = config.external - const globals = config.globals + const { external, globals } = getConfigByPluginKey(plugin) let pluginPath = rootPath const utilObjects = [ @@ -179,7 +179,7 @@ function build(plugin) { input: bsPlugins[plugin], plugins, external - }).then((bundle) => { + }).then(bundle => { bundle.write({ banner: banner(pluginFilename), format: 'umd', @@ -189,8 +189,8 @@ function build(plugin) { file: path.resolve(__dirname, `${pluginPath}${pluginFilename}`) }) .then(() => console.log(`Building ${plugin} plugin... Done!`)) - .catch((err) => console.error(`${plugin}: ${err}`)) + .catch(error => console.error(`${plugin}: ${error}`)) }) } -Object.keys(bsPlugins).forEach((plugin) => build(plugin)) +Object.keys(bsPlugins).forEach(plugin => build(plugin)) diff --git a/build/change-version.js b/build/change-version.js index f1b4f747a7..971f447fb6 100755 --- a/build/change-version.js +++ b/build/change-version.js @@ -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,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)) { - console.log(`FILE: ${filepath}`) - } else { - console.log(`EXCLUDED:${filepath}`) - } - } : (filepath) => { - if (allowedExtensions.has(path.parse(filepath).ext)) { - sh.sed('-i', original, replacement, filepath) + 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) => { + + walkAsync(directory, excludedDirectories, updateFile, err => { console.error('ERROR while traversing directory!:') console.error(err) process.exit(1) @@ -79,6 +85,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([ diff --git a/build/generate-sri.js b/build/generate-sri.js index cd4eded566..4a04a1d301 100644 --- a/build/generate-sri.js +++ b/build/generate-sri.js @@ -43,7 +43,7 @@ const files = [ } ] -files.forEach((file) => { +files.forEach(file => { fs.readFile(file.file, 'utf8', (err, data) => { if (err) { throw err diff --git a/build/postcss.config.js b/build/postcss.config.js index 157291ffd2..56b7d94cc1 100644 --- a/build/postcss.config.js +++ b/build/postcss.config.js @@ -1,11 +1,13 @@ 'use strict' -module.exports = (ctx) => ({ - map: ctx.file.dirname.includes('examples') ? false : { - inline: false, - annotation: true, - sourcesContent: true - }, +module.exports = ctx => ({ + map: ctx.file.dirname.includes('examples') ? + false : + { + inline: false, + annotation: true, + sourcesContent: true + }, plugins: { autoprefixer: { cascade: false diff --git a/build/rollup.config.js b/build/rollup.config.js index e2819f8c04..d02acb5366 100644 --- a/build/rollup.config.js +++ b/build/rollup.config.js @@ -1,18 +1,20 @@ 'use strict' -const path = require('path') -const babel = require('rollup-plugin-babel') +const path = require('path') +const babel = require('rollup-plugin-babel') const resolve = require('rollup-plugin-node-resolve') -const banner = require('./banner.js') +const banner = require('./banner.js') -const BUNDLE = process.env.BUNDLE === 'true' +const BUNDLE = process.env.BUNDLE === 'true' -let fileDest = 'bootstrap.js' +let fileDest = 'bootstrap.js' const external = ['popper.js'] const plugins = [ babel({ - exclude: 'node_modules/**', // Only transpile our source code - externalHelpersWhitelist: [ // Include only required helpers + // Only transpile our source code + exclude: 'node_modules/**', + // Include only required helpers + externalHelpersWhitelist: [ 'defineProperties', 'createClass', 'inheritsLoose', |