-
Notifications
You must be signed in to change notification settings - Fork 11
/
Gruntfile.js
145 lines (142 loc) · 3.84 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
module.exports = function(grunt) {
'use strict';
require('google-closure-compiler').grunt(grunt);
grunt.initConfig({
bower: {
libs: {
options: {
targetDir: 'static/libs',
install: true,
copy: true,
cleanup: true,
layout: 'byComponent'
}
}
},
clean: {
copy: './static/js/rdm.js'
},
copy: {
develop: {
src: './js_src/rdm.js',
dest: './static/js/rdm.js'
}
},
uglify: {
build: {
files: [{
dest: './static/js/rdm.js',
src: './js_src/rdm.js'//TODO(dave): change this to ./js_scr/*js
}],
options: {
mangle: true,
sourceMap: true,
sourceMapName: './static/js/rdm.js.map'
}
}
},
karma: {
firefox: {
configFile: './unit-test-js/karma.conf.js',
singleRun: true,
browsers: ['Firefox'],
reporters: 'dots',
plugins: [
'karma-firefox-launcher',
'karma-jasmine'
]
},
chrome: {
configFile: './unit-test-js/karma.conf.js',
singleRun: true,
browsers: ['Chrome'],
reporters: 'dots',
plugins: [
'karma-chrome-launcher',
'karma-jasmine'
]
}
},
jshint: {
dev: [
'Gruntfile.js',
'js_src/rdm.js',//TODO(dave): change this to ./js_scr/*js
'unit-test-js/karma.conf.js',
'unit-test-js/tests/*js'
],
options: {
jshintrc: true
}
},
jscs: {
src: [
'Gruntfile.js',
'js_src/rdm.js',//TODO(dave): change this to ./js_scr/*js
'unit-test-js/karma.conf.js',
'unit-test-js/tests/*js'
],
options: {
verbose: true,
config: true
}
},
stylelint: {
all: [
'static/css/*.css'
]
},
watch: {
build: {
files: ['Gruntfile.js', 'js_src/rdm.js'],
tasks: ['jshint:dev', 'uglify:build'],
options: {
atBegin: true
}
},
copy: {
files: ['Gruntfile.js', 'js_src/rdm.js'],
tasks: ['jshint:dev', 'clean:copy', 'copy:develop'],
options: {
atBegin: true
}
}
},
'closure-compiler': {
build: {
options: {
args: [
'--js', 'js_src/**.js',
'--js', '!js_src/rdm.js',
'--js', 'node_modules/google-closure-library/closure/**.js',
'--js', 'node_modules/google-closure-library/third_party/**.js',
'--js', '"!**_test.js"',
'--jscomp_error', 'lintChecks',
'--warning_level=VERBOSE',
'--hide_warnings_for', 'node_modules/google-closure-library/',
'--entry_point', 'app.setup',
'--js_output_file', 'static/js/app.js',
'--dependency_mode', 'STRICT',
'--compilation_level', 'ADVANCED_OPTIMIZATIONS'
]
}
}
}
});
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-bower-task');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-jscs');
grunt.loadNpmTasks('grunt-stylelint');
grunt.registerTask('default', ['bower']);
grunt.registerTask('lint', ['jshint:dev', 'jscs', 'stylelint']);
grunt.registerTask('unit-test', ['bower', 'compress', 'karma:firefox']);
grunt.registerTask('compress', ['lint', 'uglify:build']);
grunt.registerTask('compress-watch', ['watch:build']);
grunt.registerTask('copy-once', ['lint', 'clean:copy', 'copy:develop']);
grunt.registerTask('copy-watch', ['watch:copy']);
grunt.registerTask('copy-cleanup', ['clean:copy', 'compress']);
};