#!/bin/bash

set -e

echo "Updating nextjs-fullstack-aws..."
rm -rf examples/nextjs-fullstack-aws/infrastructure
pnpm dev init \
  --directory examples/nextjs-fullstack-aws \
  --resourceGroupType fullstack-aws \
  --name nextjs-fullstack-aws \
  --framework nextjs \
  --noScroll \
  --apply \
  --inputs includeStorage=public,includeDb=true,networkType=public,port=3000

echo "Updating nextjs-fullstack-aws-private..."
rm -rf examples/nextjs-fullstack-aws-private/infrastructure
pnpm dev init \
  --directory examples/nextjs-fullstack-aws-private \
  --resourceGroupType fullstack-aws \
  --name nextjs-fullstack-aws-private \
  --framework nextjs \
  --noScroll \
  --apply \
  --inputs includeStorage=private,includeDb=true,networkType=private,port=3000

echo "Updating nextjs-fullstack-aws-vanilla..."
rm -rf examples/nextjs-fullstack-aws-vanilla/infrastructure examples/nextjs-fullstack-aws-vanilla/Dockerfile examples/nextjs-fullstack-aws-vanilla/.dockerignore
pnpm dev init \
  --directory examples/nextjs-fullstack-aws-vanilla \
  --resourceGroupType fullstack-aws \
  --name nextjs-vanilla \
  --framework nextjs \
  --noScroll \
  --apply \
  --inputs includeStorage=none,includeDb=false,networkType=public,port=3000

echo "Updating express-fullstack-aws-vanilla..."
rm -rf examples/express-fullstack-aws-vanilla/infrastructure
pnpm dev init \
  --directory examples/express-fullstack-aws-vanilla \
  --resourceGroupType fullstack-aws \
  --name express-vanilla \
  --framework unknown \
  --noScroll \
  --apply \
  --inputs includeStorage=none,includeDb=false,networkType=public,port=9000

echo "Updating tanstack-fullstack-aws..."
rm -rf examples/tanstack-fullstack-aws/infrastructure
pnpm dev init \
  --directory examples/tanstack-fullstack-aws \
  --resourceGroupType fullstack-aws \
  --name tanstack-fullstack-aws \
  --framework tanstack-start \
  --noScroll \
  --apply \
  --inputs includeStorage=none,includeDb=false,networkType=public,port=3000

echo "Updating nextjs-staticsite-aws..."
rm -rf examples/nextjs-staticsite-aws/infrastructure
pnpm dev init \
  --directory examples/nextjs-staticsite-aws \
  --resourceGroupType staticsite-aws \
  --name nextjs-staticsite-aws \
  --framework nextjs \
  --noScroll \
  --apply \
  --inputs outputDir=out,port=3000

pnpm format