-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
62 lines (58 loc) · 1.89 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
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-screeps');
grunt.loadNpmTasks('grunt-contrib-clean')
grunt.loadNpmTasks('grunt-contrib-copy')
grunt.loadNpmTasks('grunt-text-replace')
grunt.initConfig({
screeps: {
options: {
server:{
host: '120.26.76.96',
port: '21025',
http: true
},
email: 'saki',
password: 'Kaifa@123',
branch: 'dev',
ptr: false
},
dist: {
src: ['dist/*.js']
}
},
clean: {
'dist': ['dist']
},
copy: {
// 将游戏代码推送到dist文件夹,以便在将其发送到 screeps 服务器之前可以对其进行修改。
screeps: {
files: [{
expand: true,
cwd: 'src/',
src: '**',
dest: 'dist/',
filter: 'isFile',
rename: function (dest, src) {
// 通过将文件夹分隔符替换成下划线来重命名文件
return dest + src.replace(/\//g,'_');
}
}],
}
},
replace:{
requireReplace:{
src: ['dist/*.js'],
overwrite: true,
replacements:[{
from: /require.*/g,
to: function (requireString) {
requireString = requireString.replace('src/','')
requireString = requireString.replace(/\//g,'_')
return requireString;
}
}]
}
}
});
grunt.registerTask('default', ['clean', 'copy:screeps','replace','screeps']);
}