forked from candybox2/candybox2.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
compile.sh
executable file
·52 lines (32 loc) · 1.98 KB
/
compile.sh
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
#!/bin/bash
### Check existing commands
command -v tsc >/dev/null 2>&1 || { echo >&2 "The typescript compiler is not installed"; exit 1; }
command -v yuicompressor >/dev/null 2>&1 || { echo >&2 "Yuicompressor is not installed"; exit 1; }
command -v 7za >/dev/null 2>&1 || { echo >&2 "7zip is not installed"; exit 1; }
### Update the version written in the cacheManifest.mf file to force update of the whole game (see https://developer.mozilla.org/en-US/docs/HTML/Using_the_application_cache )
cd pythonScripts
python updateCacheManifestVersion.py
cd ..
### Generate genAscii.ts and genText.ts from the ascii and text files
### They will be added in the code/gen dir
cd pythonScripts
python genAscii.py
python genText.py
cd ..
### Compile the game using tsc
### It will generate the candybox2_uncompressed.js.temp script
tsc ./libs/*.ts ./code/main/*.ts ./code/gen/*.ts ./code/arena/*/* --out ./candybox2_uncompressed.js.temp
## Minify the script with yuicompressor, we get a candybox2.js.temp script
yuicompressor ./candybox2_uncompressed.js.temp --type js --line-break 80 -o candybox2.js.temp
### Create the candybox2.js file from the license and the temp file
cat candybox2_sourceCodeLicense.txt > candybox2.js
cat candybox2.js.temp >> candybox2.js
### Create the candybox2_uncompressed.js file from the license and the temp file
cat candybox2_sourceCodeLicense.txt > candybox2_uncompressed.js
cat candybox2_uncompressed.js.temp >> candybox2_uncompressed.js
### Remove the temp files
rm candybox2.js.temp candybox2_uncompressed.js.temp
### Create the .zip file we will give to others if they want to work on the game too :)
7za a candybox2.zip ascii code css libs pythonScripts text ascii_art.html cacheManifest.mf candybox2.js candybox2_sourceCodeLicense.txt candybox2_uncompressed.js compile.bat compile.sh create_quest.html faq.html favicon.png index.html install_tsc.html source_code.html
### Create the .zip file we will give to others if they want to work on the ascii art :)
7za a ascii_art.zip ascii