Skip to content

Commit

Permalink
Include the plugin's filename in the license header.
Browse files Browse the repository at this point in the history
  • Loading branch information
XhmikosR committed Sep 26, 2018
1 parent 1973694 commit dd9cdc1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 4 additions & 2 deletions build/banner.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ const path = require('path')
const pkg = require(path.resolve(__dirname, '../package.json'))
const year = new Date().getFullYear()

module.exports = function () {
function getBanner(pluginFilename) {
return `/*!
* Bootstrap v${pkg.version} (${pkg.homepage})
* Bootstrap${pluginFilename ? ` ${pluginFilename}` : ''} v${pkg.version} (${pkg.homepage})
* Copyright 2011-${year} ${pkg.author}
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/`
}

module.exports = getBanner
8 changes: 5 additions & 3 deletions build/build-plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
const rollup = require('rollup')
const path = require('path')
const babel = require('rollup-plugin-babel')
const TEST = process.env.NODE_ENV === 'test'
const banner = require(path.resolve(__dirname, './banner.js'))
const TEST = process.env.NODE_ENV === 'test'

const plugins = [
babel({
Expand Down Expand Up @@ -62,18 +62,20 @@ Object.keys(bsPlugins)
globals[bsPlugins.Tooltip] = 'Tooltip'
}

const pluginFilename = `${pluginKey.toLowerCase()}.js`

rollup.rollup({
input: bsPlugins[pluginKey],
plugins,
external
}).then((bundle) => {
bundle.write({
banner,
banner: banner(pluginFilename),
format,
name: pluginKey,
sourcemap: true,
globals,
file: path.resolve(__dirname, `${rootPath}${pluginKey.toLowerCase()}.js`)
file: path.resolve(__dirname, `${rootPath}${pluginFilename}`)
})
.then(() => console.log(`Building ${pluginKey} plugin... Done!`))
.catch((err) => console.error(`${pluginKey}: ${err}`))
Expand Down

0 comments on commit dd9cdc1

Please sign in to comment.