From 473de45f19a5bb53434a862e51bef12e1145d2dc Mon Sep 17 00:00:00 2001 From: giancarlo Date: Thu, 11 Apr 2024 17:01:27 +0800 Subject: [PATCH] Update Supabase server instructions and scripts Updated README.md and scripts to separate the 'web application' and 'Supabase server' in the development process. Modified package.json to include specific scripts for starting, stopping, and generating the Supabase schema. Also adjusted GitHub workflow to start Supabase server before running the app and reduced retention of Playwright report artifacts from 30 to 7 days. --- .github/workflows/workflow.yml | 13 +++++++++++-- README.md | 34 +++++++++++++++++++++++++++++++++- apps/web/package.json | 2 +- package.json | 3 +++ 4 files changed, 48 insertions(+), 4 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index e1e11cf2d..973f0bcd4 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -62,10 +62,19 @@ jobs: - name: Install dependencies run: pnpm install + - name: Install Playwright Browsers run: pnpm exec ./apps/e2e/node_modules/.bin/playwright install --with-deps + + - name: Supabase CLI + uses: supabase/setup-cli@v1 + + - name: Supabase Server + run: pnpm run supabase:web:start -- -x studio,migra,deno-relay,pgadmin-schema-diff,imgproxy,logflare + - name: Run App - run: pnpm run dev + run: pnpm run dev & + - name: Run Playwright tests run: pnpm run test - uses: actions/upload-artifact@v4 @@ -73,4 +82,4 @@ jobs: with: name: playwright-report path: playwright-report/ - retention-days: 30 + retention-days: 7 diff --git a/README.md b/README.md index f7a749171..f0b8bc04d 100644 --- a/README.md +++ b/README.md @@ -68,10 +68,42 @@ pnpm i pnpm dev ``` -This command will run both the web application and the Supabase container. If the Supabase container is already running, it will only start the web application. +This command will run the web application. Please refer to `apps/web/README.md` for more information about the web application. +### 3. Start the Supabase server + +To start the Supabase server, you can use the following command: + +```bash +# Start the Supabase server +pnpm run supabase:web:start +``` + +This command runs the Supabase server locally for the app `web`. + +Should you add more apps, you can run the following command: + +```bash +# Start the Supabase server for the app `app-name` +pnpm run supabase:app-name:start +``` + +And to stop the Supabase server, you can use the following command: + +```bash +# Stop the Supabase server +pnpm run supabase:web:stop +``` + +To generate the Supabase schema, you can use the following command: + +```bash +# Generate the Supabase schema +pnpm run supabase:web:typegen +``` + ## Architecture This project uses Turborepo to manage multiple packages in a single repository. diff --git a/apps/web/package.json b/apps/web/package.json index 6f5b40988..a35113891 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -14,7 +14,7 @@ "start": "pnpm with-env next start", "typecheck": "tsc --noEmit", "with-env": "dotenv -e ./.env.local --", - "supabase:dev": "supabase status || supabase start", + "supabase:start": "supabase status || supabase start", "supabase:stop": "supabase stop", "supabase:reset": "supabase db reset || supabase start", "supabase:status": "supabase status", diff --git a/package.json b/package.json index 81f3f0e1a..e61a4c34e 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,9 @@ "lint:fix": "turbo lint --continue -- --fix --cache --cache-location 'node_modules/.cache/.eslintcache' && manypkg fix", "typecheck": "turbo typecheck", "test": "turbo test", + "supabase:web:start": "pnpm --filter web supabase:start", + "supabase:web:stop": "pnpm --filter web supabase:stop", + "supabase:web:typegen": "pnpm --filter web supabase:typegen", "stripe:listen": "pnpm --filter '@kit/stripe' start" }, "prettier": "@kit/prettier-config",