-
Notifications
You must be signed in to change notification settings - Fork 176
/
Gruntfile.js
116 lines (113 loc) · 2.77 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
module.exports = function(grunt) {
require('time-grunt')(grunt);
// Grunt Config
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
clean: {
dist: {
files: [{
dot: true,
src: [
'dist'
]
}]
}
},
copy: {
main: {
files: [{
src: './bundle.js',
dest: 'dist/'
}
// {expand: true, cwd: 'demo', src: ['script.js'], dest: 'dist'} // partials html file
// {expand: true, cwd: 'app', src: ['*.*'], dest: 'dist/'}
]
}
},
concat: {
basic_and_extras: {
files: {
'dist/angular-validation.js': ['src/module.js', 'src/provider.js', 'src/*.directive.js'],
'dist/angular-validation-rule.js': ['src/rule.js']
}
}
},
uglify: {
my_target: {
files: {
'dist/angular-validation.min.js': ['dist/angular-validation.js'],
'dist/angular-validation-rule.min.js': ['dist/angular-validation-rule.js']
}
}
},
jsbeautifier: {
files: ['src/**/*.js', 'test/unit/*.js', 'demo/*.js'],
options: {
js: {
indent_size: 2
}
}
},
jshint: {
all: ['*.js', 'src/**/*.js', 'test/unit/*.js', 'demo/*.js'],
options: {
jshintrc: true
}
},
browserSync: {
dev: {
bsFiles: {
src: ['index.html', 'demo/**', 'dist/angular-validation.js']
},
options: {
host: 'localhost',
ports: {
min: 8000,
max: 8100
},
server: {
baseDir: '.'
},
watchTask: true
}
}
},
watch: {
files: ['src/*.js'],
tasks: ['build'],
options: {
spawn: false,
interrupt: true
}
},
karma: {
// angular 1.2.x support to version angular-validation 1.2.x
// angular1_2: {
// configFile: 'config/karma.conf.angular.1.2.js'
// }
angular1_3: {
configFile: 'config/karma.conf.angular.1.3.js'
},
angular1_4: {
configFile: 'config/karma.conf.angular.1.4.js'
}
},
coveralls: {
options: {
debug: true,
coverageDir: 'coverage',
dryRun: false,
force: true,
recursive: true
}
}
});
require('load-grunt-tasks')(grunt);
// Register Task
grunt.registerTask('dev', ['browserSync', 'watch']);
grunt.registerTask('check', ['jshint', 'jsbeautifier']); // use this before commit
grunt.registerTask('build', ['check', 'clean', 'concat', 'uglify', 'copy']);
grunt.registerTask('test', ['build', 'karma']);
grunt.registerTask('cov', ['coveralls']);
grunt.registerTask('default', ['build', 'test']);
};