Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplifying grunt and bower #925

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
475 changes: 67 additions & 408 deletions Gruntfile.js

Large diffs are not rendered by default.

11 changes: 2 additions & 9 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,8 @@
"version": "2.0.0-alpha.2",
"main": ["dc.js", "dc.css"],
"ignore": [
".gitignore",
".travis.yml",
"build.xml",
"globals.js",
"index.js",
"make",
"package.json",
"test",
"src"
"*",
"!dc.*"
],
"dependencies": {
"d3": "3.x",
Expand Down
20 changes: 18 additions & 2 deletions dc.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dc.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dc.min.js.map

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions grunt/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = function(grunt) {
grunt.registerTask('build', ['concat', 'uglify']);
};
3 changes: 3 additions & 0 deletions grunt/ci-pull.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = function(grunt) {
grunt.registerTask('ci-pull', ['test', 'jasmine:specs:build', 'connect:server']);
};
3 changes: 3 additions & 0 deletions grunt/ci.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = function(grunt) {
grunt.registerTask('ci', ['test', 'jasmine:specs:build', 'connect:server', 'saucelabs-jasmine']);
};
3 changes: 3 additions & 0 deletions grunt/coverage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = function(grunt) {
grunt.registerTask('coverage', ['build', 'jasmine:coverage']);
};
3 changes: 3 additions & 0 deletions grunt/default.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = function(grunt) {
grunt.registerTask('default', ['build']);
};
3 changes: 3 additions & 0 deletions grunt/docs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = function(grunt) {
grunt.registerTask('docs', ['build', 'copy', 'emu', 'toc', 'markdown', 'docco']);
};
10 changes: 10 additions & 0 deletions grunt/emu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = function(grunt) {
grunt.registerMultiTask('emu', 'Documentation extraction by emu.', function () {
var emu = require('emu'),
srcFile = this.files[0].src[0],
destFile = this.files[0].dest,
source = grunt.file.read(srcFile);
grunt.file.write(destFile, emu.getComments(source));
grunt.log.writeln('File \'' + destFile + '\' created.');
});
};
3 changes: 3 additions & 0 deletions grunt/lint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = function(grunt) {
grunt.registerTask('lint', ['build', 'jshint', 'jscs']);
};
6 changes: 6 additions & 0 deletions grunt/merge.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = function(grunt) {
grunt.registerTask('merge', 'Merge a github pull request.', function (pr) {
grunt.log.writeln('Merge Github Pull Request #' + pr);
grunt.task.run(['shell:merge:' + pr, 'test' , 'shell:amend']);
});
};
11 changes: 11 additions & 0 deletions grunt/options/browserify.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
dev: {
src: '<%= conf.pkg.name %>.js',
dest: 'bundle.js',
options: {
browserifyOptions: {
standalone: 'dc'
}
}
}
};
11 changes: 11 additions & 0 deletions grunt/options/concat.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
options: {
process: true,
sourceMap: true,
banner : '<%= conf.banner %>'
},
js: {
src: '<%= conf.jsFiles %>',
dest: '<%= conf.pkg.name %>.js'
}
};
8 changes: 8 additions & 0 deletions grunt/options/connect.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
server: {
options: {
port: 8888,
base: '.'
}
}
};
21 changes: 21 additions & 0 deletions grunt/options/copy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module.exports = {
'dc-to-gh': {
files: [
{expand: true, flatten: true, src: '<%= conf.pkg.name %>.css', dest: '<%= conf.web %>/css/'},
{
expand: true,
flatten: true,
src: [
'<%= conf.pkg.name %>.js',
'<%= conf.pkg.name %>.js.map',
'<%= conf.pkg.name %>.min.js',
'<%= conf.pkg.name %>.min.js.map',
'node_modules/d3/d3.js',
'node_modules/crossfilter/crossfilter.js',
'test/env-data.js'
],
dest: '<%= conf.web %>/js/'
}
]
}
};
13 changes: 13 additions & 0 deletions grunt/options/docco.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
options: {
dst: '<%= conf.web %>/docs',
basepath:'<%= conf.web %>'
},
howto: {
files: [
{
src: ['<%= conf.web %>/stock.js']
}
]
}
};
6 changes: 6 additions & 0 deletions grunt/options/emu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
api: {
src: '<%= conf.pkg.name %>.js',
dest: '<%= conf.web %>/docs/api-latest.md'
}
};
41 changes: 41 additions & 0 deletions grunt/options/fileindex.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
module.exports = {
'examples-listing': {
options: {
format: function (list) {
var examples = list.sort().map(function (entry) {
return entry.replace(/.*examples\//, '');
}).filter(function (e) { return e !== 'index.html'; });
var rows = [];
for (var i = 0; i < examples.length; i += 5) {
var cols = [];
for (var j = 0; j < 5; ++j) {
if (i + j >= examples.length) {
break;
}
var fname = examples[i + j];
cols.push(' <td><a href="' + fname + '">' + fname + '</a></td>');
}
rows.push(' <tr>\n' + cols.join('\n') + '\n<tr>');
}
var body = '<table class="table">\n' + rows.join('\n') + '\n</table>';
return [
'<html><head><title>Index of dc.js examples</title>',
'<link rel="stylesheet" type="text/css" href="../css/bootstrap.min.css"></head>',
'<body><div class="container">',
'<h2>Examples of using dc.js</h2>',
'<p>An attempt to present a simple example of each chart type.',
'<a href="https://github.com/dc-js/dc.js/blob/master/CONTRIBUTING.md">',
'Contributions welcome</a>.</p>',
'<p>Source <a href="https://github.com/dc-js/dc.js/tree/master/<%= conf.web %>/examples">',
'here</a>.</p>',
body,
'</div></body></html>'
].join('\n');
},
absolute: true
},
files: [
{dest: '<%= conf.web %>/examples/index.html', src: ['<%= conf.web %>/examples/*.html']}
]
}
};
7 changes: 7 additions & 0 deletions grunt/options/gh-pages.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
options: {
base: '<%= conf.web %>',
message: 'Synced from from master branch.'
},
src: ['**']
};
53 changes: 53 additions & 0 deletions grunt/options/jasmine.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
module.exports = {
specs: {
options: {
display: 'short',
summary: true,
specs: '<%= conf.spec %>/*-spec.js',
helpers: '<%= conf.spec %>/helpers/*.js',
version: '2.0.0',
outfile: '<%= conf.spec %>/index.html',
keepRunner: true
},
src: [
'<%= conf.web %>/js/d3.js',
'<%= conf.web %>/js/crossfilter.js',
'<%= conf.web %>/js/colorbrewer.js',
'<%= conf.pkg.name %>.js'
]
},
coverage:{
src: '<%= jasmine.specs.src %>',
options:{
specs: '<%= jasmine.specs.options.specs %>',
helpers: '<%= jasmine.specs.options.helpers %>',
version: '<%= jasmine.specs.options.version %>',
template: require('grunt-template-jasmine-istanbul'),
templateOptions: {
coverage: 'coverage/jasmine/coverage.json',
report: [
{
type: 'html',
options: {
dir: 'coverage/jasmine'
}
}
]
}
}
},
browserify: {
options: {
display: 'short',
summary: true,
specs: '<%= conf.spec %>/*-spec.js',
helpers: '<%= conf.spec %>/helpers/*.js',
version: '2.0.0',
outfile: '<%= conf.spec %>/index-browserify.html',
keepRunner: true
},
src: [
'bundle.js'
]
}
};
15 changes: 15 additions & 0 deletions grunt/options/jscs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module.exports = {
old: {
src: ['<%= conf.spec %>/**/*.js'],
options: {
validateIndentation: 4
}
},
source: {
src: ['<%= conf.src %>/**/*.js', '!<%= conf.src %>/{banner,footer}.js', 'Gruntfile.js',
'<%= conf.web %>/stock.js'],
options: {
config: '.jscsrc'
}
}
};
9 changes: 9 additions & 0 deletions grunt/options/jshint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
source: {
src: ['<%= conf.src %>/**/*.js', 'Gruntfile.js', '<%= conf.web %>/stock.js'],
options: {
jshintrc: '.jshintrc',
ignores: ['<%= conf.src %>/banner.js', '<%= conf.src %>/footer.js']
}
}
};
7 changes: 7 additions & 0 deletions grunt/options/markdown.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
html: {
src: '<%= emu.api.dest %>',
dest: '<%= conf.web %>/docs/index.html'
},
options: {markdownOptions: {highlight: 'manual'}}
};
28 changes: 28 additions & 0 deletions grunt/options/saucelabs-jasmine.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
module.exports = {
all: {
options: {
urls: ['http://localhost:8888/spec/'],
tunnelTimeout: 5,
build: process.env.TRAVIS_JOB_ID,
concurrency: 3,
browsers: [
{
browserName: 'firefox',
version: '25',
platform: 'linux'
},
{
browserName: 'safari',
version: '7',
platform: 'OS X 10.9'
},
{
browserName: 'internet explorer',
version: '10',
platform: 'WIN8'
}
],
testname: '<%= conf.pkg.name %>.js'
}
}
};
28 changes: 28 additions & 0 deletions grunt/options/shell.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
module.exports = {
merge: {
command: function (pr) {
return [
'git fetch origin',
'git checkout master',
'git reset --hard origin/master',
'git fetch origin',
'git merge --no-ff origin/pr/' + pr + ' -m \'Merge pull request #' + pr + '\''
].join('&&');
},
options: {
stdout: true,
failOnError: true
}
},
amend: {
command: 'git commit -a --amend --no-edit',
options: {
stdout: true,
failOnError: true
}
},
hooks: {
command: 'cp -n scripts/pre-commit.sh .git/hooks/pre-commit' +
' || echo \'Cowardly refusing to overwrite your existing git pre-commit hook.\''
}
};
6 changes: 6 additions & 0 deletions grunt/options/toc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
api: {
src: '<%= emu.api.dest %>',
dest: '<%= emu.api.dest %>'
}
};
12 changes: 12 additions & 0 deletions grunt/options/uglify.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
jsmin: {
options: {
mangle: true,
compress: true,
sourceMap: true,
banner : '<%= conf.banner %>'
},
src: '<%= conf.pkg.name %>.js',
dest: '<%= conf.pkg.name %>.min.js'
}
};
Loading