torque/lib/header.js
2019-01-21 17:15:14 +01:00

29 lines
843 B
JavaScript

// Adds version header to distributions
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");
['torque.uncompressed.js'].forEach(function(v){
fs.readFile('dist/' + v, 'utf8', function(err, torque) {
if (err) {
return console.error(err);
}
var torqueString = headerString.replace("{{lib}}", torque);
fs.writeFile('dist/' + v, torqueString, function (err) {
if (err) {
return console.error(err);
}
});
});
});