Skip to content

Commit ae199cc

Browse files
committed
Add custom license plugin
1 parent 8932d4a commit ae199cc

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

rollup.config.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22
import resolve from 'rollup-plugin-node-resolve';
33
import commonjs from 'rollup-plugin-commonjs';
44
import pkg from './package.json';
5+
import fs from 'fs';
6+
7+
function license(filename) {
8+
filename = filename || './LICENSE';
9+
var data = fs.readFileSync(filename).toString();
10+
console.log(data);
11+
console.log(typeof data);
12+
data = '/**\n * @license\n * ' + data.trim().replace(/\n/g, '\n * ') + '\n */\n';
13+
return { banner: data };
14+
}
515

616
export default [
717
// Bundled builds.
@@ -17,7 +27,8 @@ export default [
1727
},
1828
plugins: [
1929
resolve(),
20-
commonjs()
30+
commonjs(),
31+
license('./LICENSE')
2132
]
2233
},
2334
// Un-bundled builds.
@@ -40,7 +51,8 @@ export default [
4051
},
4152
plugins: [
4253
resolve(),
43-
commonjs()
54+
commonjs(),
55+
license('./LICENSE')
4456
]
4557
}
4658
];

0 commit comments

Comments
 (0)