-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathGruntfile.js
131 lines (116 loc) · 3.55 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
//jshint node:true
"use strict";
module.exports = function(grunt) {
var ui5version = ""; //jshint ignore:line
var uirepo = "sapui5.hana.ondemand.com"; //jshint ignore:line
// measures the time each task takes
require("time-grunt")(grunt);
// Project configuration.
grunt.initConfig({
// Configuration to be run (and then tested).
openui5_preload: { //jshint ignore:line
component: {
options: {
resources: {
cwd: "src/main/webapp", // path to app root folder
src: [
"**/*.js",
"**/*.fragment.html",
"**/*.fragment.json",
"**/*.fragment.xml",
"**/*.view.html",
"**/*.view.json",
"**/*.view.xml",
"**/*.properties"
],
prefix: "com/sap/mentors/lemonaid" // namespace prefix (in case the namespace is not already in folder structure like sap/ui/core/**)
},
compress: true,
dest: "src/main/webapp"
},
components: true
}
},
// Local server
connect: {
server: {
options: {
port: 8000,
hostname: "localhost",
base: {
path: "src/main/webapp",
index: "index.html",
},
keepalive: false,
livereload: true,
//open: true,
middleware: function (connect, options, defaultMiddleware) {
return [require("grunt-connect-proxy/lib/utils").proxyRequest].concat(defaultMiddleware);
}
},
proxies: [
{
context: "/odata.svc",
host: "finder.sapmentors.sap.com",
changeOrigin: true,
port: 443,
https: true
},
{
context: "/userapi",
host: "finder.sapmentors.sap.com",
changeOrigin: true,
port: 443,
https: true
}
]
}
},
// validate JS files
jshint: {
files: [
"Gruntfile.js",
"src/main/webapp/**/*.js",
"!src/main/webapp/util/**",
"!src/main/webapp/*-preload.js"
],
options: {
jshintrc: ".jshintrc"
}
},
//validate XML files (XML Views)
xml_validator: { //jshint ignore:line
your_target: { //jshint ignore:line
src: ["src/main/webapp/**/*.xml"]
},
},
//watch for changed files and reload browser
watch: {
livereload: {
options: {
livereload: 35729,
keepAlive:true
},
tasks: ["validate"],
files: ["<%= jshint.files %>", "<%= xml_validator.your_target.src %>"]
},
}
});
grunt.loadNpmTasks("grunt-openui5");
grunt.loadNpmTasks("grunt-connect-proxy");
grunt.loadNpmTasks("grunt-contrib-connect");
grunt.loadNpmTasks("grunt-xml-validator");
grunt.loadNpmTasks("grunt-contrib-jshint");
grunt.loadNpmTasks("grunt-contrib-watch");
grunt.registerTask("default", [ "openui5_preload"]);
grunt.registerTask("validate", [
"jshint",
"xml_validator"]);
/*grunt.registerTask("default", [
"jshint",
"xml_validator",
"configureProxies:server",
"connect:server",
"watch"]);
*/
};