#!/bin/bash -e

ROOT=`dirname $0`

cd "$ROOT/.."

echo "Updating translations..."
if ! [ -d packages/desktop-client/locale ]; then
    git clone https://github.com/actualbudget/translations packages/desktop-client/locale
fi
pushd packages/desktop-client/locale > /dev/null
git checkout .
git pull
popd > /dev/null
packages/desktop-client/bin/remove-untranslated-languages

export NODE_OPTIONS="--max-old-space-size=4096"

yarn workspace @actual-app/crdt build
yarn workspace plugins-service build
yarn workspace @actual-app/core build:browser
yarn workspace @actual-app/web build:browser

echo "packages/desktop-client/build"
