torque/lib/header.js

24 lines
744 B
JavaScript
Raw Permalink Normal View History

2015-07-30 23:19:10 +08:00
// Adds version header to distributions
2015-07-30 22:38:23 +08:00
2015-07-30 23:19:10 +08:00
var fs = require('fs');
var packageJSON = require('../package.json');
var headerString = ['/**',
'Torque {{version}}',
'{{description}}',
'{{url}}',
'**/\n\n',
'{{lib}}'].join('\n');
headerString = headerString.replace("{{version}}", packageJSON.version)
.replace("{{description}}", packageJSON.description)
.replace("{{url}}", "https://github.com/cartodb/torque");
2015-07-30 22:58:17 +08:00
2015-08-03 17:30:01 +08:00
['torque.uncompressed.js'].forEach(function(v){
2015-07-30 23:19:10 +08:00
fs.readFile('dist/' + v, 'utf8', function(err, torque) {
if(!err){
var torqueString = headerString.replace("{{lib}}", torque);
fs.writeFile('dist/' + v, torqueString);
}
});
2015-07-30 22:38:23 +08:00
});