forked from reshadi/jakets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathClosure.ts
34 lines (27 loc) · 1.01 KB
/
Closure.ts
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
import * as Path from "path";
import * as Fs from "fs";
import * as Zlib from "zlib";
import * as Jake from "./Jake";
import * as Node from "./Node";
let ClosureJar = Node.FindModulePath("google-closure-compiler/compiler.jar", [".."]);
let RawExec = Node.CreateExec("java -jar " + ClosureJar);
export function Exec(inputs: string, output: string, callback, options?: string) {
let args = "";
//Default arguments that can be overwritten via options
args += " --compilation_level ADVANCED_OPTIMIZATIONS";
args += " --language_in ECMASCRIPT5";
args += " --new_type_inf";
args += " --summary_detail_level 3";
args += " --warning_level VERBOSE";
args += " --js_output_file=" + output;
// args += " --jszip=" + output + ".gz";
if (options) {
args += " " + options;
}
args += " " + inputs;
Jake.Shell.mkdir("-p", Path.dirname(output));
// RawExec(args, callback);
RawExec(args, () => {
Jake.Exec("gzip --best < " + output + " > " + output + ".gz", callback);
});
}