Skip to content

Commit 3d4e24d

Browse files
committed
Adding project config files
1 parent 87375ab commit 3d4e24d

File tree

5 files changed

+356
-3
lines changed

5 files changed

+356
-3
lines changed

.gitignore

+35-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,35 @@
1-
node_modules/*
2-
!node_modules/crossfilter
1+
2+
# tmp files
3+
*.log
4+
*~
5+
6+
# local files
7+
node_modules
8+
bower_components
9+
10+
# ide files
11+
*.iml
12+
.idea
13+
.project
14+
15+
# vim files
16+
.*.swp
17+
18+
# mac
19+
.DS_Store
20+
21+
# ctag
22+
.tags
23+
24+
# files for gh-pages and grunt-contrib-jasmine
25+
.grunt
26+
27+
# jasmine spec runners
28+
spec/*.html
29+
30+
# coverage reports
31+
coverage
32+
33+
# browserify bundle & test
34+
bundle.js
35+
spec/index-browserify.html

.jscsrc

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
{
2+
"requireCurlyBraces": [
3+
"if",
4+
"else",
5+
"for",
6+
"while",
7+
"do",
8+
"try",
9+
"catch"
10+
],
11+
"requireOperatorBeforeLineBreak": true,
12+
"requireSpacesInsideArrayBrackets": "allButNested",
13+
"requireSpacesInsideObjectBrackets": "allButNested",
14+
"requireSpacesInsideParentheses": {
15+
"all": true
16+
},
17+
"requireCamelCaseOrUpperCaseIdentifiers": true,
18+
"maximumLineLength": {
19+
"value": 120,
20+
"allowComments": true,
21+
"allowRegex": true
22+
},
23+
"validateIndentation": 4,
24+
"validateQuoteMarks": "'",
25+
"disallowMultipleLineStrings": true,
26+
"disallowMixedSpacesAndTabs": true,
27+
"disallowTrailingWhitespace": true,
28+
"requireSpaceAfterKeywords": [
29+
"if",
30+
"else",
31+
"for",
32+
"while",
33+
"do",
34+
"switch",
35+
"return",
36+
"try",
37+
"catch"
38+
],
39+
"requireSpaceBeforeBinaryOperators": [
40+
"=",
41+
"+=",
42+
"-=",
43+
"*=",
44+
"/=",
45+
"%=",
46+
"<<=",
47+
">>=",
48+
">>>=",
49+
"&=",
50+
"|=",
51+
"^=",
52+
"+=",
53+
"+",
54+
"-",
55+
"*",
56+
"/",
57+
"%",
58+
"<<",
59+
">>",
60+
">>>",
61+
"&",
62+
"|",
63+
"^",
64+
"&&",
65+
"||",
66+
"===",
67+
"==",
68+
">=",
69+
"<=",
70+
"<",
71+
">",
72+
"!=",
73+
"!=="
74+
],
75+
"requireSpaceAfterLineComment": { "allExcept": ["#", "="] },
76+
"requireSpaceBeforeBlockStatements": true,
77+
"requireSpaceAfterBinaryOperators": true,
78+
"requireSpacesInConditionalExpression": true,
79+
"requireSpacesInFunctionExpression": {
80+
"beforeOpeningCurlyBrace": true
81+
},
82+
"validateJSDoc": {
83+
"checkParamNames": true,
84+
"requireParamTypes": true
85+
}
86+
}

.jshintrc

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"browser": true,
3+
"camelcase": true,
4+
"curly": true,
5+
"eqeqeq": true,
6+
"evil": false,
7+
"immed": true,
8+
"latedef": true,
9+
"loopfunc": true,
10+
"maxlen": 120,
11+
"multistr": true,
12+
"newcap": true,
13+
"noarg": true,
14+
"noempty": true,
15+
"nonbsp": true,
16+
"nonew": true,
17+
"quotmark": "single",
18+
"sub": true,
19+
"undef": true,
20+
"unused": "vars",
21+
"globals" : {
22+
"console": false,
23+
"crossfilter" : false,
24+
"d3" : false,
25+
"dc" : false,
26+
"global": false,
27+
"module": false,
28+
"process": false,
29+
"require": false
30+
}
31+
}

Gruntfile.js

+200
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
module.exports = function ( grunt ) {
2+
'use strict';
3+
4+
var jsFiles = module.exports.jsFiles;
5+
6+
var output = {
7+
js: '<%= pkg.name %>.js',
8+
jsmin: '<%= pkg.name %>.min.js',
9+
map: '<%= pkg.name %>.min.js.map'
10+
};
11+
12+
grunt.initConfig( {
13+
pkg: grunt.file.readJSON( 'package.json' ),
14+
15+
concat: {
16+
js: {
17+
src: jsFiles,
18+
dest: output.js
19+
}
20+
},
21+
uglify: {
22+
jsmin: {
23+
options: {
24+
mangle: true,
25+
compress: true,
26+
sourceMap: output.map
27+
},
28+
src: output.js,
29+
dest: output.jsmin
30+
}
31+
},
32+
sed: {
33+
version: {
34+
pattern: '%VERSION%',
35+
replacement: '<%= pkg.version %>',
36+
path: [ output.js, output.jsmin ]
37+
}
38+
},
39+
jscs: {
40+
old: {
41+
src: [ 'spec/**/*.js' ],
42+
options: {
43+
validateIndentation: 4
44+
}
45+
},
46+
source: {
47+
src: [ 'src/**/*.js', '!src/{banner,footer}.js', 'Gruntfile.js' ],
48+
options: {
49+
config: '.jscsrc'
50+
}
51+
}
52+
},
53+
jshint: {
54+
source: {
55+
src: [ 'src/**/*.js', 'Gruntfile.js' ],
56+
options: {
57+
jshintrc: '.jshintrc',
58+
ignores: ['src/banner.js', 'src/footer.js']
59+
}
60+
}
61+
},
62+
watch: {
63+
scripts: {
64+
files: [ 'src/**/*.js' ],
65+
tasks: [ 'build' ]
66+
},
67+
jasmineRunner: {
68+
files: [ 'spec/**/*.js' ],
69+
tasks: [ 'jasmine:specs:build' ]
70+
},
71+
tests: {
72+
files: [ 'src/**/*.js', 'spec/**/*.js' ],
73+
tasks: [ 'test' ]
74+
},
75+
reload: {
76+
files: [ 'crossfilter-ma.js', 'web/js/crossfilter-ma.js', 'crossfilter-ma.min.js' ],
77+
options: {
78+
livereload: true
79+
}
80+
}
81+
},
82+
connect: {
83+
server: {
84+
options: {
85+
port: 8888,
86+
base: '.'
87+
}
88+
}
89+
},
90+
jasmine: {
91+
specs: {
92+
options: {
93+
display: 'short',
94+
summary: true,
95+
specs: 'spec/*-spec.js',
96+
helpers: 'spec/helpers/*.js',
97+
version: '2.0.0',
98+
outfile: 'spec/index.html',
99+
keepRunner: true
100+
},
101+
src: [
102+
'node_modules/d3/d3.js',
103+
'node_modules/crossfilter/crossfilter.js',
104+
'web/js/colorbrewer.js',
105+
'crossfilter-ma.js'
106+
]
107+
},
108+
coverage:{
109+
src: '<%= jasmine.specs.src %>',
110+
options:{
111+
specs: '<%= jasmine.specs.options.specs %>',
112+
helpers: '<%= jasmine.specs.options.helpers %>',
113+
version: '<%= jasmine.specs.options.version %>',
114+
template: require( 'grunt-template-jasmine-istanbul' ),
115+
templateOptions: {
116+
coverage: 'coverage/jasmine/coverage.json',
117+
report: [
118+
{
119+
type: 'html',
120+
options: {
121+
dir: 'coverage/jasmine'
122+
}
123+
}
124+
]
125+
}
126+
}
127+
},
128+
browserify: {
129+
options: {
130+
display: 'short',
131+
summary: true,
132+
specs: 'spec/*-spec.js',
133+
helpers: 'spec/helpers/*.js',
134+
version: '2.0.0',
135+
outfile: 'spec/index-browserify.html',
136+
keepRunner: true
137+
},
138+
src: [
139+
'bundle.js'
140+
]
141+
}
142+
},
143+
browserify: {
144+
dev: {
145+
src: 'crossfilter-ma.js',
146+
dest: 'bundle.js',
147+
options: {
148+
browserifyOptions: {
149+
standalone: 'crossfilter-ma'
150+
}
151+
}
152+
},
153+
}
154+
} );
155+
156+
157+
grunt.registerTask( 'watch:jasmine', function () {
158+
grunt.config( 'watch', {
159+
options: {
160+
interrupt: true
161+
},
162+
runner: grunt.config( 'watch' ).jasmineRunner,
163+
scripts: grunt.config( 'watch' ).scripts
164+
} );
165+
grunt.task.run( 'watch' );
166+
} );
167+
168+
169+
// These plugins provide necessary tasks.
170+
grunt.loadNpmTasks( 'grunt-contrib-concat' );
171+
grunt.loadNpmTasks( 'grunt-contrib-connect' );
172+
grunt.loadNpmTasks( 'grunt-contrib-copy' );
173+
grunt.loadNpmTasks( 'grunt-contrib-jasmine' );
174+
grunt.loadNpmTasks( 'grunt-contrib-jshint' );
175+
grunt.loadNpmTasks( 'grunt-contrib-uglify' );
176+
grunt.loadNpmTasks( 'grunt-contrib-watch' );
177+
grunt.loadNpmTasks( 'grunt-jscs' );
178+
grunt.loadNpmTasks( 'grunt-markdown' );
179+
grunt.loadNpmTasks( 'grunt-sed' );
180+
grunt.loadNpmTasks( 'grunt-shell' );
181+
grunt.loadNpmTasks( 'grunt-debug-task' );
182+
grunt.loadNpmTasks( 'grunt-browserify' );
183+
184+
185+
// task aliases
186+
grunt.registerTask( 'build', [ 'concat', 'uglify', 'sed' ] );
187+
grunt.registerTask( 'lint', [ 'build', 'jshint', 'jscs' ] );
188+
grunt.registerTask( 'coverage', [ 'build', 'jasmine:coverage' ] );
189+
grunt.registerTask( 'server', [ 'jasmine:specs:build', 'connect:server', 'watch:jasmine' ] );
190+
grunt.registerTask( 'test', [ 'build', 'jasmine:specs' ] );
191+
192+
grunt.registerTask( 'test-browserify', [ 'build', 'browserify', 'jasmine:browserify' ] );
193+
grunt.registerTask( 'default', [ 'build' ] );
194+
};
195+
196+
module.exports.jsFiles = [
197+
'src/banner.js',
198+
'src/crossfilter-ma.js',
199+
'src/footer.js'
200+
];

package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
"author": "Jasmine Hegman",
2222
"license": "MIT",
2323
"dependencies": {
24-
"crossfilter": "1.x"
24+
"crossfilter": "1.x",
25+
"d3": "^3.5.3"
2526
},
2627
"devDependencies": {
2728
"grunt": "^0.4.5",
@@ -35,9 +36,11 @@
3536
"grunt-contrib-uglify": "^0.7.0",
3637
"grunt-contrib-watch": "^0.6.1",
3738
"grunt-debug-task": "^0.1.5",
39+
"grunt-jscs": "^1.1.0",
3840
"grunt-markdown": "^0.6.1",
3941
"grunt-sed": "^0.1.1",
4042
"grunt-shell": "^1.1.1",
43+
"grunt-template-jasmine-istanbul": "^0.3.0",
4144
"marked": "^0.3.2",
4245
"uglify-js": "^2.4.16"
4346
}

0 commit comments

Comments
 (0)