1
0
Fork 0
mirror of https://github.com/twbs/bootstrap.git synced 2022-11-09 12:25:43 -05:00

Add license headers in js/dist files

By implementing the same approach of rollup.config.js
and replicate it in build-plugins.js, individual plugins
will display license headers.
This commit is contained in:
Helmut Granda 2018-09-25 18:55:35 +03:00 committed by XhmikosR
parent d7f79b06dc
commit ebc220754b
3 changed files with 15 additions and 7 deletions

11
build/banner.js Normal file
View file

@ -0,0 +1,11 @@
const path = require('path')
const pkg = require(path.resolve(__dirname, '../package.json'))
const year = new Date().getFullYear()
module.exports = function () {
return `/*!
* Bootstrap v${pkg.version} (${pkg.homepage})
* Copyright 2011-${year} ${pkg.author}
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/`
}

View file

@ -9,6 +9,7 @@ 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 TEST = process.env.NODE_ENV === 'test'
const banner = require(path.resolve(__dirname, './banner.js'))
const plugins = [ const plugins = [
babel({ babel({
@ -67,6 +68,7 @@ Object.keys(bsPlugins)
external external
}).then((bundle) => { }).then((bundle) => {
bundle.write({ bundle.write({
banner,
format, format,
name: pluginKey, name: pluginKey,
sourcemap: true, sourcemap: true,

View file

@ -1,10 +1,9 @@
const path = require('path') const path = require('path')
const babel = require('rollup-plugin-babel') const babel = require('rollup-plugin-babel')
const resolve = require('rollup-plugin-node-resolve') const resolve = require('rollup-plugin-node-resolve')
const banner = require(path.resolve(__dirname, './banner.js'))
const pkg = require(path.resolve(__dirname, '../package.json'))
const BUNDLE = process.env.BUNDLE === 'true' const BUNDLE = process.env.BUNDLE === 'true'
const year = new Date().getFullYear()
let fileDest = 'bootstrap.js' let fileDest = 'bootstrap.js'
const external = ['jquery', 'popper.js'] const external = ['jquery', 'popper.js']
@ -36,11 +35,7 @@ if (BUNDLE) {
module.exports = { module.exports = {
input: path.resolve(__dirname, '../js/src/index.js'), input: path.resolve(__dirname, '../js/src/index.js'),
output: { output: {
banner: `/*! banner,
* Bootstrap v${pkg.version} (${pkg.homepage})
* Copyright 2011-${year} ${pkg.author}
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/`,
file: path.resolve(__dirname, `../dist/js/${fileDest}`), file: path.resolve(__dirname, `../dist/js/${fileDest}`),
format: 'umd', format: 'umd',
globals, globals,