-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathbundle.js
42 lines (36 loc) · 975 Bytes
/
bundle.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
let browserify = require("browserify")
let tsify = require("tsify")
let minify = require("minify-stream")
let fs = require("fs")
let exorcist = require("exorcist")
let makeDir = require('make-dir')
makeDir.sync("dist")
let stream = fs.createWriteStream("dist/scenepic.min.js")
let mapFile = "dist/scenepic.min.js.map"
version = fs.readFileSync("VERSION")
stream.write("// " + version + "\n")
let debug = false
let b = browserify({
debug: debug
})
.add([
"tssrc/Canvas2D.ts",
"tssrc/Canvas3D.ts",
"tssrc/CanvasBase.ts",
"tssrc/CSSStyles.ts",
"tssrc/DropDownMenu.ts",
"tssrc/Mesh.ts",
"tssrc/Misc.ts",
"tssrc/Shaders.ts",
"tssrc/SPScene.ts",
"tssrc/TextPanel.ts",
"tssrc/WebGLMeshBuffers.ts",
"tssrc/ScenePic.ts",
"tssrc/VertexBuffers.ts"
])
.plugin(tsify)
.bundle()
if (!debug) {
b = b.pipe(minify()).pipe(exorcist(mapFile))
}
b.pipe(stream)