mirror of
https://github.com/twbs/bootstrap.git
synced 2022-11-09 12:25:43 -05:00
ensure build plugins can exit in error (#30744)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
This commit is contained in:
parent
f91788548c
commit
d1575b6b6b
1 changed files with 25 additions and 17 deletions
|
@ -56,7 +56,7 @@ const defaultPluginConfig = {
|
|||
}
|
||||
}
|
||||
|
||||
function getConfigByPluginKey(pluginKey) {
|
||||
const getConfigByPluginKey = pluginKey => {
|
||||
if (
|
||||
pluginKey === 'Data' ||
|
||||
pluginKey === 'Manipulator' ||
|
||||
|
@ -143,7 +143,7 @@ const domObjects = [
|
|||
'SelectorEngine'
|
||||
]
|
||||
|
||||
function build(plugin) {
|
||||
const build = async plugin => {
|
||||
console.log(`Building ${plugin} plugin...`)
|
||||
|
||||
const { external, globals } = getConfigByPluginKey(plugin)
|
||||
|
@ -158,12 +158,13 @@ function build(plugin) {
|
|||
pluginPath = `${rootPath}/dom/`
|
||||
}
|
||||
|
||||
rollup.rollup({
|
||||
const bundle = await rollup.rollup({
|
||||
input: bsPlugins[plugin],
|
||||
plugins,
|
||||
external
|
||||
}).then(bundle => {
|
||||
bundle.write({
|
||||
})
|
||||
|
||||
await bundle.write({
|
||||
banner: banner(pluginFilename),
|
||||
format: 'umd',
|
||||
name: plugin,
|
||||
|
@ -171,11 +172,18 @@ function build(plugin) {
|
|||
globals,
|
||||
file: path.resolve(__dirname, `${pluginPath}/${pluginFilename}`)
|
||||
})
|
||||
.then(() => console.log(`Building ${plugin} plugin... Done!`))
|
||||
.catch(error => console.error(`${plugin}: ${error}`))
|
||||
})
|
||||
.catch(error => console.error(`${plugin}: ${error}`))
|
||||
|
||||
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…
Reference in a new issue