Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,15 @@ async function nitroModule(nitro: Nitro) {
return; // Production doesn't need this
}

// Find wrangler.toml
// Find wrangler.json > wrangler.jsonc > wrangler.toml
let configPath = nitro.options.cloudflareDev?.configPath;
if (!configPath) {
configPath = await findFile("wrangler.toml", {
startingFrom: nitro.options.srcDir,
}).catch(() => undefined);
configPath = await findFile(
["wrangler.json", "wrangler.jsonc", "wrangler.toml"],
{
startingFrom: nitro.options.srcDir,
},
).catch(() => undefined);
}

// Resolve the persist dir
Expand Down Expand Up @@ -60,7 +63,7 @@ async function nitroModule(nitro: Nitro) {
[
"🔥 Cloudflare context bindings enabled for dev server",
"",
`Config path: \`${configPath ? relative(".", configPath) : colorize("yellow", "cannot find `wrangler.toml`")}\``,
`Config path: \`${configPath ? relative(".", configPath) : colorize("yellow", "cannot find `wrangler.json`, `wrangler.jsonc`, or `wrangler.toml`")}\``,
`Persist dir: \`${relative(".", persistDir)}\` ${addedToGitIgnore ? colorize("green", "(added to `.gitignore`)") : ""}`,
].join("\n"),
);
Expand Down
Loading