From 8e88dd4164edd6ab9e95bd9274b86e0e98ab79e5 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Thu, 11 Apr 2024 01:02:44 +0200 Subject: [PATCH] refactor(cloudflare-pages): update root `wrangler.toml` in CI (#2355) --- src/presets/cloudflare-pages.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/presets/cloudflare-pages.ts b/src/presets/cloudflare-pages.ts index 3a0f09022f..479a971db5 100644 --- a/src/presets/cloudflare-pages.ts +++ b/src/presets/cloudflare-pages.ts @@ -12,6 +12,7 @@ import { defineNitroPreset } from "../preset"; import type { Nitro } from "../types"; import { CloudflarePagesRoutes } from "../types/presets/cloudflare"; import defu from "defu"; +import { isCI } from "std-env"; export const cloudflarePages = defineNitroPreset({ extends: "cloudflare", @@ -237,6 +238,10 @@ async function writeCFWrangler(nitro: Nitro) { const wranglerConfig: WranglerConfig = defu(configFromFile, inlineConfig); - const wranglerPath = join(nitro.options.output.publicDir, "wrangler.toml"); + const wranglerPath = join( + isCI ? nitro.options.rootDir : nitro.options.buildDir, + "wrangler.toml" + ); + await fsp.writeFile(wranglerPath, stringifyTOML(wranglerConfig)); }