Skip to content
Merged
Show file tree
Hide file tree
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
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,
getTodaysCompatDate,
getDisableConfigWatching,
getDockerPath,
Expand Down Expand Up @@ -482,7 +483,7 @@ function getDevCompatibilityDate(
if (config?.configPath && compatibilityDate === undefined) {
logger.warn(
`No compatibility_date was specified. Using today's date: ${todaysDate}.\n` +
`❯❯ Add one to your ${configFileName(config.configPath)} file: compatibility_date = "${todaysDate}", or\n` +
`❯❯ Add one to your ${configFileName(config.configPath)} file: ${formatConfigSnippet({ compatibility_date: todaysDate }, config.configPath, false).trim()}, or\n` +
`❯❯ Pass it in your terminal: wrangler dev [<SCRIPT>] --compatibility-date=${todaysDate}\n\n` +
"See https://developers.cloudflare.com/workers/platform/compatibility-dates/ for more information."
);
Expand Down
Loading