Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/deploy-supabase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,22 @@ jobs:

steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: supabase/setup-cli@v1
with:
version: 2.24.3

- name: "Sentry - Create release"
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ vars.SENTRY_ORG }}
SENTRY_PROJECT: ${{ vars.SENTRY_PROJECT }}
run: |
npx @sentry/cli releases new ${{ github.sha }}
npx @sentry/cli releases set-commits ${{ github.sha }} --auto
npx @sentry/cli releases deploys ${{ github.sha }} new -e production

- name: "Supabase - Remote Connect"
env:
PROJECT_ID: ${{ secrets.SUPABASE_PROJECT_ID }}
Expand All @@ -30,4 +42,12 @@ jobs:
run: |
supabase link --project-ref $PROJECT_ID
supabase db push
supabase secrets set SENTRY_RELEASE=${{ github.sha }}
supabase functions deploy --use-api

- name: "Sentry - Finalize release"
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ vars.SENTRY_ORG }}
SENTRY_PROJECT: ${{ vars.SENTRY_PROJECT }}
run: npx @sentry/cli releases finalize ${{ github.sha }}
5 changes: 5 additions & 0 deletions .github/workflows/deploy-web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ jobs:
env:
VITE_SUPABASE_URL: ${{ vars.VITE_SUPABASE_URL }}
VITE_SUPABASE_ANON_KEY: ${{ vars.VITE_SUPABASE_ANON_KEY }}
VITE_SENTRY_DSN: ${{ vars.VITE_SENTRY_DSN }}
VITE_RELEASE: ${{ github.sha }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ vars.SENTRY_ORG }}
SENTRY_PROJECT: ${{ vars.SENTRY_PROJECT }}
run: |
cd src/web
deno run compile
Expand Down
6 changes: 5 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,8 @@ Required in `.env` or Supabase secrets:

- Deno formatting: 2-space indent, double quotes, semicolons
- Run `deno task format` before committing
- Run `deno task lint` to check for issues
- Run `deno task lint` to check for issues

## Git

When creating new files, always stage them with `git add <file>` after creating them.
4 changes: 3 additions & 1 deletion src/web/deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
"react-loading-indicators": "npm:react-loading-indicators@^1.0.0",
"use-sound": "npm:use-sound@^5.0.0",
"usehooks-ts": "npm:usehooks-ts@^3.1.1",
"vite": "npm:vite@^7.3.1"
"vite": "npm:vite@^7.3.1",
"@sentry/react": "npm:@sentry/react@^10.43.0",
"@sentry/vite-plugin": "npm:@sentry/vite-plugin@^5.1.1"
}
}
14 changes: 14 additions & 0 deletions src/web/src/lib/sentry.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import * as Sentry from "@sentry/react";

export function initSentry() {
const dsn = import.meta.env.VITE_SENTRY_DSN;
if (!dsn) return;

Sentry.init({
dsn,
release: import.meta.env.VITE_RELEASE,
environment: import.meta.env.MODE,
integrations: [Sentry.browserTracingIntegration()],
tracesSampleRate: 1.0,
});
}
3 changes: 3 additions & 0 deletions src/web/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import { StrictMode } from "react";
// @deno-types="@types/react-dom/client"
import { createRoot } from "react-dom/client";
import App from "./app.tsx";
import { initSentry } from "./lib/sentry.ts";

initSentry();

createRoot(document.getElementById("root") as HTMLElement).render(
<StrictMode>
Expand Down
18 changes: 18 additions & 0 deletions src/web/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import process from "node:process";
import { defineConfig } from "vite";
import deno from "@deno/vite-plugin";
import react from "@vitejs/plugin-react";
import { lingui } from "@lingui/vite-plugin";
import { sentryVitePlugin } from "@sentry/vite-plugin";

// https://vite.dev/config/
export default defineConfig({
Expand All @@ -13,7 +15,23 @@ export default defineConfig({
},
}),
lingui(),
sentryVitePlugin({
org: process.env.SENTRY_ORG,
project: process.env.SENTRY_PROJECT,
authToken: process.env.SENTRY_AUTH_TOKEN,
release: {
name: process.env.VITE_RELEASE,
setCommits: { auto: true },
deploy: { env: process.env.NODE_ENV ?? "production" },
},
sourcemaps: {
filesToDeleteAfterUpload: ["dist/**/*.map"],
},
}),
],
build: {
sourcemap: true,
},
optimizeDeps: {
include: ["@tanstack/react-query"],
},
Expand Down
2 changes: 2 additions & 0 deletions supabase/functions/_shared/sentry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export class SentryErrorHandler {
Sentry.init({
dsn: Deno.env.get("SENTRY_DSN")!,
defaultIntegrations: false,
release: Deno.env.get("SENTRY_RELEASE"),
environment: "production",
tracesSampleRate: 1.0,
// deno-lint-ignore ban-ts-comment
// @ts-ignore
Expand Down
Loading