diff --git a/build/banner.js b/build/banner.js new file mode 100644 index 0000000000..4c66589f09 --- /dev/null +++ b/build/banner.js @@ -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) + */` +} diff --git a/build/build-plugins.js b/build/build-plugins.js index f767967000..6780446855 100644 --- a/build/build-plugins.js +++ b/build/build-plugins.js @@ -9,6 +9,7 @@ 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 plugins = [ babel({ @@ -67,6 +68,7 @@ Object.keys(bsPlugins) external }).then((bundle) => { bundle.write({ + banner, format, name: pluginKey, sourcemap: true, diff --git a/build/rollup.config.js b/build/rollup.config.js index df88fb304d..1e6d5fcebc 100644 --- a/build/rollup.config.js +++ b/build/rollup.config.js @@ -1,10 +1,9 @@ const path = require('path') const babel = require('rollup-plugin-babel') 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 year = new Date().getFullYear() let fileDest = 'bootstrap.js' const external = ['jquery', 'popper.js'] @@ -36,11 +35,7 @@ if (BUNDLE) { module.exports = { input: path.resolve(__dirname, '../js/src/index.js'), output: { - banner: `/*! - * Bootstrap v${pkg.version} (${pkg.homepage}) - * Copyright 2011-${year} ${pkg.author} - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - */`, + banner, file: path.resolve(__dirname, `../dist/js/${fileDest}`), format: 'umd', globals,