mirror of
https://github.com/twbs/bootstrap.git
synced 2025-03-15 15:29:22 +01:00
ensure build plugins can exit in error (#30744)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
This commit is contained in:
parent
22f75ca2e3
commit
015aaf3c3d
@ -38,7 +38,7 @@ const bsPlugins = {
|
|||||||
}
|
}
|
||||||
const rootPath = TEST ? '../js/coverage/dist/' : '../js/dist/'
|
const rootPath = TEST ? '../js/coverage/dist/' : '../js/dist/'
|
||||||
|
|
||||||
function build(plugin) {
|
const build = async (plugin) => {
|
||||||
console.log(`Building ${plugin} plugin...`)
|
console.log(`Building ${plugin} plugin...`)
|
||||||
|
|
||||||
const external = ['jquery', 'popper.js']
|
const external = ['jquery', 'popper.js']
|
||||||
@ -60,13 +60,13 @@ function build(plugin) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const pluginFilename = `${plugin.toLowerCase()}.js`
|
const pluginFilename = `${plugin.toLowerCase()}.js`
|
||||||
|
const bundle = await rollup.rollup({
|
||||||
rollup.rollup({
|
|
||||||
input: bsPlugins[plugin],
|
input: bsPlugins[plugin],
|
||||||
plugins,
|
plugins,
|
||||||
external
|
external
|
||||||
}).then((bundle) => {
|
})
|
||||||
bundle.write({
|
|
||||||
|
await bundle.write({
|
||||||
banner: banner(pluginFilename),
|
banner: banner(pluginFilename),
|
||||||
format: 'umd',
|
format: 'umd',
|
||||||
name: plugin,
|
name: plugin,
|
||||||
@ -74,9 +74,18 @@ function build(plugin) {
|
|||||||
globals,
|
globals,
|
||||||
file: path.resolve(__dirname, `${rootPath}${pluginFilename}`)
|
file: path.resolve(__dirname, `${rootPath}${pluginFilename}`)
|
||||||
})
|
})
|
||||||
.then(() => console.log(`Building ${plugin} plugin... Done!`))
|
|
||||||
.catch((err) => console.error(`${plugin}: ${err}`))
|
console.log(`Building ${plugin} plugin... Done!`)
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Object.keys(bsPlugins).forEach((plugin) => build(plugin))
|
const main = async () => {
|
||||||
|
try {
|
||||||
|
await Promise.all(Object.keys(bsPlugins).map((plugin) => build(plugin)))
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
|
||||||
|
process.exit(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
main()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user