-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8686f00
commit d18dd61
Showing
27 changed files
with
7,079 additions
and
4,191 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# This file is for unifying the coding style for different editors and IDEs | ||
# editorconfig.org | ||
|
||
root = true | ||
|
||
|
||
[*] | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
# Tabs in JS unless otherwise specified | ||
[**.js] | ||
indent_style = tab | ||
|
||
[Makefile] | ||
indent_style = tab | ||
|
||
|
||
[test/**.xml] | ||
indent_style = tab | ||
|
||
[test/**.html] | ||
indent_style = tab | ||
|
||
[test/**.css] | ||
indent_style = space | ||
indent_size = 8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* eol=lf | ||
*.jar binary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,5 +7,6 @@ | |
.DS_Store | ||
.bower.json | ||
.sizecache.json | ||
|
||
/bower_components | ||
/node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"requireCurlyBraces": [ "if", "else", "for", "while", "do" ], | ||
"requireSpaceAfterKeywords": [ "if", "else", "for", "while", "do", "switch", "return" ], | ||
"requireSpacesInFunctionExpression": { | ||
"beforeOpeningCurlyBrace": true | ||
}, | ||
"disallowSpacesInFunctionExpression": { | ||
"beforeOpeningRoundBrace": true | ||
}, | ||
"requireMultipleVarDecl": true, | ||
"requireSpacesInsideObjectBrackets": "all", | ||
"requireSpacesInsideArrayBrackets": "all", | ||
"disallowLeftStickedOperators": [ "?", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<=" ], | ||
"disallowRightStickedOperators": [ "?", "/", "*", ":", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<=" ], | ||
"requireRightStickedOperators": [ "!" ], | ||
"requireLeftStickedOperators": [ "," ], | ||
"disallowKeywords": [ "with" ], | ||
"disallowMultipleLineBreaks": true, | ||
"disallowKeywordsOnNewLine": [ "else" ], | ||
"requireLineFeedAtFileEnd": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
{ | ||
"boss": true, | ||
"curly": true, | ||
"eqeqeq": true, | ||
"eqnull": true, | ||
"expr": true, | ||
"immed": true, | ||
"noarg": true, | ||
"onevar": true, | ||
"quotmark": "double", | ||
"smarttabs": true, | ||
"trailing": true, | ||
"undef": true, | ||
"unused": true, | ||
"boss": true, | ||
"curly": true, | ||
"eqeqeq": true, | ||
"eqnull": true, | ||
"expr": true, | ||
"immed": true, | ||
"noarg": true, | ||
"onevar": true, | ||
"quotmark": "double", | ||
"smarttabs": true, | ||
"trailing": true, | ||
"undef": true, | ||
"unused": true, | ||
|
||
"node": true | ||
"node": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
.jshintignore | ||
.jshintrc | ||
|
||
/.editorconfig | ||
/.gitattributes | ||
/.jscs.json | ||
/.travis.yml | ||
|
||
/build | ||
/test | ||
/Gruntfile.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,113 +1,119 @@ | ||
module.exports = function (grunt) { | ||
"use strict"; | ||
module.exports = function(grunt) { | ||
"use strict"; | ||
|
||
function readOptionalJSON(filepath) { | ||
var data = {}; | ||
try { | ||
data = grunt.file.readJSON(filepath); | ||
} catch (e) {} | ||
return data; | ||
} | ||
var gzip = require("gzip-js"); | ||
|
||
var gzip = require( "gzip-js" ), | ||
srcHintOptions = readOptionalJSON("src/.jshintrc"); | ||
grunt.initConfig({ | ||
pkg: grunt.file.readJSON("package.json"), | ||
bowercopy: { | ||
options: { | ||
clean: true | ||
}, | ||
tests: { | ||
files: { | ||
"test/libs/qunit.js": "qunit/qunit/qunit.js", | ||
"test/libs/qunit.css": "qunit/qunit/qunit.css", | ||
"test/libs/require.js": "requirejs/require.js", | ||
"test/libs/modernizr.js": "modernizr/modernizr.js" | ||
} | ||
} | ||
}, | ||
compare_size: { | ||
files: [ "dist/<%= pkg.name %>.js", "dist/<%= pkg.name %>.min.js" ], | ||
options: { | ||
compress: { | ||
gz: function(contents) { | ||
return gzip.zip(contents, {}).length; | ||
} | ||
}, | ||
cache: "dist/.sizecache.json" | ||
} | ||
}, | ||
compile: { | ||
all: { | ||
dest: "dist/<%= pkg.name %>.js", | ||
src: "src/<%= pkg.name %>.js" | ||
} | ||
}, | ||
coveralls: { | ||
options: { | ||
force: true | ||
}, | ||
all: { | ||
// LCOV coverage file relevant to every target | ||
src: "_tests/reports/lcov/lcov.info" | ||
} | ||
}, | ||
jscs: { | ||
src: "src/**/*.js", | ||
gruntfile: "Gruntfile.js", | ||
tasks: "build/tasks/*.js", | ||
options: { | ||
config: ".jscs.json" | ||
} | ||
}, | ||
jshint: { | ||
source: { | ||
src: "src/<%= pkg.name %>.js", | ||
options: { | ||
jshintrc: "src/.jshintrc" | ||
} | ||
}, | ||
grunt: { | ||
src: [ "Gruntfile.js", "tasks/*" ], | ||
options: { | ||
jshintrc: ".jshintrc" | ||
} | ||
} | ||
}, | ||
jsonlint: { | ||
pkg: { | ||
src: [ "package.json" ] | ||
}, | ||
jscs: { | ||
src: [ ".jscs.json" ] | ||
}, | ||
bower: { | ||
src: [ "bower.json" ] | ||
} | ||
}, | ||
qunit: { | ||
files: [ "test/index.html" ] | ||
}, | ||
uglify: { | ||
all: { | ||
files: { | ||
"dist/<%= pkg.name %>.min.js": [ "dist/<%= pkg.name %>.js" ] | ||
}, | ||
options: { | ||
banner: "/*! <%= pkg.title %> v<%= pkg.version %> | (c) 2012 <%= pkg.author.name %> | Licensed <%= _.pluck(pkg.licenses, 'type').join(', ') %> */", | ||
beautify: { | ||
ascii_only: true | ||
}, | ||
compress: { | ||
hoist_funs: false, | ||
loops: false | ||
}, | ||
sourceMap: "dist/<%= pkg.name %>.min.map" | ||
} | ||
} | ||
}, | ||
version: { | ||
files: [ "package.json", "bower.json" ] | ||
} | ||
}); | ||
|
||
// The concatenated file won"t pass onevar | ||
// But our modules can | ||
delete srcHintOptions.onevar; | ||
// Load grunt tasks from NPM packages | ||
require("load-grunt-tasks")(grunt); | ||
|
||
grunt.initConfig({ | ||
pkg: grunt.file.readJSON("package.json"), | ||
dst: readOptionalJSON("dist/.destination.json"), | ||
compare_size: { | ||
files: [ "dist/<%= pkg.name %>.js", "dist/<%= pkg.name %>.min.js" ], | ||
options: { | ||
compress: { | ||
gz: function( contents ) { | ||
return gzip.zip( contents, {} ).length; | ||
} | ||
}, | ||
cache: "build/.sizecache.json" | ||
} | ||
}, | ||
jsonlint: { | ||
pkg: { | ||
src: [ "package.json" ] | ||
}, | ||
bower: { | ||
src: [ "bower.json" ] | ||
} | ||
}, | ||
jshint: { | ||
all: { | ||
src: [ | ||
"src/**/*.js", "Gruntfile.js" | ||
], | ||
options: { | ||
jshintrc: true | ||
} | ||
}, | ||
dist: { | ||
src: "dist/<%= pkg.name %>.js", | ||
options: srcHintOptions | ||
} | ||
}, | ||
concat: { | ||
options: { | ||
separator: ";" | ||
}, | ||
dist: { | ||
src: ["src/**/*.js"], | ||
dest: "dist/<%= pkg.name %>.js" | ||
} | ||
}, | ||
watch: { | ||
files: [ "<%= jshint.all.src %>" ], | ||
tasks: "dev" | ||
}, | ||
uglify: { | ||
all: { | ||
files: { | ||
"dist/<%= pkg.name %>.min.js": ["dist/<%= pkg.name %>.js"] | ||
}, | ||
options: { | ||
preserveComments: false, | ||
sourceMap: "dist/<%= pkg.name %>.min.map", | ||
sourceMappingURL: "<%= pkg.name %>.min.map", | ||
report: "min", | ||
beautify: { | ||
ascii_only: true | ||
}, | ||
banner: "/*! <%= pkg.title %> - v<%= pkg.version %> - " + | ||
"<%= grunt.template.today('isoDate') %>\n" + | ||
"<%= pkg.homepage ? '* ' + pkg.homepage + '\\n' : '' %>" + | ||
"* Copyright <%= grunt.template.today('yyyy') %> <%= pkg.author.name %>" + | ||
" Licensed <%= _.pluck(pkg.licenses, 'type').join(', ') %> */\n", | ||
compress: { | ||
hoist_funs: false, | ||
loops: false, | ||
unused: false | ||
} | ||
} | ||
} | ||
}, | ||
qunit: { | ||
files: ["test/**/*.html"] | ||
} | ||
}); | ||
// Integrate Detectizr specific tasks | ||
grunt.loadTasks("tasks"); | ||
|
||
// Load grunt tasks from NPM packages | ||
require("load-grunt-tasks")(grunt); | ||
grunt.registerTask("lint", [ "jsonlint", "jshint", "jscs" ]); | ||
grunt.registerTask("build", [ "lint", "compile", "uglify", "dist", "compare_size" ]); | ||
grunt.registerTask("test", [ "lint", "qunit" ]); | ||
grunt.registerTask("default", [ "test", "compare_size" ]); | ||
|
||
// Integrate jQuery specific tasks | ||
grunt.loadTasks("build/tasks"); | ||
|
||
// Short list as a high frequency watch task | ||
grunt.registerTask("dev", ["jshint"]); | ||
|
||
// this would be run by typing "grunt test" on the command line | ||
grunt.registerTask("test", ["jshint", "qunit"]); | ||
|
||
// Default grunt | ||
grunt.registerTask("default", [ "jshint", "jsonlint", "concat", "uglify", "compare_size"]); | ||
// Task aliases | ||
grunt.registerTask("bower", "bowercopy"); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.