File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import nodePreset from './node'
1010
1111export default definePreset ( {
1212 name : 'nuxthub' ,
13- async setup ( options , nuxt ) {
13+ async setup ( options , nuxt , config ) {
1414 const nuxtOptions = nuxt . options as unknown as { hub : { db ?: string | object | false , database ?: boolean } }
1515 if ( ! nuxtOptions . hub ?. db && ! nuxtOptions . hub ?. database ) {
1616 logger . warn ( 'NuxtHub dedected but the database is not enabled. Using local SQLite as default database instead.' )
@@ -35,6 +35,13 @@ export default definePreset({
3535 options . database ||= { type : hubDb . driver as 'sqlite' | 'postgresql' | 'postgres' | 'libsql' | 'pglite' , ...hubDb . connection } as unknown as SqliteDatabaseConfig | LibSQLDatabaseConfig | PGliteDatabaseConfig
3636 }
3737 }
38+ const preset = ( process . env . NITRO_PRESET || nuxt . options . nitro . preset || provider ) . replace ( / _ / g, '-' )
39+ if ( preset . includes ( 'cloudflare' ) ) {
40+ await cloudflarePreset . setup ?.( options , nuxt , config )
41+ }
42+ else {
43+ await nodePreset . setup ?.( options , nuxt , config )
44+ }
3845 } ,
3946 async setupNitro ( nitroConfig , options ) {
4047 const { nuxt } = options as unknown as { nuxt : Nuxt & { options : { hub : { db ?: boolean | object , database ?: boolean } } } }
You can’t perform that action at this time.
0 commit comments