-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.js
28 lines (26 loc) · 975 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
var path = require("path");
var fs = require("fs-extra");
var fable = require("fable-compiler");
var targets = {
all() {
return fable.promisify(fs.remove, "npm")
.then(_ => fable.promisify(fs.remove, "build"))
.then(_ => fable.compile())
.then(_ => fable.compile({ target: "umd" }))
.then(_ => fable.promisify(fs.copy, "package.json", "npm/package.json"))
.then(_ => fable.promisify(fs.copy, "README.md", "npm/README.md"))
.then(_ => fable.promisify(fs.readFile, "RELEASE_NOTES.md"))
.then(line => {
var version = /\d[^\s]*/.exec(line)[0];
return fable.runCommand("npm", "npm version " + version);
});
},
publish() {
return this.all()
.then(_ => fable.runCommand("npm", "npm publish"))
}
}
targets[process.argv[2] || "all"]().catch(err => {
console.log("[ERROR] " + err);
process.exit(-1);
});