Skip to content

Commit

Permalink
fixed release.js to use uglify 2.4.3
Browse files Browse the repository at this point in the history
changed the package.json to look in the root, as with the rest of the
file reads. changed the uglify function to use uglify.js 2.4.x's simpler
minify api.
  • Loading branch information
Seth Tenenbaum committed Jun 8, 2014
1 parent 907ac0b commit d657bd6
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions tools/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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 d657bd6

Please sign in to comment.