-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
158 lines (139 loc) · 3.65 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
/*global module:false*/
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
// Task configuration.
jshint: {
options: {
"devel": true,
"curly": true,
"eqeqeq": true,
"immed": true,
"latedef": true,
"newcap": true,
"noarg": true,
"sub": true,
"undef": true,
"unused": true,
"boss": true,
"eqnull": true,
"browser": true,
"globals": {
"jQuery": true,
"sap": true,
"$": true,
"util": true,
"view": true,
"model": true
}
},
gruntfile: {
src: "Gruntfile.js"
},
application: {
src: ["model/**/*.js", "util/**/*.js", "view/**/*.js", "*.js", "!util/fastclick.js"]
}
},
qunit: {
all: {
src: ["test/**/*.html"]
}
},
watch: {
gruntfile: {
files: "<%= jshint.gruntfile.src %>",
tasks: ["jshint:gruntfile"]
},
qunit: {
files: ["<%= jshint.application.src %>", "<%= qunit.all.src %>"],
tasks: ["qunit"]
},
application: {
files: "<%= jshint.application.src %>",
tasks: ["jshint:application"]
},
livereload: {
options: {
livereload: "<%= connect.options.livereload %>"
},
//files: "<%= jshint.application.src %>" // Be careful to not watch npm dependencies
files: ["model/**/*.js", "util/**/*.js", "view/**/*.js", "*.js", "view/**/*.xml"]
}
},
open: {
root: {
path: "http://<%= connect.options.hostname %>:<%= connect.options.port %>",
options: {
delay: 500
}
}
},
connect: {
options: {
port: 9000,
livereload: 35729,
hostname: "0.0.0.0",
base: [".", "../sapui5/latest"]
},
/*
//=====================================================================
//RESOURCE PROXY - un-comment the proxies setting below to configure
//a proxy. context, host and changeOrigin are necessary. port defaults
//to 80 anyway and rewrite allows you to re-write the url's sent to
//the target host if you require this.
//Also un-comment the connect middleware option under the
//connect:livereload target - this starts the proxy which looks up
//the proxies setting to determine which services to act on.
//When not using grunt-connect-proxy you still must have the
//livereload target for connect.
//
proxies: {
context: "/Northwind", // When the url contains this...
host: "services.odata.org", // Proxy to this host
changeOrigin: true
//port: 80 //,
//rewrite: {
// "^/odata": ""
//"^/changingcontext": "/anothercontext"
//}
},
//=====================================================================
*/
// Requires the Livereload browser extension or a middleware to inject the livereload script
livereload: {
/*
options: {
middleware: function(connect, options) {
if (!Array.isArray(options.base)) {
options.base = [options.base];
}
// Setup the proxy
var middlewares = [require("grunt-connect-proxy/lib/utils").proxyRequest];
// Serve static files.
options.base.forEach(function(base) {
middlewares.push(connect.static(base));
});
return middlewares;
}
}
*/
}
}
});
// These plugins provide necessary tasks
grunt.loadNpmTasks("grunt-contrib-qunit");
grunt.loadNpmTasks("grunt-contrib-jshint");
grunt.loadNpmTasks("grunt-contrib-watch");
grunt.loadNpmTasks("grunt-open");
grunt.loadNpmTasks("grunt-contrib-connect");
grunt.loadNpmTasks("grunt-connect-proxy");
grunt.registerTask("default", ["jshint", "qunit:all", "watch"]);
grunt.registerTask("serve", function() {
grunt.task.run([
"configureProxies",
"connect:livereload",
"open",
"watch"
]);
});
};