forked from tinymce/tinymce_compressor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jakefile.js
54 lines (43 loc) · 1.4 KB
/
Jakefile.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
43
44
45
46
47
48
49
50
51
52
53
54
var zip = require('./tools/BuildTools').zip;
var getReleaseDetails = require('./tools/BuildTools').getReleaseDetails;
var fs = require("fs");
var UglifyJS = require("uglify-js");
desc("Default build task");
task("default", ["release"], function () {});
task("release", [], function () {
var details = getReleaseDetails("changelog_php.txt");
if (!fs.existsSync("tmp")) {
fs.mkdirSync("tmp");
}
function createPackage(page, suffix) {
zip({
baseDir: "tinymce_compressor",
from: [
"tinymce.gzip.js",
["changelog_" + suffix + ".txt", "changelog.txt"],
page,
["tools/readme.installation.txt", "readme.txt"]
],
dataFilter: function(args) {
if (args.zipFilePath == 'tinymce.gzip.js') {
var source = args.data.toString().replace(/tinymce\.gzip\.php/g, page);
var ast = UglifyJS.parse(source);
ast.figure_out_scope();
ast = ast.transform(UglifyJS.Compressor());
ast.figure_out_scope();
ast.compute_char_frequency();
ast.mangle_names();
var stream = UglifyJS.OutputStream();
ast.print(stream);
args.data = stream.toString();
}
},
to: "tmp/tinymce_compressor_" + details.version + "_" + suffix + ".zip"
});
}
createPackage("tinymce.gzip.php", "php");
createPackage("tinymce.gzip.ashx", "net");
createPackage("tinymce.gzip.jsp", "jsp");
createPackage("tinymce.gzip.cfm", "cf");
createPackage("tinymce.gzip.pl", "perl");
});