-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbrowserify-umd.js
33 lines (25 loc) · 1.01 KB
/
browserify-umd.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
"use strict;"
var browserify = require("browserify");
var fs = require("fs");
var glob = require("glob");
var mkdirp = require("mkdirp");
var Umd = require("browserify-umdify");
var util = require("util");
mkdirp.sync("./temp");
var exampleOutFile = "./examples/browser-amd-requirejs/ts-events.js";
var exampleOut = fs.createWriteStream(exampleOutFile, { encoding: "utf8", flags: "w"})
var packageJson = require("./package.json");
var distOutFileVersioned = util.format("./temp/ts-events.%s.js", packageJson.version);
var distOutVersioned = fs.createWriteStream(distOutFileVersioned, { encoding: "utf8", flags: "w"})
var distOutFileUnversioned = "./dist/ts-events.js";
var distOutUnversioned = fs.createWriteStream(distOutFileUnversioned, { encoding: "utf8", flags: "w"})
var bundled = browserify({
extensions: [".js", ".json"],
debug: true
})
.require("./dist/lib/index.js", { expose: "ts-events" })
.bundle()
.pipe(new Umd());
bundled.pipe(exampleOut);
bundled.pipe(distOutVersioned);
bundled.pipe(distOutUnversioned);