forked from Siyfion/angular-typeahead
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
116 lines (109 loc) · 2.88 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
"use strict";
/* jshint node: true */
module.exports = function (grunt) {
var karma_browser = process.env.KARMA_BROWSER || 'Chrome';
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
clean: {
files: {
src: [
'build/'
]
}
},
copy: {
files: {
expand: true,
src: ['angular-typeahead.js', 'angular-typeahead.min.js'],
cwd: 'build',
dest: 'dist/'
}
},
uglify: {
build: {
src: 'build/angular-typeahead.js',
dest: 'build/angular-typeahead.min.js'
}
},
karma: {
global: {
configFile: 'test/karma.global.conf.js',
browsers: [ karma_browser ]
},
amd: {
configFile: 'test/karma.amd.conf.js',
browsers: [ karma_browser ]
},
cjs: {
configFile: 'test/karma.cjs.conf.js',
browsers: [ karma_browser ]
}
},
jshint: {
default: {
options: {
jshintrc: true,
},
files: {
src: [
'angular-typeahead.js',
'test/*.js']
}
}
},
umd: {
src: {
options: {
src: 'angular-typeahead.js',
dest: 'build/angular-typeahead.js',
amdModuleId: 'angular-typeahead',
deps: {
default: ['angular'],
global: ['angular'],
amd: ['angular'],
cjs: ['angular', 'typeahead.js']
}
}
},
test: {
src: 'test/angular-typeahead.spec.js',
dest: 'build/angular-typeahead.spec.js',
amdModuleId: 'build/angular-typeahead.spec',
deps: {
default: ['angular'],
global: ['angular'],
amd: ['angular', 'angular-typeahead', 'angular-mocks'],
cjs: ['angular', 'angular-typeahead', 'angular-mocks']
}
}
},
watch: {
default: {
files: [
'angular-typeahead.js',
'test/angular-typeahead.spec.js'],
tasks: ['test:lite'],
options: {
spawn: false,
},
},
},
});
// Load the plugins that provide the tasks.
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-umd');
grunt.registerTask('require-self', 'Fixes require calls to self for tests', require('./tasks/require-self'));
// Utility Tasks
grunt.registerTask('_build', ['require-self', 'umd']);
grunt.registerTask('_test', ['karma', 'jshint']);
// Tasks
grunt.registerTask('test:lite', ['_build', 'karma:global', 'jshint']);
grunt.registerTask('test', ['_build', '_test']);
grunt.registerTask('dist', ['_build', 'uglify', 'copy']);
};