]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Add license headers in js/dist files
authorHelmut Granda <contact@helmutgranda.com>
Tue, 25 Sep 2018 15:55:35 +0000 (18:55 +0300)
committerXhmikosR <xhmikosr@gmail.com>
Wed, 26 Sep 2018 12:53:44 +0000 (15:53 +0300)
By implementing the same approach of rollup.config.js
and replicate it in build-plugins.js, individual plugins
will display license headers.

build/banner.js [new file with mode: 0644]
build/build-plugins.js
build/rollup.config.js

diff --git a/build/banner.js b/build/banner.js
new file mode 100644 (file)
index 0000000..4c66589
--- /dev/null
@@ -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)
+  */`
+}
index f767967000351439d8c9637d753aacf844b1d5f9..678044685539677e5568eceda07e810a1bf3691c 100644 (file)
@@ -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,
index df88fb304d93501bb3a55541802bf70e231473c8..1e6d5fcebcdffd18df4e608a5fdc84c9150cdcba 100644 (file)
@@ -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,