-
-
Notifications
You must be signed in to change notification settings - Fork 653
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: integrate with NuxtHub database queries (#3019)
- Loading branch information
Showing
16 changed files
with
180 additions
and
154 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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 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 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 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 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,20 @@ | ||
import { mkdir, writeFile } from 'node:fs/promises' | ||
import { resolve } from 'pathe' | ||
import { definePreset } from '../utils/preset' | ||
import cfPreset from './cloudflare-pages' | ||
|
||
export default definePreset({ | ||
name: 'nuxthub', | ||
async setupNitro(nitroConfig, options) { | ||
await cfPreset.setupNitro(nitroConfig, options) | ||
|
||
if (nitroConfig.dev === false) { | ||
// Write SQL dump to database queries when not in dev mode | ||
const sql = Object.values(options.manifest.dump).map(value => value.join('\n')).join('\n') | ||
await mkdir(resolve(nitroConfig.rootDir, '.data/hub/database/queries'), { recursive: true }) | ||
await writeFile(resolve(nitroConfig.rootDir, '.data/hub/database/queries/content-database.sql'), sql) | ||
// Disable integrity check in production for performance | ||
nitroConfig.runtimeConfig.content.integrityCheck = false | ||
} | ||
}, | ||
}) |
This file contains 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 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
Oops, something went wrong.