Skip to content

Commit

Permalink
Add a new basic build task with grunt.
Browse files Browse the repository at this point in the history
  • Loading branch information
evanvosberg committed Mar 21, 2015
1 parent cbecc30 commit 49f9898
Show file tree
Hide file tree
Showing 12 changed files with 727 additions and 34 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
build
.svn
16 changes: 16 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"bitwise" : false, // Prohibits the use of bitwise operators (not confuse & with &&)
"curly" : true, // Requires to always put curly braces around blocks in loops and conditionals
"eqeqeq" : false, // Prohibits the use of == and != in favor of === and !==
"eqnull" : true, // Suppresses warnings about == null comparisons
"immed" : true, // Requires immediate invocations to be wrapped in parens e.g. `(function () { } ());`
"latedef" : true, // Prohibits the use of a variable before it was defined
"newcap" : false, // Requires to capitalize names of constructor functions
"noarg" : true, // Prohibits the use of arguments.caller and arguments.callee
"strict" : false, // Requires all functions to run in ECMAScript 5's strict mode
"undef" : true, // Require non-global variables to be declared (prevents global leaks)
"asi" : true, // Suppresses warnings about missing semicolons
"globals": {
"CryptoJS": true
}
}
49 changes: 49 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*jshint node: true*/

'use strict';

var path = require('path');

module.exports = function (grunt) {

// Load all grunt tasks from node_modules, and config from /grunt/config
require('load-grunt-config')(grunt, {
configPath: path.join(process.cwd(), 'grunt/config'),
config: {
pkg: grunt.file.readJSON('package.json'),
meta: {
cwd: '',
cwdAll: '**/*',

source: 'src/',
sourceAll: 'src/**/*',

build: 'build/',
buildAll: 'build/**/*',

test: 'test/',
testAll: 'test/**/*',

npm: 'node_modules/',
npmAll: 'node_modules/**/*'
}
}
});

// Will load the custom tasks
grunt.loadTasks('./grunt/tasks');

grunt.registerTask('build', 'Build a bundle', [
'clean:build',
'modularize:build',
'copy:build',
'update_json:npm',
'update_json:bower'
]);

grunt.registerTask('default', 'Run code checker', [
'jsonlint',
'jshint'
]);

};
9 changes: 9 additions & 0 deletions grunt/config/clean.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*jshint node: true*/

'use strict';

module.exports = {
build: [
'<%= meta.build %>'
]
};
17 changes: 17 additions & 0 deletions grunt/config/copy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*jshint node: true*/

'use strict';

module.exports = {
build: {
files: [{
expand: false,
cwd: '<%= meta.cwd %>',
src: [
'README.md',
'license.md'
],
dest: '<%= meta.build %>'
}]
}
};
19 changes: 19 additions & 0 deletions grunt/config/jshint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*jshint node: true*/

'use strict';

module.exports = {
dev: {
options: {
jshintrc: true
},
files: {
src: [
'<%= meta.cwdAll %>.js',
'!<%= meta.buildAll %>',
'!<%= meta.testAll %>',
'!<%= meta.npmAll %>'
]
}
}
};
15 changes: 15 additions & 0 deletions grunt/config/jsonlint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*jshint node: true*/

'use strict';

module.exports = {
all: {
files: {
src: [
'<%= meta.cwdAll %>.json',
'!<%= meta.buildAll %>',
'!<%= meta.npmAll %>'
]
}
}
};
224 changes: 224 additions & 0 deletions grunt/config/modularize.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,224 @@
/*jshint node: true*/

module.exports = {
build: {
files: [{
expand: false,
cwd: '<%= meta.cwd %>',
src: ['<%= meta.source %>'],
dest: '<%= meta.build %>'
}],
options: {
// all
"index": {
"exports": "CryptoJS",
"components": ["core", "x64-core", "lib-typedarrays", "enc-utf16", "enc-base64", "md5", "sha1", "sha256", "sha224", "sha512", "sha384", "sha3", "ripemd160", "hmac", "pbkdf2", "evpkdf", "cipher-core", "mode-cfb", "mode-ctr", "mode-ctr-gladman", "mode-ofb", "mode-ecb", "pad-ansix923", "pad-iso10126", "pad-iso97971", "pad-zeropadding", "pad-nopadding", "format-hex", "aes", "tripledes", "rc4", "rabbit", "rabbit-legacy"]
},
"crypto-js": {
"pack": true,
"exports": "CryptoJS",
"components": ["core", "x64-core", "lib-typedarrays", "enc-utf16", "enc-base64", "md5", "sha1", "sha256", "sha224", "sha512", "sha384", "sha3", "ripemd160", "hmac", "pbkdf2", "evpkdf", "cipher-core", "mode-cfb", "mode-ctr", "mode-ctr-gladman", "mode-ofb", "mode-ecb", "pad-ansix923", "pad-iso10126", "pad-iso97971", "pad-zeropadding", "pad-nopadding", "format-hex", "aes", "tripledes", "rc4", "rabbit", "rabbit-legacy"]
},

// hash
"md5": {
"exports": "CryptoJS.MD5",
"components": ["core", "md5"]
},
"sha1": {
"exports": "CryptoJS.SHA1",
"components": ["core", "sha1"]
},
"sha256": {
"exports": "CryptoJS.SHA256",
"components": ["core", "sha256"]
},
"sha224": {
"exports": "CryptoJS.SHA224",
"components": ["core", "sha256", "sha224"]
},
"sha512": {
"exports": "CryptoJS.SHA512",
"components": ["core", "x64-core", "sha512"]
},
"sha384": {
"exports": "CryptoJS.SHA384",
"components": ["core", "x64-core", "sha512", "sha384"]
},
"sha3": {
"exports": "CryptoJS.SHA3",
"components": ["core", "x64-core", "sha3"]
},
"ripemd160": {
"exports": "CryptoJS.RIPEMD160",
"components": ["core", "ripemd160"]
},

// hmac hash
"hmac-md5": {
"exports": "CryptoJS.HmacMD5",
"components": ["core", "md5", "hmac"]
},
"hmac-sha1": {
"exports": "CryptoJS.HmacSHA1",
"components": ["core", "sha1", "hmac"]
},
"hmac-sha256": {
"exports": "CryptoJS.HmacSHA256",
"components": ["core", "sha256", "hmac"]
},
"hmac-sha224": {
"exports": "CryptoJS.HmacSHA224",
"components": ["core", "sha256", "sha224", "hmac"]
},
"hmac-sha512": {
"exports": "CryptoJS.HmacSHA512",
"components": ["core", "x64-core", "sha512", "hmac"]
},
"hmac-sha384": {
"exports": "CryptoJS.HmacSHA384",
"components": ["core", "x64-core", "sha512", "sha384", "hmac"]
},
"hmac-sha3": {
"exports": "CryptoJSHmacSHA3",
"components": ["core", "x64-core", "sha3", "hmac"]
},
"hmac-ripemd160": {
"exports": "CryptoJS.HmacRIPEMD160",
"components": ["core", "ripemd160", "hmac"]
},
"pbkdf2": {
"exports": "CryptoJS.PBKDF2",
"components": ["core", "sha1", "hmac", "pbkdf2"]
},
"evpkdf": {
"exports": "CryptoJS.EvpKDF",
"components": ["core", "sha1", "hmac", "evpkdf"]
},

// cipher
"aes": {
"exports": "CryptoJS.AES",
"components": ["core", "enc-base64", "md5", "evpkdf", "cipher-core", "aes"]
},
"tripledes": {
"exports": "CryptoJS.TripleDES",
"components": ["core", "enc-base64", "md5", "evpkdf", "cipher-core", "tripledes"]
},
"rc4": {
"exports": "CryptoJS.RC4",
"components": ["core", "enc-base64", "md5", "evpkdf", "cipher-core", "rc4"]
},
"rabbit": {
"exports": "CryptoJS.Rabbit",
"components": ["core", "enc-base64", "md5", "evpkdf", "cipher-core", "rabbit"]
},
"rabbit-legacy": {
"exports": "CryptoJS.RabbitLegacy",
"components": ["core", "enc-base64", "md5", "evpkdf", "cipher-core", "rabbit-legacy"]
},

// core
"core": {
"exports": "CryptoJS",
"components": ["core"]
},
"x64-core": {
"exports": "CryptoJS",
"components": ["core", "x64-core"]
},
"hmac": {
"components": ["core", "hmac"]
},
"cipher-core": {
"components": ["core", "cipher-core"]
},

// lib
"lib-typedarrays": {
"exports": "CryptoJS.lib.WordArray",
"components": ["core", "lib-typedarrays"]
},

// format
"format-openssl": {
"exports": "CryptoJS.format.OpenSSL",
"components": ["core", "cipher-core"]
},
"format-hex": {
"exports": "CryptoJS.format.Hex",
"components": ["core", "cipher-core", "format-hex"]
},

// enc
"enc-latin1": {
"exports": "CryptoJS.enc.Latin1",
"components": ["core"]
},
"enc-utf8": {
"exports": "CryptoJS.enc.Utf8",
"components": ["core"]
},
"enc-hex": {
"exports": "CryptoJS.enc.Hex",
"components": ["core"]
},
"enc-utf16": {
"exports": "CryptoJS.enc.Utf16",
"components": ["core", "enc-utf16"]
},
"enc-base64": {
"exports": "CryptoJS.enc.Base64",
"components": ["core", "enc-base64"]
},

// mode
"mode-cfb": {
"exports": "CryptoJS.mode.CFB",
"components": ["core", "cipher-core", "mode-cfb"]
},
"mode-ctr": {
"exports": "CryptoJS.mode.CTR",
"components": ["core", "cipher-core", "mode-ctr"]
},
"mode-ctr-gladman": {
"exports": "CryptoJS.mode.CTRGladman",
"components": ["core", "cipher-core", "mode-ctr-gladman"]
},
"mode-ofb": {
"exports": "CryptoJS.mode.OFB",
"components": ["core", "cipher-core", "mode-ofb"]
},
"mode-ecb": {
"exports": "CryptoJS.mode.ECB",
"components": ["core", "cipher-core", "mode-ecb"]
},

// pad
"pad-pkcs7": {
"exports": "CryptoJS.pad.Pkcs7",
"components": ["core", "cipher-core", "pad-pkcs7"]
},
"pad-ansix923": {
"exports": "CryptoJS.pad.Ansix923",
"components": ["core", "cipher-core", "pad-ansix923"]
},
"pad-iso10126": {
"exports": "CryptoJS.pad.Iso10126",
"components": ["core", "cipher-core", "pad-iso10126"]
},
"pad-iso97971": {
"exports": "CryptoJS.pad.Iso97971",
"components": ["core", "cipher-core", "pad-iso97971"]
},
"pad-zeropadding": {
"exports": "CryptoJS.pad.ZeroPadding",
"components": ["core", "cipher-core", "pad-zeropadding"]
},
"pad-nopadding": {
"exports": "CryptoJS.pad.NoPadding",
"components": ["core", "cipher-core", "pad-nopadding"]
}
}
}
};
Loading

0 comments on commit 49f9898

Please sign in to comment.