diff --git a/.jscsrc b/.jscsrc new file mode 100644 index 0000000..db51281 --- /dev/null +++ b/.jscsrc @@ -0,0 +1,23 @@ +{ + "disallowEmptyBlocks": true, + "disallowImplicitTypeConversion": ["numeric", "boolean", "binary", "string"], + "disallowMixedSpacesAndTabs": true, + "disallowMultipleVarDecl": true, + "disallowNewlineBeforeBlockStatements": true, + "disallowQuotedKeysInObjects": "allButReserved", + "disallowSpaceAfterObjectKeys": true, + "disallowTrailingComma": true, + "maximumLineLength": 80, + "requireBlocksOnNewline": true, + "requireCommaBeforeLineBreak": true, + "requireCurlyBraces": true, + "requireDotNotation": true, + "requireLineBreakAfterVariableAssignment": true, + "requireLineFeedAtFileEnd": true, + "requireSemicolons": true, + "requireSpaceAfterBinaryOperators": true, + "requireSpaceAfterLineComment": true, + "requireSpaceBeforeBinaryOperators": true, + "requireSpaceBeforeObjectValues": true, + "validateQuoteMarks": { "mark": "'", "escape": true } +} diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 0000000..8350de1 --- /dev/null +++ b/.jshintrc @@ -0,0 +1,10 @@ +{ + "curly": true, + "eqeqeq": true, + "eqnull": true, + "noarg": true, + "undef": true, + "unused": true, + "maxstatements": 40, + "nobsp": true +} diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 0000000..010e4c8 --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,73 @@ +module.exports = function(grunt) { + + // Project configuration. + grunt.initConfig({ + pkg: grunt.file.readJSON('package.json'), + jshint: { + files: ['Gruntfile.js', 'src/analysis.js', 'src/render.js'], + options: { + reporter: require('jshint-stylish') + }, + jshintrc: '.jshintrc' + }, + jscs: { + src: ['<%= jshint.files %>'], + options: { + config: '.jscsrc' + } + }, + concat: { + build: { + nonull: true, + options: { + banner: ( + '(function (exports){\n' + + 'var catcorr = {\n' + + ' version: \'<%= pkg.version %>\'\n' + + '};\n' + ), + footer: '}();' + }, + src: [ + 'src/analysis.js', + 'src/render.js' + ], + dest: 'build/kk.js' + } + }, + uglify: { + options: { + banner: ( + '/*! <%= pkg.name %> ' + + '<%= grunt.template.today("yyyy-mm-dd") %> */\n' + ) + }, + build: { + src: 'src/<%= pkg.name %>.js', + dest: 'build/<%= pkg.name %>.min.js' + } + }, + watch: { + files: ['<%= jshint.files %>'], + tasks: ['jshint', 'jscs', 'concat'] + } + }); + + // Load the plugins + grunt.loadNpmTasks('grunt-contrib-compass'); + grunt.loadNpmTasks('grunt-contrib-concat'); + grunt.loadNpmTasks('grunt-contrib-jshint'); + grunt.loadNpmTasks('grunt-contrib-uglify'); + grunt.loadNpmTasks('grunt-contrib-watch'); + grunt.loadNpmTasks('grunt-jscs'); + + // Default task(s). + grunt.registerTask('default', [ + 'jshint', + 'jscs', + // 'compass', + 'concat', + 'uglify' + ]); + +}; diff --git a/catcorr.min.js b/build/catcorr.min.js similarity index 100% rename from catcorr.min.js rename to build/catcorr.min.js diff --git a/package.json b/package.json index 8245717..b96318d 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "catcorrjs", + "name": "catcorr", "version": "0.3.1", "description": "Visualize correlations across many dimensions of categorical data (e.g., from a survey)", "main": "catcorr.js", @@ -11,6 +11,14 @@ "crossfilter": "~1.3.2" }, "devDependencies": { + "grunt": "^0.4.5", + "grunt-contrib-compass": "^1.0.3", + "grunt-contrib-concat": "^0.5.1", + "grunt-contrib-jshint": "^0.11.2", + "grunt-contrib-uglify": "^0.9.1", + "grunt-contrib-watch": "^0.6.1", + "grunt-jscs": "^1.8.0", + "jshint-stylish": "^2.0.1", "vows": "0.7.x" }, "scripts": { @@ -18,7 +26,7 @@ }, "repository": { "type": "git", - "url": "git://github.com/freemarmoset/catcorrjs.git" + "url": "git://github.com/ideo/catcorrjs.git" }, "keywords": [ "visualization" @@ -26,6 +34,6 @@ "author": "Dean Malmgren", "license": "MIT", "bugs": { - "url": "https://github.com/freemarmoset/catcorrjs/issues" + "url": "https://github.com/ideo/catcorrjs/issues" } } diff --git a/src/analysis.js b/src/analysis.js new file mode 100644 index 0000000..b364a34 --- /dev/null +++ b/src/analysis.js @@ -0,0 +1 @@ +catcorr.analyze = {}; diff --git a/catcorr.js b/src/catcorr.js similarity index 100% rename from catcorr.js rename to src/catcorr.js diff --git a/src/render.js b/src/render.js new file mode 100644 index 0000000..1ceb92b --- /dev/null +++ b/src/render.js @@ -0,0 +1 @@ +catcorr.render = {};