-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgruntfile.js
68 lines (58 loc) · 1.77 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
var path = require("path");
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-ts');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-shell');
var androidAvd = grunt.option('avd') || "nexus"
var genyDevice = grunt.option('geny') || "nexus"
var iOSDevice = grunt.option('device') || "nexus"
grunt.initConfig({
ts: {
build: {
tsconfig: 'tsconfig.json',
options: {
fast: "never",
compiler: "node_modules/typescript/bin/tsc",
},
},
},
copy: {
appFiles: {
expand: true,
cwd: 'src',
src: [
'**/*',
'!**/*.ts',
'!typings/**/*.ts',
],
dest: 'app'
},
},
shell: {
emulateAndroid: {
command: "tns emulate android --avd \"" + androidAvd +"\""
},
emulateGeny: {
command: "tns emulate android --geny \"" + genyDevice +"\""
},
emulateIOS: {
command: "tns emulate ios --device \"" + iOSDevice +"\""
}
}
});
grunt.registerTask("removeAppDir", function() {
grunt.file.delete("app");
});
grunt.registerTask("app", [
"copy:appFiles",
"ts:build",
]);
grunt.registerTask("app-full", [
"clean",
"app",
]);
grunt.registerTask("run-android", ["app", "shell:emulateAndroid"])
grunt.registerTask("run-geny", ["app", "shell:emulateGeny"])
grunt.registerTask("run-ios", ["app", "shell:emulateIOS"])
grunt.registerTask("clean", ["removeAppDir"]);
}