Skip to content

Commit 49f9898

Browse files
author
evanvosberg
committed
Add a new basic build task with grunt.
1 parent cbecc30 commit 49f9898

File tree

12 files changed

+727
-34
lines changed

12 files changed

+727
-34
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
node_modules
2+
build
23
.svn

.jshintrc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"bitwise" : false, // Prohibits the use of bitwise operators (not confuse & with &&)
3+
"curly" : true, // Requires to always put curly braces around blocks in loops and conditionals
4+
"eqeqeq" : false, // Prohibits the use of == and != in favor of === and !==
5+
"eqnull" : true, // Suppresses warnings about == null comparisons
6+
"immed" : true, // Requires immediate invocations to be wrapped in parens e.g. `(function () { } ());`
7+
"latedef" : true, // Prohibits the use of a variable before it was defined
8+
"newcap" : false, // Requires to capitalize names of constructor functions
9+
"noarg" : true, // Prohibits the use of arguments.caller and arguments.callee
10+
"strict" : false, // Requires all functions to run in ECMAScript 5's strict mode
11+
"undef" : true, // Require non-global variables to be declared (prevents global leaks)
12+
"asi" : true, // Suppresses warnings about missing semicolons
13+
"globals": {
14+
"CryptoJS": true
15+
}
16+
}

Gruntfile.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*jshint node: true*/
2+
3+
'use strict';
4+
5+
var path = require('path');
6+
7+
module.exports = function (grunt) {
8+
9+
// Load all grunt tasks from node_modules, and config from /grunt/config
10+
require('load-grunt-config')(grunt, {
11+
configPath: path.join(process.cwd(), 'grunt/config'),
12+
config: {
13+
pkg: grunt.file.readJSON('package.json'),
14+
meta: {
15+
cwd: '',
16+
cwdAll: '**/*',
17+
18+
source: 'src/',
19+
sourceAll: 'src/**/*',
20+
21+
build: 'build/',
22+
buildAll: 'build/**/*',
23+
24+
test: 'test/',
25+
testAll: 'test/**/*',
26+
27+
npm: 'node_modules/',
28+
npmAll: 'node_modules/**/*'
29+
}
30+
}
31+
});
32+
33+
// Will load the custom tasks
34+
grunt.loadTasks('./grunt/tasks');
35+
36+
grunt.registerTask('build', 'Build a bundle', [
37+
'clean:build',
38+
'modularize:build',
39+
'copy:build',
40+
'update_json:npm',
41+
'update_json:bower'
42+
]);
43+
44+
grunt.registerTask('default', 'Run code checker', [
45+
'jsonlint',
46+
'jshint'
47+
]);
48+
49+
};

grunt/config/clean.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/*jshint node: true*/
2+
3+
'use strict';
4+
5+
module.exports = {
6+
build: [
7+
'<%= meta.build %>'
8+
]
9+
};

grunt/config/copy.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*jshint node: true*/
2+
3+
'use strict';
4+
5+
module.exports = {
6+
build: {
7+
files: [{
8+
expand: false,
9+
cwd: '<%= meta.cwd %>',
10+
src: [
11+
'README.md',
12+
'license.md'
13+
],
14+
dest: '<%= meta.build %>'
15+
}]
16+
}
17+
};

grunt/config/jshint.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*jshint node: true*/
2+
3+
'use strict';
4+
5+
module.exports = {
6+
dev: {
7+
options: {
8+
jshintrc: true
9+
},
10+
files: {
11+
src: [
12+
'<%= meta.cwdAll %>.js',
13+
'!<%= meta.buildAll %>',
14+
'!<%= meta.testAll %>',
15+
'!<%= meta.npmAll %>'
16+
]
17+
}
18+
}
19+
};

grunt/config/jsonlint.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*jshint node: true*/
2+
3+
'use strict';
4+
5+
module.exports = {
6+
all: {
7+
files: {
8+
src: [
9+
'<%= meta.cwdAll %>.json',
10+
'!<%= meta.buildAll %>',
11+
'!<%= meta.npmAll %>'
12+
]
13+
}
14+
}
15+
};

grunt/config/modularize.js

Lines changed: 224 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,224 @@
1+
/*jshint node: true*/
2+
3+
module.exports = {
4+
build: {
5+
files: [{
6+
expand: false,
7+
cwd: '<%= meta.cwd %>',
8+
src: ['<%= meta.source %>'],
9+
dest: '<%= meta.build %>'
10+
}],
11+
options: {
12+
// all
13+
"index": {
14+
"exports": "CryptoJS",
15+
"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"]
16+
},
17+
"crypto-js": {
18+
"pack": true,
19+
"exports": "CryptoJS",
20+
"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"]
21+
},
22+
23+
// hash
24+
"md5": {
25+
"exports": "CryptoJS.MD5",
26+
"components": ["core", "md5"]
27+
},
28+
"sha1": {
29+
"exports": "CryptoJS.SHA1",
30+
"components": ["core", "sha1"]
31+
},
32+
"sha256": {
33+
"exports": "CryptoJS.SHA256",
34+
"components": ["core", "sha256"]
35+
},
36+
"sha224": {
37+
"exports": "CryptoJS.SHA224",
38+
"components": ["core", "sha256", "sha224"]
39+
},
40+
"sha512": {
41+
"exports": "CryptoJS.SHA512",
42+
"components": ["core", "x64-core", "sha512"]
43+
},
44+
"sha384": {
45+
"exports": "CryptoJS.SHA384",
46+
"components": ["core", "x64-core", "sha512", "sha384"]
47+
},
48+
"sha3": {
49+
"exports": "CryptoJS.SHA3",
50+
"components": ["core", "x64-core", "sha3"]
51+
},
52+
"ripemd160": {
53+
"exports": "CryptoJS.RIPEMD160",
54+
"components": ["core", "ripemd160"]
55+
},
56+
57+
// hmac hash
58+
"hmac-md5": {
59+
"exports": "CryptoJS.HmacMD5",
60+
"components": ["core", "md5", "hmac"]
61+
},
62+
"hmac-sha1": {
63+
"exports": "CryptoJS.HmacSHA1",
64+
"components": ["core", "sha1", "hmac"]
65+
},
66+
"hmac-sha256": {
67+
"exports": "CryptoJS.HmacSHA256",
68+
"components": ["core", "sha256", "hmac"]
69+
},
70+
"hmac-sha224": {
71+
"exports": "CryptoJS.HmacSHA224",
72+
"components": ["core", "sha256", "sha224", "hmac"]
73+
},
74+
"hmac-sha512": {
75+
"exports": "CryptoJS.HmacSHA512",
76+
"components": ["core", "x64-core", "sha512", "hmac"]
77+
},
78+
"hmac-sha384": {
79+
"exports": "CryptoJS.HmacSHA384",
80+
"components": ["core", "x64-core", "sha512", "sha384", "hmac"]
81+
},
82+
"hmac-sha3": {
83+
"exports": "CryptoJSHmacSHA3",
84+
"components": ["core", "x64-core", "sha3", "hmac"]
85+
},
86+
"hmac-ripemd160": {
87+
"exports": "CryptoJS.HmacRIPEMD160",
88+
"components": ["core", "ripemd160", "hmac"]
89+
},
90+
"pbkdf2": {
91+
"exports": "CryptoJS.PBKDF2",
92+
"components": ["core", "sha1", "hmac", "pbkdf2"]
93+
},
94+
"evpkdf": {
95+
"exports": "CryptoJS.EvpKDF",
96+
"components": ["core", "sha1", "hmac", "evpkdf"]
97+
},
98+
99+
// cipher
100+
"aes": {
101+
"exports": "CryptoJS.AES",
102+
"components": ["core", "enc-base64", "md5", "evpkdf", "cipher-core", "aes"]
103+
},
104+
"tripledes": {
105+
"exports": "CryptoJS.TripleDES",
106+
"components": ["core", "enc-base64", "md5", "evpkdf", "cipher-core", "tripledes"]
107+
},
108+
"rc4": {
109+
"exports": "CryptoJS.RC4",
110+
"components": ["core", "enc-base64", "md5", "evpkdf", "cipher-core", "rc4"]
111+
},
112+
"rabbit": {
113+
"exports": "CryptoJS.Rabbit",
114+
"components": ["core", "enc-base64", "md5", "evpkdf", "cipher-core", "rabbit"]
115+
},
116+
"rabbit-legacy": {
117+
"exports": "CryptoJS.RabbitLegacy",
118+
"components": ["core", "enc-base64", "md5", "evpkdf", "cipher-core", "rabbit-legacy"]
119+
},
120+
121+
// core
122+
"core": {
123+
"exports": "CryptoJS",
124+
"components": ["core"]
125+
},
126+
"x64-core": {
127+
"exports": "CryptoJS",
128+
"components": ["core", "x64-core"]
129+
},
130+
"hmac": {
131+
"components": ["core", "hmac"]
132+
},
133+
"cipher-core": {
134+
"components": ["core", "cipher-core"]
135+
},
136+
137+
// lib
138+
"lib-typedarrays": {
139+
"exports": "CryptoJS.lib.WordArray",
140+
"components": ["core", "lib-typedarrays"]
141+
},
142+
143+
// format
144+
"format-openssl": {
145+
"exports": "CryptoJS.format.OpenSSL",
146+
"components": ["core", "cipher-core"]
147+
},
148+
"format-hex": {
149+
"exports": "CryptoJS.format.Hex",
150+
"components": ["core", "cipher-core", "format-hex"]
151+
},
152+
153+
// enc
154+
"enc-latin1": {
155+
"exports": "CryptoJS.enc.Latin1",
156+
"components": ["core"]
157+
},
158+
"enc-utf8": {
159+
"exports": "CryptoJS.enc.Utf8",
160+
"components": ["core"]
161+
},
162+
"enc-hex": {
163+
"exports": "CryptoJS.enc.Hex",
164+
"components": ["core"]
165+
},
166+
"enc-utf16": {
167+
"exports": "CryptoJS.enc.Utf16",
168+
"components": ["core", "enc-utf16"]
169+
},
170+
"enc-base64": {
171+
"exports": "CryptoJS.enc.Base64",
172+
"components": ["core", "enc-base64"]
173+
},
174+
175+
// mode
176+
"mode-cfb": {
177+
"exports": "CryptoJS.mode.CFB",
178+
"components": ["core", "cipher-core", "mode-cfb"]
179+
},
180+
"mode-ctr": {
181+
"exports": "CryptoJS.mode.CTR",
182+
"components": ["core", "cipher-core", "mode-ctr"]
183+
},
184+
"mode-ctr-gladman": {
185+
"exports": "CryptoJS.mode.CTRGladman",
186+
"components": ["core", "cipher-core", "mode-ctr-gladman"]
187+
},
188+
"mode-ofb": {
189+
"exports": "CryptoJS.mode.OFB",
190+
"components": ["core", "cipher-core", "mode-ofb"]
191+
},
192+
"mode-ecb": {
193+
"exports": "CryptoJS.mode.ECB",
194+
"components": ["core", "cipher-core", "mode-ecb"]
195+
},
196+
197+
// pad
198+
"pad-pkcs7": {
199+
"exports": "CryptoJS.pad.Pkcs7",
200+
"components": ["core", "cipher-core", "pad-pkcs7"]
201+
},
202+
"pad-ansix923": {
203+
"exports": "CryptoJS.pad.Ansix923",
204+
"components": ["core", "cipher-core", "pad-ansix923"]
205+
},
206+
"pad-iso10126": {
207+
"exports": "CryptoJS.pad.Iso10126",
208+
"components": ["core", "cipher-core", "pad-iso10126"]
209+
},
210+
"pad-iso97971": {
211+
"exports": "CryptoJS.pad.Iso97971",
212+
"components": ["core", "cipher-core", "pad-iso97971"]
213+
},
214+
"pad-zeropadding": {
215+
"exports": "CryptoJS.pad.ZeroPadding",
216+
"components": ["core", "cipher-core", "pad-zeropadding"]
217+
},
218+
"pad-nopadding": {
219+
"exports": "CryptoJS.pad.NoPadding",
220+
"components": ["core", "cipher-core", "pad-nopadding"]
221+
}
222+
}
223+
}
224+
};

0 commit comments

Comments
 (0)