Skip to content

Instantly share code, notes, and snippets.

@michiel
Created July 8, 2013 22:06
Show Gist options
  • Save michiel/5952900 to your computer and use it in GitHub Desktop.
Save michiel/5952900 to your computer and use it in GitHub Desktop.
#!/usr/bin/env node
var code, codeWithoutAsserts, fs, jsAst, map, mkdirp, path, _ref;
fs = require('fs');
path = require('path');
mkdirp = require('mkdirp');
jsAst = (require('commonjs-everywhere')).cjsify('lib/index.js', __dirname, {
"export" : 'epf',
aliases : {},
handlers : {}
});
_ref = (require('escodegen')).generate(jsAst, {
sourceMapRoot : __dirname,
sourceMapWithCode : true,
sourceMap : true
}), map = _ref.map, code = _ref.code;
codeWithoutAsserts = code.replace(/^(\s)*Ember\.(assert|deprecate|warn|debug)\((.*)\).*$/mg, '');
mkdirp('dist', function() {
fs.writeFile('dist/epf.js', "" + code + "\n/*\n//@ sourceMappingURL=eps.js.map\n*/");
fs.writeFile('dist/epf.prod.js', codeWithoutAsserts);
fs.writeFile('dist/epf.js.map', map);
return fs.writeFile('dist/epf.prod.js.map', map);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment