-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrollup.js
54 lines (49 loc) · 1.29 KB
/
rollup.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
'use strict';
var babel = require('rollup-plugin-babel');
var babelrc = require('babelrc-rollup');
var rollup = require('rollup');
var fs = require("fs");
var path = require("path");
var rollupVersion = function (version, pkg) {
const settings = {
entry: path.join(version, 'index.js'),
plugins: [
babel(babelrc.default())
],
external: [
...Object.keys(pkg.dependencies),
'fs',
'path',
]
};
rollup.rollup(settings).then(function (bundle) {
bundle.write({
format: 'es',
dest: path.join(version, 'dist/png-db.es.js'),
sourceMap: true
});
if (pkg.createBrowserScript) {
bundle.write({
format: 'iife',
moduleName: 'pngDb',
dest: path.join(version, 'dist/png-db.js'),
sourceMap: true
});
} else {
bundle.write({
format: 'cjs',
dest: path.join(version, 'dist/png-db.js'),
sourceMap: true
});
}
});
};
rollupVersion('versions/client', {
"dependencies": {},
"createBrowserScript": true
});
rollupVersion('versions/node', {
"dependencies": {
"jimp": "^0.2.27"
}
});