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) {
|
2019-01-22 00:15:14 +08:00
|
|
|
if (err) {
|
|
|
|
return console.error(err);
|
2015-07-30 23:19:10 +08:00
|
|
|
}
|
2019-01-22 00:15:14 +08:00
|
|
|
var torqueString = headerString.replace("{{lib}}", torque);
|
|
|
|
fs.writeFile('dist/' + v, torqueString, function (err) {
|
|
|
|
if (err) {
|
|
|
|
return console.error(err);
|
|
|
|
}
|
|
|
|
});
|
2015-07-30 23:19:10 +08:00
|
|
|
});
|
2015-07-30 22:38:23 +08:00
|
|
|
});
|