-
Notifications
You must be signed in to change notification settings - Fork 539
/
Gruntfile.js
123 lines (104 loc) · 3.25 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
module.exports = function(grunt) {
grunt.log.writeln("Building hawt.io");
grunt.config.init({
pkg: grunt.file.readJSON("package.json"),
/* task configuration */
// grunt-contrib-connect
connect: {
devserver: {
options: {
port: 8010,
base: 'src/main/webapp',
// middleware: function(connect, options) {
// },
keepalive: true
}
}
},
// grunt-karma
karma: {
unit: {
configFile: "src/test/config/karma.conf.js",
// override karmaConfig.js settings here:
singleRun: true,
autoWatch: false
},
chrome: {
configFile: "src/test/config/karma.conf.js",
browsers: [ "Chrome" ]
}
},
// grunt-typescript (~8 seconds)
typescript: {
base: {
src: [ "src/main/d.ts/*.d.ts", "src/main/webapp/app/**/*.ts" ],
dest: "src/main/webapp/app/app.js",
// dest: ".tscache/tsc",
options: {
comments: true,
module: "commonjs",
target: "ES5",
declaration: false,
watch: grunt.option("watch") ? {
path: "src/main/webapp/app",
// after: [ "concat:appjs" ],
atBegin: true
} : false
}
}
},
// grunt-ts (~10 seconds)
ts: {
build: {
src: [ "src/main/d.ts/*.d.ts", "src/main/webapp/app/**/*.ts" ],
out: "src/main/webapp/app/app.js",
watch: grunt.option("watch") ? "src/main/webapp/app" : false,
options: {
removeComments: false,
module: "commonjs",
target: "ES5",
declaration: false
}
}
},
// grunt-contrib-watch
watch: {
tsc: {
files: [ "src/main/webapp/app/**/*.ts" ],
tasks: [ "typescript:base" ]
// tasks: [ "ts:build" ]
}
},
// grunt-contrib-concat
concat: {
options: {
separator: "//~\n"
},
appjs: {
src: [ ".tscache/tsc/**/*.js" ],
// it produces app.js in wrong order
dest: "src/main/webapp/app/app.js"
}
}
});
/* load & register tasks */
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-typescript');
grunt.loadNpmTasks('grunt-ts');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-concat');
/* task aliases */
// "grunt webserver" starts a webserver which hosts hawt.io without backend Java server
// this might be however very useful to connect to existing Jolokia agent
grunt.registerTask("webserver", "Starts a webserver which hosts hawt.io without backend Java server", [ "connect:devserver" ]);
grunt.registerTask("test", "Runs unit tests once", [ "karma:unit" ]);
grunt.registerTask("test-chrome", "Runs unit tests continuously with autowatching", [ "karma:chrome" ]);
if (grunt.option("watch")) {
// grunt.registerTask("tsc", "Runs TypeScript compiler", [ "ts:build", "watch:tsc" ]);
grunt.registerTask("tsc", "Runs TypeScript compiler", [ "typescript:base", "watch:tsc" ]);
} else {
// grunt.registerTask("tsc", "Runs TypeScript compiler", [ "ts:build" ]);
grunt.registerTask("tsc", "Runs TypeScript compiler", [ "typescript:base" ]);
}
};