Skip to content

Commit d589d57

Browse files
committed
chore: add support for other cf presets
1 parent 21aa978 commit d589d57

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/module.ts

+13-2
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,22 @@ export default defineNuxtModule<ModuleOptions>({
153153
// Support also cloudflare_module
154154
preset = String(preset).replace('_', '-')
155155

156-
if (preset !== 'cloudflare-pages' && preset !== 'cloudflare-module') {
157-
log.error('NuxtHub is only compatible with the `cloudflare-pages` and `cloudflare-module` presets.')
156+
if (!['cloudflare-pages', 'cloudflare-module', 'cloudflare-durable'].includes(preset)) {
157+
log.error('NuxtHub is only compatible with the `cloudflare-pages`, `cloudflare-module` or `cloudflare-durable` presets.')
158158
process.exit(1)
159159
}
160160

161+
// @ts-expect-error compatibilityDate is not properly typed
162+
if (preset !== 'cloudflare-pages' && nuxt.options.compatibilityDate?.default && nuxt.options.compatibilityDate.default < '2024-11-20') {
163+
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.')
164+
// @ts-expect-error compatibilityDate is not properly typed
165+
nuxt.options.compatibilityDate.default = '2024-09-19'
166+
}
167+
168+
// Make sure to always set the output to dist/
169+
nuxt.options.nitro.output ||= {}
170+
nuxt.options.nitro.output.dir = 'dist'
171+
161172
// Update the deploy command displayed in the console
162173
nuxt.options.nitro.commands = nuxt.options.nitro.commands || {}
163174
nuxt.options.nitro.commands.preview = 'npx nuxthub preview'

0 commit comments

Comments
 (0)