Skip to content

Commit 301c46a

Browse files
committed
build: simplify banner
1 parent 4c481c2 commit 301c46a

File tree

1 file changed

+26
-19
lines changed

1 file changed

+26
-19
lines changed

rollup.config.js

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,43 @@
11
const babel = require('rollup-plugin-babel');
2+
const changeCase = require('change-case');
3+
const createBanner = require('create-banner');
24
const pkg = require('./package');
35

4-
const now = new Date();
5-
const banner = `/*!
6-
* isArrayBuffer v${pkg.version}
7-
* https://github.com/${pkg.repository}
8-
*
9-
* Copyright (c) 2015-${now.getFullYear()} ${pkg.author.name}
10-
* Released under the ${pkg.license} license
11-
*
12-
* Date: ${now.toISOString()}
13-
*/
14-
`;
6+
const name = changeCase.camelCase(pkg.name);
157

168
export default {
179
input: 'src/index.js',
1810
output: [
1911
{
20-
banner,
21-
file: 'dist/is-array-buffer.js',
12+
name,
13+
banner: createBanner({
14+
data: {
15+
name,
16+
year: '2015-present',
17+
},
18+
}),
19+
file: `dist/${pkg.name}.js`,
2220
format: 'umd',
23-
name: 'isArrayBuffer',
2421
},
2522
{
26-
banner,
27-
file: 'dist/is-array-buffer.common.js',
23+
name,
24+
banner: createBanner({
25+
data: {
26+
name,
27+
year: '2015-present',
28+
},
29+
template: 'inline',
30+
}),
31+
file: `dist/${pkg.name}.min.js`,
32+
format: 'umd',
33+
},
34+
{
35+
file: `dist/${pkg.name}.common.js`,
2836
format: 'cjs',
2937
},
3038
{
31-
banner,
32-
file: 'dist/is-array-buffer.esm.js',
33-
format: 'es',
39+
file: `dist/${pkg.name}.esm.js`,
40+
format: 'esm',
3441
},
3542
],
3643
plugins: [

0 commit comments

Comments
 (0)