Skip to content

Commit

Permalink
Merge pull request #178 from coh516/uglify.js-2.x-
Browse files Browse the repository at this point in the history
updated tools/release.js to use uglify-js 2.x
  • Loading branch information
sayrer committed Jun 8, 2014
2 parents f1fb0b9 + 611e627 commit d35700e
Showing 2 changed files with 8 additions and 16 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@
, "mkdirp": "0.3.0"
}
, "devDependencies": {
"uglify-js": "1.x"
"uglify-js": "2.x"
, "jsdom": "0.3.4"
, "step": "0.0.5"
, "rimraf": "2.0.1"
22 changes: 7 additions & 15 deletions tools/release.js
Original file line number Diff line number Diff line change
@@ -28,16 +28,12 @@ function copy(src, dst) {
}

function uglify(src, dst) {
var jsp = require("uglify-js").parser;
var pro = require("uglify-js").uglify;
var orig_code = read(src);
var ast = jsp.parse(orig_code); // parse code and get the initial AST
ast = pro.ast_mangle(ast); // get a new AST with mangled names
ast = pro.ast_squeeze(ast); // get an AST with compression optimizations
fs.writeFileSync(dst, minlicense + pro.gen_code(ast));
var UglifyJS = require("uglify-js");
fs.writeFileSync(dst, minlicense + UglifyJS.minify(src).code);
}

var packageJSON = JSON.parse(read('package.json'));
var packageJSON = JSON.parse(read(__dirname + '/../package.json'));

var version = packageJSON.version;

function removeFirstComment(text) {
@@ -64,10 +60,6 @@ wrappers.forEach(function(wrapper) {
});

// Also release Hogan.Template on its own.
wrappers.forEach(function(wrapper) {
var tail = path.basename(wrapper, '.mustache');
var target = distPath + 'hogan.template-' + version + '.' + tail;
var uglified = distPath + 'hogan.template-' + version + '.min.' + tail;
fs.writeFileSync(target, Hogan.compile(read(wrapper)).render({template: context.template}));
uglify(target, uglified);
});
var templateTarget = distPath + 'template-' + version + '.js';
fs.writeFileSync(templateTarget, read(__dirname + '/../lib/template.js'));
uglify(templateTarget, distPath + 'template-' + version + '.min.js');

0 comments on commit d35700e

Please sign in to comment.