forked from TobiasOetzel/mdSkeleton
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathGruntfile.js
155 lines (134 loc) · 2.99 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
/*eslint-env node*/
'use strict';
module.exports = function(grunt) {
grunt.initConfig({
watch: {
all: {
files: 'app/**/*',
tasks: ['newer:copy:all','newer:babel:all']
},
options: {
atBegin: true,
spawn: false
}
},
babel: {
options: {
externalHelpers: true,
sourceMap: 'inline',
modules: 'babel-ui5-module-formatter'
},
all: {
files: [{
expand: true,
cwd: 'app/',
src: ['**/*.js'],
dest: '<%= dir.dist %>'
}]
}
},
copy: {
all: {
files: [{
expand: true,
cwd: 'app/',
src: ['**/*', '!**/*.js'],
dest: 'dist/'
}]
}
},
dir: {
webapp: 'app',
tests: 'test',
dist: 'dist',
bower_components: 'bower_components',
localServerTestUrl : 'http://localhost:8080/test-resources'
},
connect: {
options: {
port: 8080,
hostname: '*'
},
src: {},
dist: {}
},
openui5_connect: {
options: {
resources: [
'<%= dir.bower_components %>/openui5/src/sap.ui.core/src',
'<%= dir.bower_components %>/openui5/src/sap.m/src',
'<%= dir.bower_components %>/openui5/src/sap.ui.layout/src',
'<%= dir.bower_components %>/openui5/src/themelib_sap_bluecrystal/src'
]
},
src: {
options: {
appresources: ['.'],
testresources: ['<%= dir.tests %>']
}
},
dist: {
options: {
appresources: '<%= dir.dist %>'
}
}
},
eslint: {
options: {
quiet: true
},
all: ['<%= dir.tests %>', '<%= dir.webapp %>'],
webapp: ['<%= dir.webapp %>']
},
qunit: {
options: {
/* for debugging*/
'--remote-debugger-autorun' : 'yes',
'--remote-debugger-port' : 8000
},
unit: {
options: {
urls: [
'<%= dir.localServerTestUrl %>/unit/unitTests.qunit.html'
]
}
},
opa: {
options: {
urls: [
'<%= dir.localServerTestUrl %>/integration/opaTests.qunit.html'
],
// same as qunits timeout 90 seconds since opa test might take a while
timeout: 900000
}
}
}
});
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-openui5');
grunt.loadNpmTasks('grunt-eslint');
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-babel');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-newer');
// Server task
grunt.registerTask('serve', function(target) {
grunt.task.run(['openui5_connect:' + (target || 'src'), 'watch']);
});
// Linting task
grunt.registerTask('lint', ['eslint:all']);
// Build task
grunt.registerTask('build', ['openui5_preload', 'copy']);
// Test task
grunt.registerTask('test', ['openui5_connect:src', 'qunit:unit', 'qunit:opa']);
grunt.registerTask('unitTest', ['openui5_connect:src', 'qunit:unit']);
grunt.registerTask('opaTest', ['openui5_connect:src', 'qunit:opa']);
// Default task
grunt.registerTask('default', [
'lint:all',
'test'
]);
};