Merge pull request #206 from CartoDB/header

Adds script to prepend a version header to uncompressed dists
This commit is contained in:
Francisco Dans 2015-07-30 18:37:51 +02:00
commit 973aa487dc
4 changed files with 31 additions and 5 deletions

View File

@ -1,4 +1,4 @@
Copyright (c) 2011, Vizzuality
Copyright (c) 2015, CartoDB
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -10,8 +10,8 @@ modification, are permitted provided that the following conditions are met:
documentation and/or other materials provided with the distribution.
3. All advertising materials mentioning features or use of this software
must display the following acknowledgement:
This product includes software developed by Vizzuality.
4. Neither the name of Vizzuality nor the
This product includes software developed by CartoDB.
4. Neither the name of CartoDB nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.

View File

@ -9,7 +9,7 @@ JS_CLIENT_FILES= lib/torque/*.js \
lib/torque/leaflet/canvas_layer.js \
lib/torque/leaflet/torque.js
all: dist/torque.js dist/torque.full.js
all: dist/torque.js dist/torque.full.js add-header
dist/torque.full.uncompressed.js: dist_folder dist/torque.uncompressed.js
$(BROWSERIFY) lib/torque/index.js --standalone torque > dist/torque.full.uncompressed.js
@ -31,6 +31,9 @@ dist: dist_folder dist/torque.js
clean-results:
-@rm test/results/*.png
add-header:
node lib/header.js
prepare-test-suite:
browserify test/suite.js > test/suite-bundle.js

23
lib/header.js Normal file
View File

@ -0,0 +1,23 @@
// 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','torque.full.uncompressed.js'].forEach(function(v){
fs.readFile('dist/' + v, 'utf8', function(err, torque) {
if(!err){
var torqueString = headerString.replace("{{lib}}", torque);
fs.writeFile('dist/' + v, torqueString);
}
});
});

View File

@ -1,7 +1,7 @@
{
"name": "torque.js",
"version": "2.11.3",
"description": "Torque javascript library",
"description": "Temporal mapping for CartoDB",
"repository": {
"type": "git",
"url": "git://github.com/CartoDB/torque.git"