-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·58 lines (43 loc) · 1.1 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
53
54
55
56
57
#!/bin/env bash
root=$(pwd)
# Build all the monorepo packages first.
for dir in "./packages"/*; do
package=$(basename ${dir})
echo "Building $package..."
cd "$root/packages/$package"
pnpm install
pnpm run build
done
# Build the menu page.
cd "$root/apps/menu"
pnpm install
pnpm run build
distDir="$root/apps/menu/build"
targetDir="$root/dist"
# Remove the previous dist folder if it exists.
if [ -d "$targetDir" ]; then
rm -rf "$targetDir"
fi
# Copy the artifacts to the root dist folder.
mkdir -p "$targetDir"
cp -r "$distDir"/* "$targetDir"
cd ${root}
# Build all the games.
for dir in "./games"/*; do
game=$(basename ${dir})
echo "Building $game..."
cd "$root/games/$game"
pnpm install
pnpm run build
distDir="$root/games/$game/dist"
targetDir="$root/dist/$game"
# Remove the existing dist folder if it exists (for the current game).
if [ -d "$targetDir" ]; then
rm -rf "$targetDir"
fi
# Copy the artifacts to the root dist folder.
mkdir -p "$targetDir"
cp -r "$distDir"/* "$targetDir"
# Go back to the root folder to build the next game
cd ${root}
done