-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switched to Mocha/Karma for testing (from Nodeunit) Using eslint Using bower for CryptoJS dependencies Builds sourcemaps Smarter Gruntfile builds
- Loading branch information
Showing
36 changed files
with
4,803 additions
and
5,229 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,43 @@ | ||
{ | ||
"rules": { | ||
// enabled over default | ||
"valid-jsdoc": [1, { | ||
"requireReturn": false, | ||
"prefer": { | ||
"return": "returns" | ||
} | ||
}], | ||
"guard-for-in": 2, | ||
"no-div-regex": 2, | ||
"no-else-return": 2, | ||
"no-eq-null": 2, | ||
"no-floating-decimal": 2, | ||
"no-self-compare": 2, | ||
"no-void": 2, | ||
"radix": 2, | ||
"wrap-iife": 2, | ||
"no-mixed-requires": 2, | ||
"no-new-require": 2, | ||
"no-path-concat": 2, | ||
"brace-style": [2, "1tbs", { "allowSingleLine": false }], | ||
"comma-style": [2, "last"], | ||
"consistent-this": [2, "that"], | ||
"no-inline-comments": 2, | ||
"no-lonely-if": 2, | ||
"no-multiple-empty-lines": [1, {"max": 1}], | ||
"no-nested-ternary": 2, | ||
"space-after-function-name": [2, "never"], | ||
"space-after-keywords": 1, | ||
"space-before-blocks": 1, | ||
"space-in-brackets": 1, | ||
"space-in-parens": 1, | ||
"space-unary-ops": 1, | ||
"spaced-line-comment": 1, | ||
"max-len": [1, 120, 4], | ||
|
||
// | ||
// Disabled rules | ||
// | ||
"consistent-return": 0 | ||
} | ||
} |
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,4 +1,8 @@ | ||
/node_modules | ||
npm-debug.log | ||
.project | ||
.settings/ | ||
.settings/ | ||
/eslint.xml | ||
/test/*.tap | ||
/test/coverage | ||
/bower_components |
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 @@ | ||
deps | ||
.bowerrc | ||
.eslintrc | ||
.gitmodules | ||
dist | ||
test | ||
.npmignore | ||
.gitmodules | ||
Gruntfile.js | ||
bower.json | ||
.travis.yml | ||
karma.config.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,5 +1,8 @@ | ||
language: node_js | ||
node_js: | ||
- "0.12" | ||
- "0.11" | ||
- "0.10" | ||
before_install: npm install -g grunt-cli | ||
before_install: | ||
- npm install -g grunt-cli bower | ||
- bower install |
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,81 +1,138 @@ | ||
/*eslint-env node*/ | ||
module.exports = function(grunt) { | ||
"use strict"; | ||
|
||
// Project configuration. | ||
grunt.initConfig({ | ||
pkg: grunt.file.readJSON('package.json'), | ||
pkg: grunt.file.readJSON("package.json"), | ||
clean: { | ||
options: {}, | ||
build: ["test/*.tap", "test/coverage"] | ||
}, | ||
concat: { | ||
options: { | ||
stripBanners: false, | ||
seperator: ";" | ||
}, | ||
dist: { | ||
src: [ | ||
"src/utils.js", | ||
"src/domainnamerule.js", | ||
"src/saltthepass.js" | ||
], | ||
dest: "dist/<%= pkg.name %>.js" | ||
}, | ||
"dist-withdeps": { | ||
src: [ | ||
"bower_components/cryptojslib/components/core.js", | ||
"bower_components/cryptojslib/components/x64-core.js", | ||
"bower_components/cryptojslib/components/sha1.js", | ||
"bower_components/cryptojslib/components/sha512.js", | ||
"bower_components/cryptojslib/components/sha3.js", | ||
"bower_components/cryptojslib/components/md5.js", | ||
"bower_components/cryptojslib/components/ripemd160.js", | ||
"bower_components/cryptojslib/components/enc-base64.js", | ||
"src/utils.js", | ||
"src/domainnamerule.js", | ||
"src/saltthepass.js" | ||
], | ||
dest: "dist/<%= pkg.name %>.withdeps.js" | ||
} | ||
}, | ||
uglify: { | ||
options: { | ||
banner: '/*! <%= pkg.name %> v<%= pkg.version %> */\n' | ||
banner: "/*! <%= pkg.name %> v<%= pkg.version %> */\n", | ||
mangle: true, | ||
sourceMap: true | ||
}, | ||
build: { | ||
files: { | ||
'dist/<%= pkg.name %>.min.js': [ | ||
'src/utils.js', | ||
'src/domainnamerule.js', | ||
'src/saltthepass.js' | ||
], | ||
'dist/<%= pkg.name %>.withdeps.min.js': [ | ||
'deps/crypto-js/core.js', | ||
'deps/crypto-js/x64-core.js', | ||
'deps/crypto-js/sha1.js', | ||
'deps/crypto-js/sha512.js', | ||
'deps/crypto-js/sha3.js', | ||
'deps/crypto-js/md5.js', | ||
'deps/crypto-js/ripemd160.js', | ||
'deps/crypto-js/enc-base64.js', | ||
'src/utils.js', | ||
'src/domainnamerule.js', | ||
'src/saltthepass.js' | ||
] | ||
"dist/<%= pkg.name %>.min.js": ["dist/<%= pkg.name %>.js"], | ||
"dist/<%= pkg.name %>.withdeps.min.js": ["dist/<%= pkg.name %>.withdeps.js"] | ||
} | ||
} | ||
}, | ||
jshint: { | ||
files: [ 'src/**/*.js', 'test/**/*.js' ], | ||
options: { | ||
bitwise: true, | ||
camelcase: true, | ||
curly: true, | ||
eqeqeq: true, | ||
forin: true, | ||
immed: true, | ||
indent: 4, | ||
latedef: true, | ||
newcap: true, | ||
noempty: true, | ||
nonew: true, | ||
quotmark: true, | ||
jquery: true, | ||
undef: true, | ||
unused: true, | ||
strict: true, | ||
trailing: true, | ||
browser: true, | ||
node: true, | ||
white: false, | ||
globals: { | ||
define: true, | ||
window: true | ||
} | ||
eslint: { | ||
console: { | ||
src: [ | ||
"Gruntfile.js", | ||
"src/**/*.js", | ||
"test/*.js" | ||
] | ||
}, | ||
build: { | ||
options: { | ||
"output-file": "eslint.xml", | ||
"format": "jslint-xml", | ||
"silent": true | ||
}, | ||
src: [ | ||
"Gruntfile.js", | ||
"src/**/*.js", | ||
"test/*.js" | ||
] | ||
} | ||
}, | ||
nodeunit: { | ||
all: ['test/*.js'] | ||
mochaTest: { | ||
test: { | ||
options: { | ||
reporter: "tap", | ||
captureFile: "test/mocha.tap" | ||
}, | ||
src: [ | ||
"src/saltthepass.js", | ||
"test/*.js" | ||
] | ||
} | ||
}, | ||
karma: { | ||
options: { | ||
singleRun: true, | ||
colors: true, | ||
configFile: "./karma.config.js", | ||
preprocessors: { | ||
"dist/saltthepass.withdeps.js": ["coverage"] | ||
}, | ||
basePath: "./", | ||
files: [ | ||
"bower_components/mocha/mocha.css", | ||
"bower_components/mocha/mocha.js", | ||
"bower_components/expect/index.js", | ||
"dist/saltthepass.withdeps.js", | ||
"test/test-*.js" | ||
] | ||
}, | ||
console: { | ||
browsers: ["PhantomJS"], | ||
frameworks: ["mocha"] | ||
} | ||
} | ||
}); | ||
|
||
// | ||
// Plugins | ||
// | ||
grunt.loadNpmTasks('grunt-contrib-uglify'); | ||
grunt.loadNpmTasks('grunt-contrib-nodeunit'); | ||
grunt.loadNpmTasks('grunt-contrib-jshint'); | ||
grunt.loadNpmTasks("grunt-contrib-clean"); | ||
grunt.loadNpmTasks("grunt-contrib-concat"); | ||
grunt.loadNpmTasks("grunt-contrib-uglify"); | ||
grunt.loadNpmTasks("grunt-karma"); | ||
grunt.loadNpmTasks("grunt-mocha-test"); | ||
grunt.loadNpmTasks("gruntify-eslint"); | ||
|
||
// | ||
// Tasks | ||
// | ||
grunt.registerTask('default', ['jshint', 'uglify']); | ||
grunt.registerTask('test', ['nodeunit']); | ||
grunt.registerTask('lint', ['uglify']); | ||
grunt.registerTask('travis', ['nodeunit', 'jshint']); | ||
grunt.registerTask('all', ['nodeunit', 'jshint', 'uglify']); | ||
}; | ||
grunt.registerTask("test", ["mochaTest", "karma:console"]); | ||
|
||
grunt.registerTask("lint", ["eslint:console"]); | ||
grunt.registerTask("lint:build", ["eslint:build"]); | ||
|
||
grunt.registerTask("build", ["concat", "uglify"]); | ||
|
||
// | ||
// Task Groups | ||
// | ||
grunt.registerTask("default", ["lint", "build"]); | ||
grunt.registerTask("travis", ["test", "lint"]); | ||
grunt.registerTask("all", ["clean", "lint:console", "build", "test"]); | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"name": "saltthepass.js", | ||
"version": "0.2.2", | ||
"authors": [ | ||
"Nic Jansma <nic@nicj.net>" | ||
], | ||
"description": "SaltThePass.com algorithm", | ||
"main": "dist/saltthepass.js", | ||
"moduleType": [ | ||
"amd", | ||
"globals", | ||
"node" | ||
], | ||
"keywords": [ | ||
"saltthepass" | ||
], | ||
"license": "MIT", | ||
"homepage": "http://github.com/nicjansma/saltthepass.js", | ||
"ignore": [ | ||
"**/.*", | ||
"node_modules", | ||
"bower_components", | ||
"test", | ||
"tests" | ||
], | ||
"dependencies": { | ||
"cryptojslib": "~3.1.2" | ||
}, | ||
"devDependencies": { | ||
"mocha": "~2.2.1", | ||
"expect": "~0.3.1" | ||
} | ||
} |
Oops, something went wrong.