Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
7 changes: 7 additions & 0 deletions .changeset/use-formatConfigSnippet-in-dev-compat-date.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"wrangler": patch
---

fix: use `formatConfigSnippet` for compatibility_date warning in `wrangler dev`

The compatibility_date warning shown when no date is configured in `wrangler dev` was hardcoded in TOML format. This now uses `formatConfigSnippet` to render the snippet in the correct format (TOML or JSON) based on the user's config file type.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import path from "node:path";
import { resolveDockerHost } from "@cloudflare/containers-shared";
import {
configFileName,
formatConfigSnippet,
getDisableConfigWatching,
getDockerPath,
getLocalWorkerdCompatibilityDate,
Expand Down Expand Up @@ -484,7 +485,7 @@ function getDevCompatibilityDate(
if (config?.configPath && compatibilityDate === undefined) {
logger.warn(
`No compatibility_date was specified. Using the installed Workers runtime's latest supported date: ${workerdDate}.\n` +
`❯❯ Add one to your ${configFileName(config.configPath)} file: compatibility_date = "${workerdDate}", or\n` +
`❯❯ Add one to your ${configFileName(config.configPath)} file: ${formatConfigSnippet({ compatibility_date: workerdDate }, config.configPath, false).trim()}, or\n` +
`❯❯ Pass it in your terminal: wrangler dev [<SCRIPT>] --compatibility-date=${workerdDate}\n\n` +
"See https://developers.cloudflare.com/workers/platform/compatibility-dates/ for more information."
);
Expand Down
Loading