This pages explains how the various dev scripts work in the repo.

Shell Scripts

Pocketbase Deployment Script

This script is musch simpler now than it used to be, due to setting pocketbase up as a system service on the server, and moving the static app hosting to firebase.

Now all it does is:

  • Stop pocketbase service
  • pull changes from the git repo
  • Restart the pocketbase service
  • Reload daemons

This script is run when any changes are made to pocketbase that need to be deployed to production via npm run deploy


Pocketbase install script

This script uses Environment variables to download and unzip the specified pocketbase version archive from github releases.
It also checks for and installs unzip to extract the executable.


NPM Scripts

npm scripts are located in package.json and contain useful commands that are used often.
use with:
npm run {script}

start

concurrently \"npm run dev\" \"npm run pb\"
Uses concurrently to start both the nuxt app and the pocketbase backend for working on in development.
Can be used without ‘run’ with:npm start

version

echo $npm_package_name v$npm_package_version
Prints the current app version

help

npm run
Lists these commands

build

nuxt generate
Builds the static site, output located in dist/

pb

cd ./pocketbase && ./pocketbase serve --dev
Serves the local pocketbase instance for development

installpb

./pocketbase/installpb.sh
Runs the above pocketbase install script locally. This will update your local pocketbase.

installpb:r

npm run env && source .env && ssh ${SERVER_USER}@${SERVER_HOST} \"cd ${APP_PATH} && ./pocketbase/installpb.sh\" && npm run deploy
Syncs remote environment and installs a new version pocketbase on the remote production server.

ios

npm run setenv:prod && nuxt generate && npx cap sync && npm run setenv:dev
Builds the iOS app

setenv:prod & setenv:dev

cp ./.env.production ./.env & cp ./.env.development ./.env
Writes local .env to either .env.production or .env.development

assets

npx @capacitor/assets generate
Generates iOS assets, app icon and splashscreen. It uses the following assets:

  • assets/icon.png
  • assets/splash.png
  • assets/splash-dark.png

tag

git tag $npm_package_version && git push origin $npm_package_version
Creates and pushes a new tag on the current commit with the current app version

ssh

source .env && ssh ${SERVER_USER}@${SERVER_HOST}
ssh into the remote pocketbase server using config in .env

env

echo 'syncing env to remote' && 
source .env && 
scp ./.env.production ${SERVER_USER}@${SERVER_HOST}:${APP_PATH}/.env && 
scp ./pocketbase/pb_hooks/env.json 

Syncs .env.production & env.json to the remote production server. Details in Environment.

deploy

./deploy.sh
Runs the above deploy script to update pocketbase on the remote server.

fb

npm run setenv:prod && npm run generate && firebase deploy --only hosting:tansyapp && npm run setenv:dev
Short for ‘firebase’, this command builds and deploys the app to firebase.