-
Notifications
You must be signed in to change notification settings - Fork 4
/
Gruntfile.js
106 lines (100 loc) · 3.49 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
module.exports = function(grunt) {
'use strict';
var clonedFiles = ["log", "angular-translate"];
// cmp src/log.ts ../multiplayer-games-web/ts/log.ts && ...
var compareCommand = clonedFiles.map(function (file) { return file + ".ts"; })
.map(function (file) { return "cmp ../emulator/src/" + file + " ../multiplayer-games-web/ts/" + file; })
.join(" && ");
console.log(compareCommand);
function removeREMOVEDWHENCOPIED(content, srcpath) {
if (content.indexOf('REMOVEDWHENCOPIED') == -1) throw new Error("Didn't find REMOVEDWHENCOPIED in " + srcpath);
return content.replace("REMOVEDWHENCOPIED", "");
};
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
ts: {
default : {
options: {
fast: 'never' // disable the grunt-ts fast feature
},
tsconfig: true
}
},
concat: {
options: {
separator: '\n;\n',
},
dist: {
src: [
'header_for_turnBasedServices_lib.js',
'dist/compilationDate.js',
'ts_output_readonly_do_NOT_change_manually/src/log.js',
'ts_output_readonly_do_NOT_change_manually/src/messageService.js',
'ts_output_readonly_do_NOT_change_manually/src/gameService.js',
'ts_output_readonly_do_NOT_change_manually/src/alphaBetaService.js',
'ts_output_readonly_do_NOT_change_manually/src/resizeGameAreaService.js',
'ts_output_readonly_do_NOT_change_manually/src/angular-translate.js',
'ts_output_readonly_do_NOT_change_manually/src/dragAndDropService.js',
'ts_output_readonly_do_NOT_change_manually/src/angularExceptionHandler.js',
],
dest: 'dist/turnBasedServices.4.js',
},
},
copy: {
friendlygo: {
src: 'dist/turnBasedServices.4.js',
dest: '../friendlygo/lib/turnBasedServices.4.js',
},
friendlygo2: {
src: 'src/multiplayer-games.d.ts',
dest: '../friendlygo/typings/multiplayer-games.d.ts',
options: {process: removeREMOVEDWHENCOPIED},
},
tictactoe: {
src: 'dist/turnBasedServices.4.js',
dest: '../tictactoe/lib/turnBasedServices.4.js',
},
tictactoe2: {
src: 'src/multiplayer-games.d.ts',
dest: '../tictactoe/typings/multiplayer-games.d.ts',
options: {process: removeREMOVEDWHENCOPIED},
},
ycheckers: {
src: 'dist/turnBasedServices.4.js',
dest: '../ycheckers/lib/turnBasedServices.4.js',
},
ycheckers2: {
src: 'src/multiplayer-games.d.ts',
dest: '../ycheckers/typings/multiplayer-games.d.ts',
options: {process: removeREMOVEDWHENCOPIED},
},
ycheckers3: {
src: 'ts_output_readonly_do_NOT_change_manually/src/emulator.js',
dest: '../ycheckers/ts_output_readonly_do_NOT_change_manually/src/emulator.js',
},
communityFire: {
src: 'src/multiplayer-games.d.ts',
dest: '../communityFire/typings/multiplayer-games.d.ts',
options: {process: removeREMOVEDWHENCOPIED},
},
},
shell: {
compareStateService: {
command: compareCommand,
},
compilationDate: {
command: 'echo \\"use strict\\"\\; var emulatorServicesCompilationDate = \\"`date`\\"\\; > dist/compilationDate.js'
}
}
});
require('load-grunt-tasks')(grunt);
// Default task(s).
grunt.registerTask('default', [
'ts',
'shell:compareStateService',
'shell:compilationDate',
'concat',
"copy",
]);
};