forked from szimek/signature_pad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.configs.js
65 lines (60 loc) · 1.86 KB
/
rollup.configs.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/* eslint import/no-extraneous-dependencies: 'off' */
const babel = require('rollup-plugin-babel');
const eslint = require('rollup-plugin-eslint');
const uglify = require('rollup-plugin-uglify');
const pkg = require('./package.json');
const plugins = [eslint(), babel()];
const longBanner = '/*!\n' +
` * Signature Pad v${pkg.version}\n` +
` * ${pkg.homepage}\n` +
' *\n' +
` * Copyright ${new Date().getFullYear()} ${pkg.author.name}\n` +
' * Released under the MIT license\n' +
' *\n' +
' * The main idea and some parts of the code (e.g. drawing variable width Bézier curve) are taken from:\n' +
' * http://corner.squareup.com/2012/07/smoother-signatures.html\n' +
' *\n' +
' * Implementation of interpolation using cubic Bézier curves is taken from:\n' +
' * http://benknowscode.wordpress.com/2012/09/14/path-interpolation-using-cubic-bezier-and-control-point-estimation-in-javascript\n' +
' *\n' +
' * Algorithm for approximated length of a Bézier curve is taken from:\n' +
' * http://www.lemoda.net/maths/bezier-length/index.html\n' +
' *\n' +
' */\n';
const shortBanner = '/*!\n' +
` * Signature Pad v${pkg.version} | ${pkg.homepage}\n` +
` * (c) ${new Date().getFullYear()} ${pkg.author.name} | Released under the MIT license\n` +
' */\n';
module.exports = [{
rollup: {
entry: 'src/signature_pad.js',
plugins,
},
bundle: {
dest: 'dist/signature_pad.js',
format: 'umd',
moduleName: 'SignaturePad',
banner: longBanner,
},
}, {
rollup: {
entry: 'src/signature_pad.js',
plugins: [...plugins, uglify()],
},
bundle: {
dest: 'dist/signature_pad.min.js',
format: 'umd',
moduleName: 'SignaturePad',
banner: shortBanner,
},
}, {
rollup: {
entry: 'src/signature_pad.js',
plugins,
},
bundle: {
dest: 'dist/signature_pad.mjs',
format: 'es',
banner: longBanner,
},
}];