forked from christopherthielen/ui-router-extras
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
178 lines (168 loc) · 5.12 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
/**
@toc
2. load grunt plugins
3. init
4. setup variables
5. grunt.initConfig
6. register grunt tasks
*/
'use strict';
var _ = require('lodash');
module.exports = function (grunt) {
/**
Load grunt plugins
@toc 2.
*/
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-karma');
/**
Function that wraps everything to allow dynamically setting/changing grunt options and config later by grunt task. This init function is called once immediately (for using the default grunt options, config, and setup) and then may be called again AFTER updating grunt (command line) options.
@toc 3.
@method init
*/
function init(params) {
var files=require('./files').files;
/**
Project configuration.
@toc 5.
*/
grunt.initConfig({
concat: {
options: {},
dist: {
src: ['src/_intro.js.txt'].concat(files.src).concat(['src/_outtro.js.txt']),
dest: 'build/ct-ui-router-extras.js'
}
},
jshint: {
options: {
//force: true,
globalstrict: true,
//sub: true,
node: true,
loopfunc: true,
browser: true,
devel: true,
globals: {
angular: false,
$: false,
moment: false,
Pikaday: false,
module: false,
forge: false
}
},
beforeconcat: {
options: {
force: false,
ignores: ['**.min.js'],
strict: false
},
files: {
src: []
}
},
//quick version - will not fail entire grunt process if there are lint errors
beforeconcatQ: {
options: {
force: true,
strict: false,
ignores: ['**.min.js']
},
files: {
src: ['src/**/*.js']
}
}
},
uglify: {
options: {
mangle: false
},
build: {
files: {},
src: 'build/ct-ui-router-extras.js',
dest: 'build/ct-ui-router-extras.min.js'
}
},
karma: {
options: {
configFile: 'test/conf/karma.conf.js',
singleRun: true,
exclude: [],
frameworks: ['jasmine'],
reporters: 'dots', // 'dots' || 'progress'
port: 8080,
colors: true,
autoWatch: false,
autoWatchInterval: 0,
browsers: [ grunt.option('browser') || 'PhantomJS' ]
},
unit: {
configFile: 'test/conf/karma.dev.conf.js',
singleRun: true,
browsers: [ grunt.option('browser') || 'PhantomJS' ]
},
min: {
configFile: 'test/conf/karma.min.conf.js',
singleRun: true,
browsers: [ grunt.option('browser') || 'PhantomJS' ]
},
uirouter0_2_5: {
configFile: 'test/conf/karma.0_2_5.conf.js',
singleRun: true,
browsers: [ grunt.option('browser') || 'PhantomJS' ]
},
uirouter0_2_6: {
configFile: 'test/conf/karma.0_2_6.conf.js',
singleRun: true,
browsers: [ grunt.option('browser') || 'PhantomJS' ]
},
uirouter0_2_7: {
configFile: 'test/conf/karma.0_2_7.conf.js',
singleRun: true,
browsers: [ grunt.option('browser') || 'PhantomJS' ]
},
uirouter0_2_8: {
configFile: 'test/conf/karma.0_2_8.conf.js',
singleRun: true,
browsers: [ grunt.option('browser') || 'PhantomJS' ]
},
uirouter0_2_10: {
configFile: 'test/conf/karma.0_2_10.conf.js',
singleRun: true,
browsers: [ grunt.option('browser') || 'PhantomJS' ]
},
HEAD: {
configFile: 'test/conf/karma.HEAD.conf.js',
singleRun: true,
browsers: [ grunt.option('browser') || 'PhantomJS' ]
},
watch: {
configFile: 'test/conf/karma.conf.js',
browsers: [ grunt.option('browser') || 'PhantomJS' ],
singleRun: false,
autoWatch: true,
autoWatchInterval: 1
},
debug: {
singleRun: false,
background: false,
browsers: [ grunt.option('browser') || 'Chrome' ]
}
}
});
/**
register/define grunt tasks
@toc 6.
*/
// Default task(s).
grunt.registerTask('default', ['jshint:beforeconcatQ', 'concat', 'uglify:build',
'karma:uirouter0_2_5', 'karma:uirouter0_2_6', 'karma:uirouter0_2_7', 'karma:uirouter0_2_8', 'karma:uirouter0_2_10', 'karma:HEAD'
]);
grunt.registerTask('test', ['jshint:beforeconcatQ', 'concat', 'karma:unit']);
grunt.registerTask('test:watch', ['jshint:beforeconcatQ', 'karma:watch']);
}
init({}); //initialize here for defaults (init may be called again later within a task)
};