11#!/usr/bin/env node
2- import { cp } from 'node:fs/promises' ;
2+ import { cp , access , constants } from 'node:fs/promises' ;
33import { join , dirname } from 'node:path' ;
44import { fileURLToPath } from 'node:url' ;
55
@@ -14,12 +14,25 @@ const staticDest = join(pkgDir, '.next', 'standalone', 'packages', 'ui', '.next'
1414const publicSrc = join ( pkgDir , 'public' ) ;
1515const publicDest = join ( pkgDir , '.next' , 'standalone' , 'packages' , 'ui' , 'public' ) ;
1616
17+ // Copy database file to standalone build
18+ const dbSrc = join ( pkgDir , 'leanspec.db' ) ;
19+ const dbDest = join ( pkgDir , '.next' , 'standalone' , 'packages' , 'ui' , 'leanspec.db' ) ;
20+
1721try {
1822 await cp ( staticSrc , staticDest , { recursive : true , force : true } ) ;
1923 console . log ( '✓ Copied .next/static to standalone build' ) ;
2024
2125 await cp ( publicSrc , publicDest , { recursive : true , force : true } ) ;
2226 console . log ( '✓ Copied public assets to standalone build' ) ;
27+
28+ // Copy database if it exists (created by db:seed)
29+ try {
30+ await access ( dbSrc , constants . F_OK ) ;
31+ await cp ( dbSrc , dbDest , { force : true } ) ;
32+ console . log ( '✓ Copied leanspec.db to standalone build' ) ;
33+ } catch {
34+ console . log ( '⚠ No leanspec.db found (skipping database copy)' ) ;
35+ }
2336} catch ( error ) {
2437 console . error ( 'Failed to copy assets:' , error ) ;
2538 process . exit ( 1 ) ;
0 commit comments