mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-17 19:06:40 +02:00
Include the plugin's filename in the license header.
This commit is contained in:
@@ -2,10 +2,12 @@ const path = require('path')
|
|||||||
const pkg = require(path.resolve(__dirname, '../package.json'))
|
const pkg = require(path.resolve(__dirname, '../package.json'))
|
||||||
const year = new Date().getFullYear()
|
const year = new Date().getFullYear()
|
||||||
|
|
||||||
module.exports = function () {
|
function getBanner(pluginFilename) {
|
||||||
return `/*!
|
return `/*!
|
||||||
* Bootstrap v${pkg.version} (${pkg.homepage})
|
* Bootstrap${pluginFilename ? ` ${pluginFilename}` : ''} v${pkg.version} (${pkg.homepage})
|
||||||
* Copyright 2011-${year} ${pkg.author}
|
* Copyright 2011-${year} ${pkg.author}
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||||
*/`
|
*/`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module.exports = getBanner
|
||||||
|
@@ -8,8 +8,8 @@
|
|||||||
const rollup = require('rollup')
|
const rollup = require('rollup')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const babel = require('rollup-plugin-babel')
|
const babel = require('rollup-plugin-babel')
|
||||||
const TEST = process.env.NODE_ENV === 'test'
|
|
||||||
const banner = require(path.resolve(__dirname, './banner.js'))
|
const banner = require(path.resolve(__dirname, './banner.js'))
|
||||||
|
const TEST = process.env.NODE_ENV === 'test'
|
||||||
|
|
||||||
const plugins = [
|
const plugins = [
|
||||||
babel({
|
babel({
|
||||||
@@ -62,18 +62,20 @@ Object.keys(bsPlugins)
|
|||||||
globals[bsPlugins.Tooltip] = 'Tooltip'
|
globals[bsPlugins.Tooltip] = 'Tooltip'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const pluginFilename = `${pluginKey.toLowerCase()}.js`
|
||||||
|
|
||||||
rollup.rollup({
|
rollup.rollup({
|
||||||
input: bsPlugins[pluginKey],
|
input: bsPlugins[pluginKey],
|
||||||
plugins,
|
plugins,
|
||||||
external
|
external
|
||||||
}).then((bundle) => {
|
}).then((bundle) => {
|
||||||
bundle.write({
|
bundle.write({
|
||||||
banner,
|
banner: banner(pluginFilename),
|
||||||
format,
|
format,
|
||||||
name: pluginKey,
|
name: pluginKey,
|
||||||
sourcemap: true,
|
sourcemap: true,
|
||||||
globals,
|
globals,
|
||||||
file: path.resolve(__dirname, `${rootPath}${pluginKey.toLowerCase()}.js`)
|
file: path.resolve(__dirname, `${rootPath}${pluginFilename}`)
|
||||||
})
|
})
|
||||||
.then(() => console.log(`Building ${pluginKey} plugin... Done!`))
|
.then(() => console.log(`Building ${pluginKey} plugin... Done!`))
|
||||||
.catch((err) => console.error(`${pluginKey}: ${err}`))
|
.catch((err) => console.error(`${pluginKey}: ${err}`))
|
||||||
|
Reference in New Issue
Block a user