forked from qlik-oss/picasso.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
51 lines (42 loc) · 1.35 KB
/
rollup.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/* eslint-env-node */
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import babel from 'rollup-plugin-babel';
import uglify from 'rollup-plugin-uglify';
import filesize from 'rollup-plugin-filesize';
import license from 'rollup-plugin-license';
import clean from 'rollup-plugin-clean';
import path from 'path';
const pkg = require(path.join(process.cwd(), 'package.json')); // eslint-disable-line
const hasName = process.argv.indexOf('--name') + 1 || process.argv.indexOf('-n') + 1;
const name = hasName ? process.argv[hasName] : 'picasso';
const fileName = name.replace(/([A-Z])/g, (m, s) => `-${s.toLowerCase()}`);
const isWatch = process.argv.indexOf('--watch') + 1 || process.argv.indexOf('-w') + 1;
const config = {
entry: 'src/index.js',
dest: `dist/${fileName}.js`,
moduleName: name,
format: 'umd',
sourceMap: true,
plugins: [
clean(),
resolve({ jsnext: true, preferBuiltins: false }),
babel({
exclude: 'node_modules/**',
presets: [['es2015', { modules: false }]],
plugins: ['external-helpers']
}),
commonjs(),
filesize()
]
};
if (!isWatch) {
config.plugins.push(uglify());
}
config.plugins.push(license({
banner: `
${pkg.name} v${pkg.version}
Copyright (c) ${new Date().getFullYear()} QlikTech International AB
`
}));
export default config;