-
Notifications
You must be signed in to change notification settings - Fork 11
/
Gruntfile.js
215 lines (201 loc) · 8.41 KB
/
Gruntfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
module.exports = function( grunt ) {
grunt.initConfig({
pkg: grunt.file.readJSON( "package.json" ),
jshint: {
source: {
src: [ "moment-cldr.js" ],
options: {
jshintrc: ".jshintrc"
}
},
// grunt: {
// src: [ "Gruntfile.js" ],
// options: {
// jshintrc: ".jshintrc"
// }
// },
// test: {
// src: [ "test/*.js", "test/functional/**/*.js", "test/unit/**/*.js" ],
// options: {
// jshintrc: "test/.jshintrc"
// }
// },
// dist: {
// src: [ "dist/globalize*.js", "dist/globalize/*.js", "!dist/*.min.*js" ],
// options: {
// jshintrc: "src/.dist-jshintrc"
// }
// }
},
mochaTest: {
options: {
reporter: 'spec'
},
src: 'test/**/*.js'
}
// qunit: {
// functional: {
// options: {
// urls: [ "http://localhost:<%= connect.options.port %>/functional.html" ]
// }
// },
// unit: {
// options: {
// urls: [ "http://localhost:<%= connect.options.port %>/unit.html" ]
// }
// }
// },
// requirejs: {
// options: {
// dir: "dist/.build",
// appDir: "src",
// baseUrl: ".",
// optimize: "none",
// paths: {
// cldr: "../node_modules/cldr.js/dist/cldr"
// },
// skipSemiColonInsertion: true,
// skipModuleInsertion: true,
// // Strip all definitions generated by requirejs.
// // Convert content as follows:
// // a) "Single return" means the module only contains a return statement that is converted to a var declaration.
// // b) "Not as simple as a single return" means the define wrappers are replaced by a function wrapper call and the returned value is assigned to a var.
// // c) "Module" means the define wrappers are removed, but content is untouched. Only for root id's (the ones in src, not in src's subpaths).
// // d) "cldr" have its UMD wrapper replaced by a var declaration.
// onBuildWrite: function ( id, path, contents ) {
// var name = camelCase( id.replace(/util\//, "") );
// // Cldr
// if ( (/^cldr$/).test( id ) ) {
// // 1: UMD intro
// // 2: UMD outro
// return contents
// .replace( /\(function\( root, factory \)[\s\S]*?}\( this, function\(\) {/, "var Cldr = (function() {" ) /* 1 */
// .replace( /}\)\);\s+$/, "}());" ); /* 2 */
// }
// // 1, and 2: Remove define() wrap.
// // 3: Remove empty define()'s.
// contents = contents
// .replace( /define\([^{]*?{/, "" ) /* 1 */
// .replace( rdefineEnd, "" ) /* 2 */
// .replace( /define\(\[[^\]]+\]\)[\W\n]+$/, "" ); /* 3 */
// // Type b (not as simple as a single return)
// if ( [ "date/parse" ].indexOf( id ) !== -1 ) {
// contents = "var " + name + " = (function() {" +
// contents + "}());";
// }
// // Type a (single return)
// else if ( (/\//).test( id ) ) {
// contents = contents
// .replace( /\nreturn/, "\nvar " + name + " =" );
// }
// return contents;
// }
// },
// bundle: {
// options: {
// modules: [
// {
// name: "globalize",
// include: [ "core" ],
// exclude: [ "cldr" ],
// create: true,
// override: {
// wrap: {
// startFile: "src/build/intro-core.js",
// endFile: "src/build/outro.js"
// }
// }
// },
// {
// name: "globalize.date",
// include: [ "date" ],
// exclude: [ "cldr", "cldr/supplemental", "./core" ],
// create: true,
// override: {
// wrap: {
// startFile: "src/build/intro-date.js",
// endFile: "src/build/outro.js"
// }
// }
// },
// {
// name: "globalize.translate",
// include: [ "translate" ],
// exclude: [ "cldr", "./core" ],
// create: true,
// override: {
// wrap: {
// startFile: "src/build/intro-translate.js",
// endFile: "src/build/outro.js"
// }
// }
// }
// ]
// }
// }
// },
// watch: {
// files: [ "src/*.js", "test/functional/**/*.js", "test/unit/**/*.js", "test/*.html" ],
// tasks: [ "default" ]
// },
// copy: {
// options: {
// processContent: function( content ) {
// // Remove leftover define created during rjs build
// content = content.replace( /define\(".*/, "" );
// // Embed VERSION and DATE
// return replaceConsts( content );
// }
// },
// dist_core: {
// expand: true,
// cwd: "dist/.build/",
// src: [ "globalize.js" ],
// dest: "dist/"
// },
// dist_modules: {
// expand: true,
// cwd: "dist/.build/",
// src: [ "globalize*.js", "!globalize.js" ],
// dest: "dist/globalize",
// rename: function( dest, src ) {
// return require( "path" ).join( dest, src.replace( /globalize\./, "" ) );
// }
// },
// dist_allinone_node: {
// src: "src/build/allinone-node.js",
// dest: "dist/globalize-allinone-node.js"
// }
// },
// uglify: {
// options: {
// banner: replaceConsts( grunt.file.read( "src/build/intro.min.js" ) )
// },
// dist: {
// files: {
// "dist/globalize.min.js": [ "dist/globalize.js" ],
// "dist/globalize/date.min.js": [ "dist/globalize/date.js" ],
// "dist/globalize/translate.min.js": [ "dist/globalize/translate.js" ]
// }
// }
// },
// clean: {
// dist: [
// "dist"
// ]
// }
});
// require( "matchdep" ).filterDev( "grunt-*" ).forEach( grunt.loadNpmTasks );
// grunt.registerTask( "test", function() {
// var args = [].slice.call( arguments );
// if ( !isConnectTestRunning ) {
// grunt.task.run( "connect:test" );
// isConnectTestRunning = true;
// }
// grunt.task.run( [ "qunit" ].concat( args ).join( ":" ) );
// });
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-mocha-test');
// Default task.
grunt.registerTask("default", ["jshint"]);
};