aboutsummaryrefslogblamecommitdiffhomepage
path: root/scripts/dev/server.sh
blob: 468af0a565ffdd0d546ea9f033f442deb8bbe63a (plain) (tree)
1
2
3
4
5
6
7
8
9
           

       
 
                                                  

                                                                               
                        
    

  









                                                  
                                  
                                                   
                                               
 
                                                      
                                                                                         
                                                     
#!/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
  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 -- -b -v --incremental
cp -r ./server/static ./server/assets ./dist/server
cp -r "./server/lib/emails" "./dist/server/lib"

NODE_ENV=test node node_modules/.bin/concurrently -k \
  "node_modules/.bin/nodemon --enable-source-maps --delay 1 --watch ./dist dist/server" \
  "node_modules/.bin/tsc -b -w --preserveWatchOutput"