-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathbuild.js
30 lines (26 loc) · 1013 Bytes
/
build.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
var fs = require('fs');
var path = require('path');
var exorcist = require('exorcist');
var browserify = require('browserify');
var minifyStream = require('minify-stream');
var root = path.join(__dirname, 'dist');
// Minify and bundle
browserify({debug: true})
.add('./index.js')
.plugin('common-shakeify')
.plugin('browser-pack-flat/plugin')
.bundle()
.pipe(minifyStream())
.pipe(exorcist(path.join(root, 'derby-standalone.min.map.json')))
.pipe(fs.createWriteStream(path.join(root, 'derby-standalone.min.js')));
// Bundle unminified
browserify({debug: true})
.add('./index.js')
.bundle()
.pipe(exorcist(path.join(root, 'derby-standalone.map.json')))
.pipe(fs.createWriteStream(path.join(root, 'derby-standalone.js')));
// Make this npm package version match the version of derby
var package = require('./package.json');
package.version = require('derby/package.json').version;
var packageJson = JSON.stringify(package, null, 2) + '\n';
fs.writeFileSync('./package.json', packageJson);