#!/bin/bash
buildPath=./build

# yarn build
# rm -rf $buildPath
# mkdir $buildPath

if cd $buildPath; then
    echo "Setting working directory to: '$buildPath'"
else
    echo "ERROR: Could not set working directory to '$buildPath'"
    exit -1
fi

if echo '{ "name": "test", "version": "1.0.0", "private": true, "devDependencies": { "@orchard/frontend-cli": "file:../" } }' > package.json; then
    echo "Creating project";
    yarn install
    yarn frontend init -o -t tsx
    yarn add @orchard/frontend-cli@file:../
    yarn start
fi
