-
Notifications
You must be signed in to change notification settings - Fork 2
/
Gruntfile.js
325 lines (312 loc) · 8.72 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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
/*
* assemble-manifest
* https://github.com/assemble/assemble-manifest
*
* Copyright (c) 2013 Jon Schlinkert, Brian Woodward, contributors.
* Licensed under the MIT license.
*/
'use strict';
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jshint: {
all: [
'Gruntfile.js',
'tasks/*.js'
],
options: {
jshintrc: '.jshintrc'
}
},
// Configuration to be run (and then tested).
manifest: {
bower: {
options: {
collections: {
images: [''],
templates: ['swig', 'hbs']
},
name: 'bower-example', // (required): The name of your package.
version: '0.1.0', // A semantic version number (see semver).
main: [], // [string|array]: The primary endpoints of your package.
ignore: [], // [array]: An array of paths not needed in production that you want Bower to ignore when installing your package.
dependencies: '<%= pkg.dependencies %>', // [hash]: Packages your package depends upon in production.
devDependencies: '<%= pkg.dependencies %>' // [hash]: Development dependencies.
},
files: {
'test/actual/bower.json': ['none']
}
},
mout: {
options: {
collections: {
js: []
}
},
files: {
'test/actual/mout.json': ['test/mout/**/*.js']
}
},
component: {
options: {
name: 'component-example',
description: 'Generate a component.json file.'
},
files: {
'test/actual/component.json': ['none/*.none']
}
},
debug: {
options: {
debug: true,
name: 'debug-example',
description: 'Debug shows all omitted objects and properties in the output.'
},
files: {
'test/actual/debug.json': ['none/*.none']
}
},
exclude: {
options: {
name: 'Exclude Example',
description: 'The exclude option allows you to omit properties that you do not want in the dest files.',
metadata: ['package.json'],
exclude: [
'*'
]
},
files: {
'test/actual/exclude.json': ['none/*.none']
}
},
metadata: {
options: {
name: 'External Metadata Source Example',
version: '0.1.0',
metadata: ['package.json'],
description: 'The metadata option allows you specify an external source to supply metadata to your dest file(s).'
},
files: {
'test/actual/metadata.json': ['none/*.none']
}
},
collections: {
options: {
name: 'Collections Example',
collections: true,
description: 'Generated a manifest from "collections" of files'
},
files: {
'test/actual/collections.json': ['test/**/*.*']
}
},
indentation: {
options: {
name: 'Indentation Example',
indent: 6,
description: 'Customize the indentation of the output. Only works for JSON'
},
files: {
'test/actual/indentation.json': ['test/**/*.*']
}
},
custom_properties: {
options: {
custom: 'Any custom properties will be written to the dest file(s) in the target or task.',
another: {
custom: 'Example'
}
},
files: {
'test/actual/custom-properties.json': ['test/**/*.*']
}
},
yaml: {
options: {
name: 'YAML Manifest Example',
format: 'yml'
},
files: {
'test/actual/manifest.yml': ['test/**/*.*']
}
},
sorted: {
options: {
name: 'Alphabetically Sorted Example',
sorted: true
},
files: {
'test/actual/sorted.json': ['test/fixtures/bootstrap/**/*.*']
}
},
images: {
// options: {
// name: 'Images Manifest Example'
// },
files: {
'test/actual/images.json': ['test/fixtures/**/*.{jpg,png,gif}'],
}
},
images_main_only: {
options: {
exclude: ['images', 'styles', 'javascripts', 'templates', 'fonts'],
name: 'Images Manifest'
},
files: {
'test/actual/images-main.json': ['test/fixtures/**/*.{jpg,png,gif}'],
}
},
cccc: {
options: {
manifestrc: '.manifestrc', // Optional external config options.
name: 'YAML Manifest',
format: 'yml',
styles: [
"upstage.css"
],
scripts: ['scripts.js'],
images: ['styles.css'],
fonts: ['font.woff'],
files: ['presentation.pdf']
},
files: {
'test/actual/any-files1.yml': ['test/fixtures/*.*'],
'test/actual/any-files2.yml': ['test/**/*.*']
}
},
bootstrap: {
options: {
collections: {
images: ['jpg', 'png', 'ico'],
templates: ['mustache']
},
name: 'Bootstrap Manifest'
},
files: {
'test/actual/bootstrap.json': [
'test/fixtures/bootstrap/less/*.less',
'test/fixtures/bootstrap/docs/assets/**/*.*'
]
}
},
bootstrap_yaml: {
options: {
name: 'Bootstrap Manifest',
format: 'yaml'
},
files: {
'test/actual/bootstrap.yml': [
'test/fixtures/bootstrap/less/*.less',
'test/fixtures/bootstrap/docs/assets/**/*.js',
'test/fixtures/bootstrap/docs/assets/fonts/*.*'
]
}
},
lib: {
options: {
name: 'Bootstrap LESS',
exclude: 'main'
},
files: {
'test/actual/less.json': ['test/fixtures/bootstrap/**/*.{less,js}']
}
},
theme: {
options: {
name: 'Theme Manifest'
},
files: {
'test/actual/theme-css.json': ['test/fixtures/*.css'],
'test/actual/theme-js.json': ['test/fixtures/*.js']
}
},
dynamic: {
options: {
name: 'Dynamic Collections',
collections: {
images: ['jpg', 'png', 'gif'],
templates: ['hbs', 'html'],
javascripts: ['js', 'coffee']
}
},
files: {
'test/actual/dynamic.json': ['test/fixtures/**/*.*']
}
},
dynamic2: {
options: {
name: 'Dynamic Collections',
collections: grunt.file.readJSON('test/collections.json')
},
files: {
'test/actual/dynamic2.json': ['test/fixtures/**/*.*']
}
}
},
lodashify: {
options: {
basepath: 'basepath'
},
mout: {
src: 'test/mout',
dest: 'test/actual/lodashify/mout.json'
},
mout_yaml: {
options: {format: 'yaml'},
src: 'test/mout',
dest: 'test/actual/lodashify/mout.yml'
},
bootstrap: {
src: 'test/fixtures/bootstrap',
dest: 'test/actual/bootstrap/bootstrap.json'
},
bootstrap_yaml: {
options: {format: 'yaml'},
src: 'test/fixtures/bootstrap',
dest: 'test/actual/bootstrap/bootstrap.yml'
}
},
metadata: {
options: {
props: ['name', 'version', 'main', 'dependencies', 'devDependencies', 'contributors', 'version']
},
example: {
options: {
pkg: 'test/pkg/fixtures/package_default.json',
component: 'test/pkg/temp/component_default.json'
}
},
main: {
options: {
pkg: 'test/pkg/fixtures/package_default.json',
component: 'test/pkg/temp/component_main.json',
main: ['a.js']
}
},
deps: {
options: {
pkg: 'test/pkg/fixtures/package_default.json',
component: 'test/pkg/temp/component_dependencies.json',
dependencies: {
'jquery': '1.9.2',
'backbone': '1.0.0'
}
}
},
},
// Configuration to be run (and then tested).
clean: {
json: ['test/actual/*.{json,yml}']
}
});
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-clean');
// Actually load this plugin's task(s).
grunt.loadTasks('tasks');
// By default, lint and run all tests.
grunt.registerTask('default', ['jshint', 'clean', 'manifest']);
// By default, lint and run all tests.
grunt.registerTask('test', ['default']); // 'nodeunit'
};