The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
chore(studio): clear `.next/dev/cache` in `predev`, to mitigate high memory usage from cache buildup (#45199)
Beng Eub3dc867f9054
diff --git a/apps/studio/package.json b/apps/studio/package.jsonindex d7ed84274b1..e6107d87fde 100644--- a/apps/studio/package.json+++ b/apps/studio/package.json@@ -5,6 +5,7 @@"type": "module","scripts": {"preinstall": "npx only-allow pnpm",+ "predev": "node scripts/clean-turbopack-cache.mjs","dev": "next dev -p ${STUDIO_PORT:-8082}","build": "next build && if [ \"$SKIP_ASSET_UPLOAD\" != \"1\" ]; then ./../../scripts/upload-static-assets.sh; fi","start": "next start -p 8082",diff --git a/apps/studio/scripts/clean-turbopack-cache.mjs b/apps/studio/scripts/clean-turbopack-cache.mjsnew file mode 100644index 00000000000..e08449dbc33--- /dev/null+++ b/apps/studio/scripts/clean-turbopack-cache.mjs@@ -0,0 +1,21 @@+import { existsSync, readdirSync, rmSync, statSync } from 'fs'+import { join } from 'path'++// This script cleans up the Turbopack cache by removing files that haven't been modified in the last 3 days. This is to+// prevent the cache from growing indefinitely and consuming too much RAM.+const dir = '.next/dev/cache/turbopack'+const cutoff = Date.now() - 3 * 24 * 60 * 60 * 1000 // 3 days in milliseconds++function clean(d) {+ if (!existsSync(d)) return+ for (const entry of readdirSync(d, { withFileTypes: true })) {+ const p = join(d, entry.name)+ if (entry.isDirectory()) {+ clean(p)+ } else if (statSync(p).mtimeMs < cutoff) {+ rmSync(p)+ }+ }+}++clean(dir)