#!/bin/bash
set -euo pipefail


ROOT=`dirname $0`
cd "$ROOT/../../.."

if [ ! -d packages/desktop-client/build ]; then
    echo "Desktop client build not found. Please run 'yarn build' in the desktop-client package first."
    exit 1
fi

mkdir -p packages/mobile-client/build/
capgo bundle zip org.actualbudget \
    --name packages/mobile-client/build/bundle.zip \
    --package-json packages/desktop-client/package.json \
    --path packages/desktop-client/build \
    --no-code-check \
    --json > packages/mobile-client/build/bundle.json

echo "Created mobile app bundle."
