File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1414 "check-types" : " npm run lint && supabase stop && npm run dbdiff" ,
1515 "lint" : " tsx scripts/lint.ts" ,
1616 "lint:fix" : " tsx scripts/lint.ts -f" ,
17- "build" : " if [ $HOME != '/vercel' ]; then \n supabase start && supabase migrations up && (supabase gen types typescript --local --schema public > types.gen.ts) \n fi " ,
17+ "build" : " tsx scripts/build.ts " ,
1818 "gentypes:production" : " supabase start && supabase gen types typescript --project-id \" $SUPABASE_PROJECT_ID\" --schema public > types.gen.ts" ,
1919 "dbdiff" : " supabase stop && supabase db diff" ,
2020 "dbdiff:save" : " supabase stop && supabase db diff -f" ,
Original file line number Diff line number Diff line change 1+ import { execSync } from "node:child_process" ;
2+ import { writeFileSync } from "fs"
3+ import { join , dirname } from "path" ;
4+ import { fileURLToPath } from "url" ;
5+
6+ const __dirname = dirname ( fileURLToPath ( import . meta. url ) ) ;
7+ const projectRoot = join ( __dirname , '..' ) ;
8+
9+ if ( process . env . HOME !== '/vercel' ) {
10+ try {
11+ execSync ( 'supabase start' ) ;
12+ execSync ( 'supabase migrations up' ) ;
13+ const stdout = execSync ( 'supabase gen types typescript --local --schema public' , { encoding : 'utf8' } ) ;
14+ writeFileSync ( join ( projectRoot , 'types.gen.ts' ) , stdout ) ;
15+ } catch ( err ) {
16+ console . error ( err ) ;
17+ throw err ;
18+ }
19+ }
You can’t perform that action at this time.
0 commit comments