mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-31 09:05:47 +02:00
Comply to the new rules.
This commit is contained in:
@@ -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))
|
||||
|
@@ -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}`)
|
||||
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)
|
||||
}
|
||||
}
|
||||
} : (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([
|
||||
|
@@ -43,7 +43,7 @@ const files = [
|
||||
}
|
||||
]
|
||||
|
||||
files.forEach((file) => {
|
||||
files.forEach(file => {
|
||||
fs.readFile(file.file, 'utf8', (err, data) => {
|
||||
if (err) {
|
||||
throw err
|
||||
|
@@ -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
|
||||
|
@@ -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',
|
||||
|
Reference in New Issue
Block a user