-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·52 lines (43 loc) · 1.03 KB
/
build.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
set -e
set -o pipefail
echo Starting build...
if [ -z "$1" ]
then
env="dev"
else
if [ $1 == "dev" ] || [ $1 == "prod" ]
then
env=$1
else
echo Invalid env arguement $1
exit 1
fi
fi
echo Building for $env environment
echo Checking build dependencies...
# TODO(Fede): check for typescript version and give an error
# if it is incorrect.
if command -v tsc >/dev/null 2>&1; then
echo Typescript is already installed.
else
echo Did not find Typescript
echo Installing...
npm install -g typescript
fi
# Reset the build directory
rm -rf build
mkdir -p build
# Get html file
echo Copying .html files...
cp src/index.html build/index.html
echo .html Files copied successfully
# Get js file
echo Compiling .ts files...
envFile="src/config/${env}.ts"
tsc $envFile src/types.ts src/shaders.ts src/index.ts --outFile build/index.js --lib dom,es2015
echo .ts Files compiled successfully
# Copy images
echo Copying .png files...
cp src/assets/*.png build/
echo .png Files copied successfully