-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
94 lines (85 loc) · 2.18 KB
/
gulpfile.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
const gulp = require('gulp');
const texturePacker = require('gulp-free-tex-packer');
const run = require('gulp-run');
const audiosprite = require('gulp-audiosprite');
require('dotenv').config({
path: '.gulp.env',
});
gulp.task('pack-sprites-units', function() {
console.warn('Packing sprites is slow, this can take a few minutes!');
return gulp.src('raw/sprites/units/*.*')
.pipe(texturePacker({
textureName: 'unit-spritesheet',
textureFormat: 'png',
removeFileExtension: true,
prependFolderName: false,
base64Export: false,
tinify: true,
tinifyKey: process.env.TINIFY_KEY,
scale: 1,
filter: 'none',
exporter: 'JsonHash',
fileName: 'pack-result',
width: 2048,
height: 2048,
fixedSize: false,
powerOfTwo: false,
padding: 0,
extrude: 0,
allowRotation: true,
allowTrim: true,
trimMode: 'trim',
alphaThreshold: '0',
detectIdentical: true,
packer: 'OptimalPacker',
packerMethod: 'Automatic'
}))
.pipe(gulp.dest('public/assets/'));
});
gulp.task('add-animations-to-unit-spritesheet', () =>
run(
'ts-node -P tsconfig.node.json scripts/add-animations-to-unit-spritesheet'
)
.exec()
);
gulp.task(
'pack-sprites',
gulp.series(
'pack-sprites-units',
'add-animations-to-unit-spritesheet'
)
);
gulp.task('pack-sounds', function() {
return gulp.src('raw/sounds/*.mp3')
.pipe(audiosprite({
export: 'ogg,mp3',
path: 'assets',
output: 'sounds',
log: 'notice'
}))
.pipe(gulp.dest('public/assets/'));
});
gulp.task('generate-animation-models', () =>
run('ts-node -P tsconfig.node.json scripts/generate-animation-models.ts')
.exec()
);
gulp.task(
'pack',
gulp.series(
'pack-sounds',
'pack-sprites',
'generate-animation-models'
)
);
gulp.task('index-components', () =>
run('cti ./src/game/components -i *.spec.ts').exec()
);
gulp.task('index-events', () =>
run('cti ./src/game/events -i *.spec.ts').exec()
);
gulp.task('index-systems', () =>
run('cti ./src/game/systems -i *.spec.ts').exec()
);
gulp.task('index',
gulp.series('index-components', 'index-events', 'index-systems')
);