-
Notifications
You must be signed in to change notification settings - Fork 13
/
Gruntfile.js
88 lines (75 loc) · 2.06 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
var files = require('./buildFiles').files;
var util = require('./lib/grunt/utils.js');
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-compress');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadTasks('lib/grunt');
var version = util.getVersion();
var dist = 'factory_girl-' + version.full;
grunt.initConfig({
VERSION: version,
connect: {
testserver: {
options: {
port: 8000,
hostname: '0.0.0.0',
base: '.',
keepalive: true,
middleware: function(connect, options){
return [
connect.favicon('images/favicon.ico'),
connect.static(options.base),
connect.directory(options.base)
];
}
}
}
},
karma: {
unit: {
configFile: './test/karma-unit.conf.js'
}
},
clean: {
build: ['build']
},
build: {
factory: {
dest: 'build/factory_girl.js',
src: util.wrap([files['src']], 'module')
}
},
uglify: {
build: {
files: [{
src: 'build/factory_girl.js',
dest: 'build/factory_girl.min.js',
}]
}
},
compress: {
build: {
options: {archive: 'build/' + dist +'.zip', mode: 'zip'},
src: ['**'], cwd: 'build', expand: true, dot: true, dest: dist + '/'
}
},
watch: {
test: {
files: ['src/**/*.js', 'test/**/*.js'],
tasks: ['test']
}
}
});
grunt.registerTask('test', ['karma:unit']);
grunt.registerTask('webserver', ['connect:testserver']);
grunt.registerTask('minify', ['clean', 'build', 'uglify']);
grunt.registerTask('package', ['minify', 'compress']);
grunt.registerTask('default', ['package']);
};