This commit is contained in:
zhongjin
2020-06-15 12:07:54 +08:00
parent 610ed21a90
commit a96ef233c9
444 changed files with 0 additions and 0 deletions
@@ -0,0 +1,19 @@
## Grunt tasks list
These are the tasks(*) we provide:
- [x] ```grunt serve``` => serve static cartodb.js landing page.
- [x] ```grunt publish``` => publish cartodb.js library in S3 (you need secret keys).
- [x] ```grunt release``` => same as publish task.
- [x] ```grunt clean``` => clean temporary and dist folders.
- [x] ```grunt invalidate``` => invalidate library files through fastly.
- [x] ```grunt test``` => run library test suite (it will generate a SpecRunner.html file in test folder).
- ```grunt test -d``` => if you need to print failing tests.
- ```grunt test -f``` => if you need to know where was the problem.
- [x] ```grunt build``` => generate library and website in dist folder.
- [x] ```grunt dist``` => same as build task.
- [x] ```grunt pages``` => deploy static cartodb.js webpage to gh-pages.
- [X] ```grunt js``` => create uncompressed javascript files in dist (useful for developing)
- [ ] ```grunt watch``` => special watch for cartodb.js library (in progress).
*Remember to install all the things you need, check main README.md, how to build section.
@@ -0,0 +1,31 @@
/**
* Autoprefixer grunt task for CartoDB.js
*
*/
module.exports = {
task: function() {
return {
options: {
browsers: [ '> 5%', 'ie > 6' ]
},
dist: {
files: [{
expand: true,
cwd: '<%= config.dist %>/<%= config.app %>/css',
src: '**/*.css',
dest: '<%= config.dist %>/<%= config.app %>/css'
}]
},
server: {
files: [{
expand: true,
cwd: '.tmp/css',
src: '**/*.css',
dest: '.tmp/css'
}]
}
}
}
}
@@ -0,0 +1,24 @@
/**
* Build control grunt task for CartoDB.js
*
*/
module.exports = {
task: function() {
return {
options: {
dir: '<%= config.dist %>/<%= config.app %>',
commit: true,
push: true,
message: 'Built %sourceName% from commit %sourceCommit%, version <%= pkg.version %>, on branch %sourceBranch%.'
},
pages: {
options: {
remote: 'git@github.com:cartodb/cartodb.js.git',
branch: 'gh-pages'
}
}
}
}
}
@@ -0,0 +1,26 @@
/**
* Clean grunt task for CartoDB.js
*
*/
module.exports = {
task: function() {
return {
dist: {
files: [{
dot: true,
src: [
'.sass-cache',
'.tmp',
'<%= config.dist %>',
'!<%= config.dist %>/.git*'
]
}]
},
server: [
'.tmp'
]
}
}
}
@@ -0,0 +1,35 @@
/**
* Compass grunt task for CartoDB.js
*
*/
module.exports = {
task: function() {
return {
options: {
bundleExec: true,
sassDir: '<%= config.app %>/_scss',
cssDir: '<%= config.app %>/css',
imagesDir: '<%= config.app %>/img',
javascriptsDir: '<%= config.app %>/js',
relativeAssets: false,
httpImagesPath: '/img',
httpGeneratedImagesPath: '/img/generated',
outputStyle: 'expanded',
raw: 'extensions_dir = "<%= config.app %>/_bower_components"\n'
},
dist: {
options: {
generatedImagesDir: '<%= config.dist %>/<%= config.app %>/img/generated'
}
},
server: {
options: {
debugInfo: true,
generatedImagesDir: '.tmp/img/generated'
}
}
}
}
}
@@ -0,0 +1,192 @@
/**
* Concat grunt task for CartoDB.js
*
*/
module.exports = {
task: function(grunt, config) {
// Get src and vendor js files
require('../../src/cartodb');
cdb.files.splice(0, 0, 'cartodb.js');
var files = cdb.files;
var vendor_files = [];
var cdb_files = [];
for(var i = 0; i < files.length; ++i) {
var f = files[i];
if(f.indexOf('vendor') === -1) {
cdb_files.push('./src/' + f);
} else {
vendor_files.push('./vendor/' + f.split('/')[2]);
}
}
return {
standard: {
options: {
process: function(src, filepath) {
// DAMM!
// It is possible to use neither underscore nor
// grunt templating, an ILLEGAL token error appears
// - Solution, replacing text, directly, rude.
return src
.replace(/<%= version %>/g, grunt.config.get('bump.version'))
.replace(/<%= sha %>/g, grunt.config.get('gitinfo').local.branch.current.SHA)
.replace(/<%= load_jquery %>/g, true)
}
},
files: {
// Standard library
'<%= config.dist %>/cartodb.uncompressed.js':
['grunt/templates/wrapper_header.js']
.concat(vendor_files)
.concat(['grunt/templates/wrapper_middle.js'])
.concat(cdb_files)
.concat(['grunt/templates/wrapper_footer.js'])
}
},
core: {
options: {
banner: grunt.file.read('./grunt/templates/version_header.js') + "" + grunt.file.read('./grunt/templates/core_header.js') + "",
footer: grunt.file.read('./grunt/templates/core_footer.js')
},
files: {
// Core library
'<%= config.dist %>/cartodb.core.uncompressed.js': [
'vendor/underscore-min.js',
'grunt/templates/underscore_no_conflict.js',
'vendor/mustache.js',
'vendor/reqwest.min.js',
'src/cartodb.js',
'src/api/core_lib.js',
'src/core/profiler.js',
'src/core/util.js',
'src/api/sql.js',
'src/geo/layer_definition.js',
'src/geo/sublayer.js',
'src/core/loader.js',
'src/vis/image.js',
'src/api/tiles.js'
]
}
},
nojquery: {
options: {
process: function(src, filepath) {
// DAMM!
// It is possible to use neither underscore nor
// grunt templating, an ILLEGAL token error appears
// - Solution, replacing text, directly, rude.
return src
.replace(/<%= version %>/g, grunt.config.get('bump.version'))
.replace(/<%= sha %>/g, grunt.config.get('gitinfo').local.branch.current.SHA)
.replace(/<%= load_jquery %>/g, true)
}
},
files: {
// Library without jQuery library
'<%= config.dist %>/_cartodb_nojquery.js':
['grunt/templates/wrapper_header.js']
.concat(vendor_files)
.concat([
'!./vendor/jquery.min.js',
'grunt/templates/wrapper_middle.js'
])
.concat(cdb_files)
.concat(['grunt/templates/wrapper_footer.js'])
}
},
noleaflet: {
options: {
process: function(src, filepath) {
// DAMM!
// It is possible to use neither underscore nor
// grunt templating, an ILLEGAL token error appears
// - Solution, replacing text, directly, rude.
return src
.replace(/<%= version %>/g, grunt.config.get('bump.version'))
.replace(/<%= sha %>/g, grunt.config.get('gitinfo').local.branch.current.SHA)
.replace(/<%= load_jquery %>/g, true)
}
},
files: {
// Library without Leaflet library
'<%= config.dist %>/_cartodb_noleaflet.js':
['grunt/templates/wrapper_header.js']
.concat(vendor_files)
.concat([
'!./vendor/leaflet.js',
'grunt/templates/wrapper_middle.js'
])
.concat(cdb_files)
.concat(['grunt/templates/wrapper_footer.js'])
}
},
torque: {
options: {
banner: grunt.file.read('./grunt/templates/version_header.js'),
footer: grunt.file.read('./grunt/templates/torque_footer.js')
},
files: {
// Torque library
'<%= config.dist %>/cartodb.mod.torque.uncompressed.js': [
'./grunt/templates/torque_header.js',
'vendor/mod/carto.js',
'vendor/mod/torque.uncompressed.js',
'src/geo/gmaps/torque.js',
'src/geo/leaflet/torque.js',
'src/geo/ui/time_slider.js',
'vendor/mod/jquery-ui/jquery.ui.core.js',
'vendor/mod/jquery-ui/jquery.ui.widget.js',
'vendor/mod/jquery-ui/jquery.ui.mouse.js',
'vendor/mod/jquery-ui/jquery.ui.slider.js'
]
}
},
odyssey: {
options: {
banner: grunt.file.read('./grunt/templates/version_header.js'),
footer: grunt.file.read('./grunt/templates/odyssey_footer.js')
},
files: {
// Odyssey library
'<%= config.dist %>/cartodb.mod.odyssey.uncompressed.js': [
'vendor/mod/odyssey.js'
]
}
},
themes: {
options: {},
files: {
// CartoDB.js CSSs (themes?)
'<%= config.dist %>/themes/css/cartodb.css': [
'themes/css/infowindow/*.css',
'themes/css/map/*.css',
'themes/css/tooltip/*.css',
'!themes/css/cartodb.css'
],
'<%= config.dist %>/themes/css/cartodb.ie.css': [
'themes/css/ie/*.css',
'!themes/css/cartodb.ie.css'
]
}
}
}
}
}
@@ -0,0 +1,20 @@
/**
* Watch grunt task for CartoDB.js
*
*/
module.exports = {
task: function() {
return {
server: [
'compass:server',
'copy:stageCss',
],
dist: [
'compass:dist',
'copy:dist'
]
}
}
}
@@ -0,0 +1,46 @@
/**
* Connect grunt task for CartoDB.js website
*
*/
module.exports = {
task: function(config) {
return {
options: {
port: 9001,
livereload: 35730,
// change this to '0.0.0.0' to access the server from outside
hostname: '0.0.0.0'
},
livereload: {
options: {
middleware: function(connect) {
return [
connect.static('.tmp'),
connect().use('/bower_components', connect.static('./bower_components')),
connect.static(config.app)
];
}
}
},
dist: {
options: {
open: true,
base: [
'<%= config.dist %>/<%= config.app %>'
]
}
},
test: {
options: {
base: [
'.tmp',
'test',
'<%= config.app %>'
]
}
}
}
}
}
@@ -0,0 +1,101 @@
/**
* Copy grunt task for CartoDB.js
*
*/
var __ = require('underscore');
var findup = require('findup-sync');
module.exports = {
task: function(grunt, config) {
return {
options: {
noProcess: ['**/*.{png,gif,jpg,ico}'],
process: function (content, srcpath) {
// Replace string task corrupts images
if(srcpath.substr(srcpath.length - 3) === '.js' || srcpath.substr(srcpath.length - 5) === '.html') {
// Get all examples
var examples = [];
grunt.file.expand("examples/*").forEach(function (dir) {
var path = dir + '/demo.details';
if (grunt.file.exists(path)) {
var data = grunt.file.readYAML(path);
data.dir = dir.replace('examples/', '');
examples.push(data);
}
});
return __.template(content)({
last_bugfixing_version: config.version.bugfixing,
last_minor_version: config.version.minor,
last_major_version: config.version.major,
examples: examples
});
}
return content;
}
},
dist: {
files: [{
expand: true,
dot: true,
cwd: '<%= config.app %>',
src: [
'**/*.html',
'sitemap.xml',
'robots.txt',
'img/**/*',
'fonts/**/*',
'!**/_*{,/**}',
'favicon.ico'
],
dest: '<%= config.dist %>/<%= config.app %>'
}]
},
stageCss: {
files: [{
expand: true,
dot: true,
cwd: '<%= config.app %>/css',
src: '**/*.css',
dest: '.tmp/css'
}]
},
stageStatic: {
files: [{
expand: true,
dot: true,
cwd: '<%= config.app %>',
src: [
'**/*.html',
'sitemap.xml',
'robots.txt',
'img/**/*',
'fonts/**/*',
'!**/_*{,/**}',
'favicon.ico'
],
dest: '.tmp'
}]
},
distStatic: {
files: [{
expand: true,
dot: true,
cwd: 'themes/img',
src: [ '**/*.{png,jpg,gif}' ],
dest: '<%= config.dist %>/themes/img'
}]
}
}
}
}
@@ -0,0 +1,21 @@
/**
* Css lint grunt task for CartoDB.js
*
*/
module.exports = {
task: function() {
return {
options: {
csslintrc: 'grunt/.csslintrc'
},
check: {
src: [
'<%= config.app %>/css/**/*.css',
'<%= config.app %>/_scss/**/*.scss'
]
}
}
}
}
@@ -0,0 +1,29 @@
/**
* Css lint grunt task for CartoDB.js
*
*/
module.exports = {
task: function() {
return {
dist: {
options: {
check: 'gzip'
}
},
themes: {
options: {
banner: '/* CartoDB.css minified version: <%= config.version.bugfixing %> */',
check: 'gzip'
},
files: {
'<%= config.dist %>/themes/css/cartodb.css': ['<%= config.dist %>/themes/css/cartodb.css'],
'<%= config.dist %>/themes/css/cartodb.ie.css': ['<%= config.dist %>/themes/css/cartodb.ie.css']
}
}
}
}
}
@@ -0,0 +1,21 @@
/**
* Fastly invalidation grunt task for CartoDB.js
*
*/
module.exports = {
task: function() {
return {
options: {
key: '<%= secrets.FASTLY_API_KEY %>'
},
dist: {
options: {
purgeAll: true,
serviceId: '<%= secrets.FASTLY_CARTODB_SERVICE %>'
}
},
}
}
}
@@ -0,0 +1,25 @@
/**
* File revision grunt task for CartoDB.js
*
*/
module.exports = {
task: function() {
return {
options: {
length: 4
},
dist: {
files: [{
src: [
'<%= config.dist %>/<%= config.app %>/js/**/*.js',
'<%= config.dist %>/<%= config.app %>/css/**/*.css',
'<%= config.dist %>/<%= config.app %>/img/**/*.{gif,jpg,jpeg,png,svg,webp}',
'<%= config.dist %>/<%= config.app %>/fonts/**/*.{eot*,otf,svg,ttf,woff}'
]
}]
}
}
}
}
@@ -0,0 +1,26 @@
/**
* HTML minifier grunt task for CartoDB.js
*
*/
module.exports = {
task: function() {
return {
dist: {
options: {
collapseWhitespace: true,
collapseBooleanAttributes: true,
removeAttributeQuotes: true,
removeRedundantAttributes: true
},
files: [{
expand: true,
cwd: '<%= config.dist %>/<%= config.app %>',
src: '**/*.html',
dest: '<%= config.dist %>/<%= config.app %>'
}]
}
}
}
}
@@ -0,0 +1,47 @@
/**
* Image minifier grunt task for CartoDB.js
*
*/
module.exports = {
task: function() {
return {
dist: {
options: {
progressive: true
},
files: [{
expand: true,
cwd: '<%= config.dist %>/<%= config.app %>',
src: ['*.{png,jpg,gif}'],
dest: '<%= config.dist %>/<%= config.app %>'
}]
},
distCSSImages: {
options: {
progressive: true
},
files: [{
expand: true,
cwd: 'themes/css',
src: [ 'images/**/*.{png,jpg,gif}' ],
dest: '<%= config.dist %>/themes/css'
}]
},
distImages: {
options: {
progressive: true
},
files: [{
expand: true,
cwd: 'themes/img',
src: [ '**/*.{png,jpg,gif}' ],
dest: '<%= config.dist %>/themes/img'
}]
},
}
}
}
@@ -0,0 +1,104 @@
/**
* Jasmine grunt task for CartoDB.js tests
*
*/
module.exports = {
task: function() {
return {
dist: {
src: [
'vendor/jquery.min.js',
'vendor/underscore-min.js',
'vendor/backbone.js',
'vendor/leaflet.js',
'vendor/wax.cartodb.js',
'vendor/mustache.js',
'vendor/GeoJSON.js',
'vendor/jscrollpane.js',
'vendor/spin.js',
'vendor/lzma.js',
'vendor/mod/carto.js',
'vendor/mod/torque.uncompressed.js',
'vendor/mod/jquery-ui/jquery.ui.core.js',
'vendor/mod/jquery-ui/jquery.ui.widget.js',
'vendor/mod/jquery-ui/jquery.ui.mouse.js',
'vendor/mod/jquery-ui/jquery.ui.slider.js',
'vendor/html-css-sanitizer-bundle.js',
'test/lib/sinon-1.3.4.js',
'test/lib/sinon-ie.js',
'src/cartodb.js',
'src/core/**/*.js',
'src/geo/geometry.js',
'src/geo/map.js',
'src/geo/ui/header.js',
'src/geo/ui/legend.js',
'src/geo/ui/infobox.js',
'src/geo/ui/infowindow.js',
'src/geo/ui/search.js',
'src/geo/ui/mobile.js',
'src/geo/ui/annotation.js',
'src/geo/ui/layer_selector.js',
'src/geo/ui/slides_controller.js',
'src/geo/ui/share.js',
'src/geo/ui/zoom_info.js',
'src/geo/ui/tiles_loader.js',
'src/geo/ui/zoom.js',
'src/geo/ui/tooltip.js',
'src/geo/ui/time_slider.js',
'src/geo/ui/fullscreen.js',
'src/geo/sublayer.js',
'src/geo/layer_definition.js',
'src/geo/common.js',
'src/geo/leaflet/leaflet.geometry.js',
'src/geo/leaflet/leaflet_base.js',
'src/geo/leaflet/leaflet_plainlayer.js',
'src/geo/leaflet/leaflet_tiledlayer.js',
'src/geo/leaflet/leaflet_gmaps_tiledlayer.js',
'src/geo/leaflet/leaflet_wmslayer.js',
'src/geo/leaflet/leaflet_cartodb_layergroup.js',
'src/geo/leaflet/leaflet_cartodb_layer.js',
'src/geo/leaflet/torque.js',
'src/geo/leaflet/leaflet.js',
'src/geo/gmaps/gmaps.geometry.js',
'src/geo/gmaps/gmaps_base.js',
'src/geo/gmaps/gmaps_baselayer.js',
'src/geo/gmaps/gmaps_plainlayer.js',
'src/geo/gmaps/gmaps_tiledlayer.js',
'src/geo/gmaps/gmaps_cartodb_layergroup.js',
'src/geo/gmaps/gmaps_cartodb_layer.js',
'src/geo/gmaps/torque.js',
'src/geo/gmaps/gmaps.js',
'src/geo/geocoders/mapbox_geocoder.js',
'src/geo/geocoders/mapzen_geocoder.js',
'src/geo/geocoders/nokia_geocoder.js',
'src/geo/geocoders/tomtom_geocoder.js',
'src/geo/geocoders/yahoo_geocoder.js',
'src/ui/common/dialog.js',
'src/ui/common/share.js',
'src/ui/common/notification.js',
'src/ui/common/table.js',
'src/ui/common/tabpane.js',
'src/ui/common/dropdown.js',
'src/vis/vis.js',
'src/vis/image.js',
'src/vis/layers.js',
'src/vis/overlays.js',
'src/api/layers.js',
'src/api/sql.js',
'src/api/vis.js'
],
options: {
keepRunner: true,
outfile: 'test/SpecRunner.html',
specs: 'test/spec/**/*.js',
helpers: 'test/spec/SpecHelper.js',
vendor: [ "http://maps.googleapis.com/maps/api/js?sensor=false&v=3.32" ],
summary: true,
display: 'short'
}
}
}
}
}
@@ -0,0 +1,23 @@
/**
* JS hint grunt task for CartoDB.js
*
*/
module.exports = {
task: function() {
return {
options: {
jshintrc: 'grunt/.jshintrc',
reporter: require('jshint-stylish')
},
all: [
'Gruntfile.js',
'<%= config.app %>/js/**/*.js',
'test/spec/**/*.js'
]
}
}
}
@@ -0,0 +1,86 @@
/**
* Prompt grunt task for CartoDB.js
*
*/
var semver = require('semver');
module.exports = {
task: function(grunt, config) {
return {
bump: {
options: {
questions: [
{
config: 'bump.increment',
type: 'list',
message: 'Bump version from ' + '<%= config.pkg.version %>'.cyan + ' to:',
choices: [
{
value: 'build',
name: 'Build: '.yellow + (config.version.bugfixing).yellow +
' Current version.'
},
{
value: 'patch',
name: 'Patch: '.yellow + semver.inc(config.version.bugfixing, 'patch').yellow +
' Backwards-compatible bug fixes.'
},
{
value: 'minor',
name: 'Minor: '.yellow + semver.inc(config.version.bugfixing, 'minor').yellow +
' Add functionality in a backwards-compatible manner.'
},
{
value: 'major',
name: 'Major: '.yellow + semver.inc(config.version.bugfixing, 'major').yellow +
' Incompatible API changes.'
},
{
value: 'custom',
name: 'Custom: ?.?.?'.yellow +
' Specify version... (eg. 3.0.0-beta)'
}
]
},
{
config: 'bump.version',
type: 'input',
message: 'What specific version would you like',
when: function (answers) {
return answers['bump.increment'] === 'custom';
},
validate: function (value) {
var valid = semver.valid(value) && true;
return valid || 'Must be a valid semver, such as 1.2.3-rc1. See ' +
'http://semver.org/'.blue.underline + ' for more details.';
}
}
],
then: function(results, done) {
var bump = grunt.config.get('bump');
var version = '';
if (bump.increment !== "custom") {
switch (bump.increment) {
case 'build':
version = config.version.bugfixing;
break;
default:
version = semver.inc(config.version.bugfixing, bump.increment);
}
bump.version = version;
}
var version_arr = bump.version.split('.');
bump.minor = version_arr[0] + '.' + version_arr[1];
grunt.config.set('bump', bump);
done();
}
}
}
}
}
}
@@ -0,0 +1,132 @@
/**
* Replace strings grunt task for CartoDB.js
*
*/
module.exports = {
task: function(grunt, config) {
return {
cdb: {
options: {
patterns: [{
match: '/cdb.VERSION = "<%= config.version.bugfixing %>"/g',
replacement: 'cdb.VERSION = "<%= grunt.config(\'bump.version\') %>"',
expression: true
}]
},
files: [{
expand: true,
flatten: true,
src: ['src/cartodb.js'],
dest: 'src/'
}]
},
pkg: {
options: {
patterns: [{
match: '/"version": "<%= config.version.bugfixing %>"/g',
replacement: '"version": "<%= grunt.config(\'bump.version\') %>"',
expression: true
}]
},
files: [{
expand: true,
flatten: true,
src: ['package.json'],
dest: ''
}]
},
readme: {
options: {
patterns: [{
match: '/<%= config.version.minor %>/gi',
replacement: "<%= grunt.config('bump.minor') %>",
expression: true
}]
},
files: [{
expand: true,
flatten: true,
src: ['README.md'],
dest: ''
}]
},
api: {
options: {
patterns: [{
match: '/\/<%= config.version.minor %>\//gi',
replacement: "/<%= grunt.config('bump.minor') %>/",
expression: true
},{
match: '/<%= config.version.bugfixing %>/gi',
replacement: "<%= grunt.config('bump.version') %>",
expression: true
}]
},
files: [{
expand: true,
flatten: true,
src: ['doc/API.md'],
dest: 'doc/'
}]
},
examples: {
options: {
patterns: [{
match: '/\/<%= config.version.minor %>\//gi',
replacement: "/<%= grunt.config('bump.minor') %>/",
expression: true
}]
},
files: [{
expand: true,
flatten: true,
src: ['examples/**/*.html'],
dest: 'examples/'
}]
},
releasing: {
options: {
patterns: [{
match: '/\/<%= config.version.minor %>\//gi',
replacement: "/<%= grunt.config('bump.minor') %>/",
expression: true
},{
match: '/<%= config.version.bugfixing %>/gi',
replacement: "<%= grunt.config('bump.version') %>",
expression: true
}]
},
files: [{
expand: true,
flatten: true,
src: ['RELEASING.md'],
dest: ''
}]
},
bower: {
options: {
patterns: [{
match: '/"version": "<%= config.version.bugfixing %>"/g',
replacement: '"version": "<%= grunt.config(\'bump.version\') %>"',
expression: true
}]
},
files: [{
expand: true,
flatten: true,
src: ['bower.json'],
dest: ''
}]
},
}
}
}
@@ -0,0 +1,217 @@
/**
* S3 upload grunt task for CartoDB.js
*
*/
module.exports = {
task: function(grunt, config) {
return {
options: {
accessKeyId: "<%= secrets.S3_KEY %>",
secretAccessKey: "<%= secrets.S3_SECRET %>",
bucket: "<%= secrets.S3_BUCKET %>",
dryRun: false
},
'js-bugfixing': {
options: {
overwrite: true,
cache: false,
gzip: true,
headers: {
ContentType: 'application/x-javascript'
}
},
files: [
{
// Bug fixing version
action: 'upload',
expand: true,
cwd: 'dist',
src: [
'*.js',
'!_*.js'
],
dest: "cartodb.js/v<%= config.version.major %>/<%= config.version.bugfixing %>"
}
]
},
'js-minor': {
options: {
overwrite: true,
cache: false,
gzip: true,
// It will not upload minor vesion when it comes from a
// custom version, because it could overwrite production
// version
dryRun: isVersionPrerelease(config.version.bugfixing),
headers: {
ContentType: 'application/x-javascript'
}
},
files: [{
// Minor version
action: 'upload',
expand: true,
cwd: 'dist',
src: [
'*.js',
'!_*.js'
],
dest: "cartodb.js/v<%= config.version.major %>/<%= config.version.minor %>"
}
]
},
'css-bugfixing': {
options: {
overwrite: true,
cache: false,
gzip: true,
headers: {
ContentType: 'text/css'
}
},
files: [
{
// Bug fixing version
action: 'upload',
expand: true,
cwd: 'dist',
src: [
'themes/**/*.css'
],
dest: "cartodb.js/v<%= config.version.major %>/<%= config.version.bugfixing %>"
}
]
},
'css-minor': {
options: {
overwrite: true,
cache: false,
dryRun: isVersionPrerelease(config.version.bugfixing),
gzip: true,
headers: {
ContentType: 'text/css'
}
},
files: [{
// Minor version
action: 'upload',
expand: true,
cwd: 'dist',
src: [
'themes/**/*.css'
],
dest: "cartodb.js/v<%= config.version.major %>/<%= config.version.minor %>"
}
]
},
'png-bugfixing': {
options: {
overwrite: true,
cache: false,
gzip: false,
headers: {
ContentType: 'image/png'
}
},
files: [
{
// Bug fixing version
action: 'upload',
expand: true,
cwd: 'dist',
src: [
'themes/**/*.png'
],
dest: "cartodb.js/v<%= config.version.major %>/<%= config.version.bugfixing %>"
}
]
},
'png-minor': {
options: {
overwrite: true,
cache: false,
gzip: false,
headers: {
ContentType: 'image/png'
},
dryRun: isVersionPrerelease(config.version.bugfixing)
},
files: [
{
// Minor version
action: 'upload',
expand: true,
cwd: 'dist',
src: [
'themes/**/*.png'
],
dest: "cartodb.js/v<%= config.version.major %>/<%= config.version.minor %>"
}
]
},
'gif-bugfixing': {
options: {
overwrite: true,
cache: false,
gzip: false,
headers: {
ContentType: 'image/gif'
}
},
files: [
{
// Bug fixing version
action: 'upload',
expand: true,
cwd: 'dist',
src: [
'themes/**/*.gif'
],
dest: "cartodb.js/v<%= config.version.major %>/<%= config.version.bugfixing %>"
}
]
},
'gif-minor': {
options: {
overwrite: true,
cache: false,
gzip: false,
headers: {
ContentType: 'image/gif'
},
dryRun: isVersionPrerelease(config.version.bugfixing)
},
files: [
{
// Minor version
action: 'upload',
expand: true,
cwd: 'dist',
src: [
'themes/**/*.gif'
],
dest: "cartodb.js/v<%= config.version.major %>/<%= config.version.minor %>"
}
]
}
}
}
}
// How to know if the version is prerelease or
// not :(
function isVersionPrerelease(v) {
var v = v.split('.');
return !/^[0-9]+$/.test(v[v.length - 1]);
}
@@ -0,0 +1,20 @@
/**
* SVG grunt task for CartoDB.js
*
*/
module.exports = {
task: function() {
return {
dist: {
files: [{
expand: true,
cwd: '<%= config.dist %>/<%= config.app %>',
src: '**/*.svg',
dest: '<%= config.dist %>/<%= config.app %>'
}]
}
}
}
}
@@ -0,0 +1,25 @@
/**
* Uglify grunt task for CartoDB.js
*
*/
module.exports = {
task: function() {
return {
dist: {
options: {
banner: '// CartoDB.js version: <%= grunt.config("bump.version") %> \n' +
'// sha: <%= grunt.config.get("gitinfo").local.branch.current.SHA %> \n'
},
files: {
'<%= config.dist %>/cartodb.js': ['<%= config.dist %>/cartodb.uncompressed.js'],
'<%= config.dist %>/cartodb.core.js': ['<%= config.dist %>/cartodb.core.uncompressed.js'],
'<%= config.dist %>/cartodb_nojquery.js': ['<%= config.dist %>/_cartodb_nojquery.js'],
'<%= config.dist %>/cartodb_noleaflet.js': ['<%= config.dist %>/_cartodb_noleaflet.js'],
'<%= config.dist %>/cartodb.mod.torque.js': ['<%= config.dist %>/cartodb.mod.torque.uncompressed.js']
}
}
}
}
}
@@ -0,0 +1,17 @@
/**
* Css lint grunt task for CartoDB.js
*
*/
module.exports = {
task: function() {
return {
options: {
assetsDirs: '<%= config.dist %>/<%= config.app %>',
},
html: ['<%= config.dist %>/<%= config.app %>/**/*.html'],
css: ['<%= config.dist %>/<%= config.app %>/css/**/*.css']
}
}
}
@@ -0,0 +1,18 @@
/**
* User min prepare grunt task for CartoDB.js
*
*/
module.exports = {
task: function() {
return {
options: {
dest: '<%= config.dist %>/<%= config.app %>'
},
html: [
'<%= config.dist %>/<%= config.app %>/**/*.html',
]
}
}
}
@@ -0,0 +1,35 @@
/**
* Watch grunt task for CartoDB.js
*
*/
module.exports = {
task: function() {
return {
compass: {
files: ['<%= config.app %>/_scss/**/*.{scss,sass}'],
tasks: ['compass:server', 'autoprefixer:server']
},
autoprefixer: {
files: ['<%= config.app %>/css/**/*.css'],
tasks: ['copy:stageCss', 'autoprefixer:server']
},
livereload: {
options: {
livereload: '<%= connect.options.livereload %>'
},
files: [
'<%= config.app %>/**/*.html',
'.tmp/css/**/*.css',
'{.tmp,<%= config.app %>}/js/**/*.js',
'<%= config.app %>/img/**/*.{gif,jpg,jpeg,png,svg,webp}'
],
tasks: ['copy:stageStatic']
}
}
}
}
@@ -0,0 +1,2 @@
})();
//cartodb.core end
@@ -0,0 +1,4 @@
;(function() {
this.cartodb = {};
var Backbone = {};
@@ -0,0 +1 @@
cartodb.moduleLoad('odyssey', O);
@@ -0,0 +1,8 @@
// Restores any previous global libraries, e.g. jQuery
for (var lib in window._prev){
window[lib] = window._prev[lib];
}
cartodb.moduleLoad('torque', torque);
Profiler = cartodb.core.Profiler;
@@ -0,0 +1,7 @@
if(cartodb){
// Keep the global version of jQuery, if there is any
if(window.$){
window._prev = {jQuery: window.$, $: window.$}
}
window.$ = window.jQuery = cartodb.$;
}
@@ -0,0 +1,2 @@
var _ = this._; _.noConflict();
@@ -0,0 +1,3 @@
// version: <%= grunt.config.get('bump.version') %>
// sha: <%= gitinfo.local.branch.current.SHA %>
@@ -0,0 +1,22 @@
cdb.$ = $;
cdb.L = L;
cdb.Mustache = Mustache;
cdb.Backbone = Backbone;
cdb._ = _;
})();
;
for(var i in __prev) {
// keep it at global context if it didn't exist
if(__prev[i]) {
window[i] = __prev[i];
}
}
})();
@@ -0,0 +1,22 @@
// cartodb.js version: <%= version %>
// uncompressed version: cartodb.uncompressed.js
// sha: <%= sha %>
(function() {
var define; // Undefine define (require.js), see https://github.com/CartoDB/cartodb.js/issues/543
var root = this;
if(!<%= load_jquery %>) {
if(root.jQuery === undefined) {
throw "jQuery should be loaded before include cartodb.js";
}
}
// save current libraries
var __prev = {
jQuery: root.jQuery,
$: root.$,
L: root.L,
Mustache: root.Mustache,
Backbone: root.Backbone,
_: root._
};
@@ -0,0 +1,10 @@
// mustache does no defined a global var, defines a var Mustache instead
// so add it to root
root.Mustache = Mustache;
(function() {
var $ = root.$;
var jQuery = root.jQuery;
var L = root.L;
var Mustache = root.Mustache;
var Backbone = root.Backbone;
var _ = root._;