Skip to content

Commit c2e29b3

Browse files
committed
chore: add nitroPreset in hub.config.json
1 parent 85c7241 commit c2e29b3

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/module.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,18 +167,18 @@ export default defineNuxtModule<ModuleOptions>({
167167

168168
// Production mode without remote storage
169169
if (!hub.remote && !nuxt.options.dev) {
170-
// Make sure to fallback to cloudflare-pages preset
171-
let preset = nuxt.options.nitro.preset = nuxt.options.nitro.preset || 'cloudflare-pages'
170+
// Make sure to fallback to cloudflare_pages preset
171+
let preset = nuxt.options.nitro.preset = nuxt.options.nitro.preset || 'cloudflare_pages'
172172
// Support also cloudflare_module
173-
preset = String(preset).replace('_', '-')
173+
preset = String(preset).replace('-', '_')
174174

175-
if (!['cloudflare-pages', 'cloudflare-module', 'cloudflare-durable'].includes(preset)) {
176-
log.error('NuxtHub is only compatible with the `cloudflare-pages`, `cloudflare-module` or `cloudflare-durable` presets.')
175+
if (!['cloudflare_pages', 'cloudflare_module', 'cloudflare_durable'].includes(preset)) {
176+
log.error('NuxtHub is only compatible with the `cloudflare_pages`, `cloudflare_module` or `cloudflare_durable` presets.')
177177
process.exit(1)
178178
}
179179

180180
// @ts-expect-error compatibilityDate is not properly typed
181-
if (preset !== 'cloudflare-pages' && nuxt.options.compatibilityDate?.default && nuxt.options.compatibilityDate.default < '2024-11-20') {
181+
if (preset !== 'cloudflare_pages' && nuxt.options.compatibilityDate?.default && nuxt.options.compatibilityDate.default < '2024-11-20') {
182182
log.warn('Found a compatibility date in `nuxt.config.ts` earlier than `2024-09-19`, forcing it to `2024-09-19`. Please update your `nuxt.config.ts` file.')
183183
// @ts-expect-error compatibilityDate is not properly typed
184184
nuxt.options.compatibilityDate.default = '2024-09-19'

src/utils/build.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ export function addBuildHooks(nuxt: Nuxt, hub: HubConfig) {
122122
database: hub.database,
123123
kv: hub.kv,
124124
vectorize: hub.vectorize,
125-
bindings: hub.bindings
125+
bindings: hub.bindings,
126+
nitroPreset: nitro.options.preset
126127
}
127128
const distDir = nitro.options.output.dir || nitro.options.output.publicDir
128129
await writeFile(join(distDir, 'hub.config.json'), JSON.stringify(hubConfig, null, 2), 'utf-8')

0 commit comments

Comments
 (0)