-
Notifications
You must be signed in to change notification settings - Fork 11
chore: update supabase config, docs, deps, and security overrides #141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
bbb4675
chore: update supabase config, docs, deps, and security overrides
gaboesquivel 90171ec
feat(api): pnpm reset runs supabase reset, migrate, and seed
gaboesquivel 3134fc0
test(react): restore hook tests and fix vitest react resolution
gaboesquivel 018edf6
fix(api): stabilize scalar login e2e wait and pin api-reference cdn
gaboesquivel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| #!/usr/bin/env node | ||
| /** | ||
| * Data seed after a local Supabase reset. Invoked only from `pnpm reset` (apps/api or repo root via filter). | ||
| * (not from `pnpm db:migrate` / `pnpm build`). | ||
| * | ||
| * Add idempotent inserts here (`onConflictDoNothing()` / upserts). Uses the same | ||
| * PostgreSQL vs PGLite rules as `scripts/migrate.ts` (`RUN_PG_MIGRATE`, `DATABASE_URL`). | ||
| */ | ||
| import 'dotenv/config' | ||
| import { resolve } from 'node:path' | ||
| import { fileURLToPath } from 'node:url' | ||
| import { logger } from '@repo/utils/logger/server' | ||
| import { drizzle, type NodePgDatabase } from 'drizzle-orm/node-postgres' | ||
| import { Pool } from 'pg' | ||
| import * as schema from '../src/db/schema/index.js' | ||
| import { env } from '../src/lib/env.js' | ||
|
|
||
| const scriptFile = fileURLToPath(import.meta.url) | ||
|
|
||
| async function applySeed(_db: NodePgDatabase<typeof schema>): Promise<void> { | ||
| // Reference / dev rows only — extend with db.insert(...).onConflictDoNothing(), etc. | ||
| } | ||
|
|
||
| export async function runSeed(): Promise<void> { | ||
| const forcePg = process.env.RUN_PG_MIGRATE === 'true' | ||
| const shouldUsePGLite = !forcePg && (env.PGLITE === true || env.NODE_ENV === 'test') | ||
|
|
||
| if (shouldUsePGLite) { | ||
| logger.info({ context: 'seed' }, 'PGLite: skipping data seed') | ||
| return | ||
| } | ||
|
|
||
| if (!env.DATABASE_URL) throw new Error('DATABASE_URL is required when PGLITE is false') | ||
|
|
||
| const pool = new Pool({ connectionString: env.DATABASE_URL }) | ||
| const db = drizzle(pool, { schema }) | ||
| try { | ||
| await applySeed(db) | ||
| logger.info({ context: 'seed' }, 'Seed completed') | ||
| } finally { | ||
| await pool.end() | ||
| } | ||
| } | ||
|
|
||
| function isMainModule(): boolean { | ||
| const entry = process.argv[1] | ||
| if (!entry) return false | ||
| return resolve(entry) === scriptFile | ||
| } | ||
|
|
||
| async function main(): Promise<void> { | ||
| try { | ||
| await runSeed() | ||
| process.exit(0) | ||
| } catch (err) { | ||
| logger.error({ context: 'seed', err }, 'Seed failed') | ||
| process.exit(1) | ||
| } | ||
| } | ||
|
|
||
| if (isMainModule()) void main() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,36 @@ | ||
| import { realpathSync } from 'node:fs' | ||
| import { createRequire } from 'node:module' | ||
| import { dirname, resolve } from 'node:path' | ||
| import { fileURLToPath } from 'node:url' | ||
| import react from '@vitejs/plugin-react' | ||
| import { defineConfig } from 'vitest/config' | ||
|
|
||
| const configDir = dirname(fileURLToPath(import.meta.url)) | ||
| const require = createRequire(import.meta.url) | ||
|
|
||
| const reactPackageRoot = realpathSync(dirname(require.resolve('react/package.json'))) | ||
| const reactDomPackageRoot = realpathSync(dirname(require.resolve('react-dom/package.json'))) | ||
| const reactDomClientEntry = realpathSync(require.resolve('react-dom/client')) | ||
|
|
||
| export default defineConfig({ | ||
| plugins: [react()], | ||
| test: { | ||
| include: ['src/**/*.{test,spec}.{ts,tsx}'], | ||
| globals: true, | ||
| environment: 'jsdom', | ||
| setupFiles: ['./vitest.setup.ts'], | ||
| }, | ||
| resolve: { | ||
| // pnpm: keep symlinked package paths so react-dom and @tanstack/react-query share one react instance | ||
| preserveSymlinks: true, | ||
| dedupe: ['react', 'react-dom'], | ||
| alias: { | ||
| '@repo/core': resolve(configDir, '../core/src/index.ts'), | ||
| '@repo/ui': resolve(configDir, '../ui/src'), | ||
| '@repo/utils': resolve(configDir, '../utils/src'), | ||
| react: reactPackageRoot, | ||
| 'react-dom': reactDomPackageRoot, | ||
| 'react-dom/client': reactDomClientEntry, | ||
| }, | ||
| }, | ||
| }) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.