aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts/dev/server.sh
blob: 680ca3d7915bf608c8c1730701e826575b8612af (plain) (blame)
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
#!/bin/bash

set -eu

if [ ! -f "./client/dist/en-US/index.html" ]; then
  if [ -z ${1+x} ] || [ "$1" != "--skip-client" ]; then
    echo "client/dist/en-US/index.html does not exist, compile client files..."
    npm run build:client -- --light
  fi
fi

# Copy locales
mkdir -p "./client/dist"
rm -rf "./client/dist/locale"
cp -r "./client/src/locale" "./client/dist/locale"

rm -rf "./dist"

mkdir "./dist"
cp "./tsconfig.json" "./dist"

npm run tsc -- --incremental --sourceMap
cp -r ./server/static ./server/assets ./dist/server

NODE_ENV=test node node_modules/.bin/concurrently -k \
  "node_modules/.bin/nodemon --delay 1 --watch ./dist dist/server" \
  "node_modules/.bin/tsc --incremental --sourceMap --preserveWatchOutput -w"