Skip to content

Commit ed3bc2f

Browse files
authored
fix(create-cloudflare): use tabs for indentation in wrangler.json (#8152)
* fix: wrangler.json tabs * chore: format * fix: config tests * chore: changeset
1 parent 5734014 commit ed3bc2f

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

.changeset/wild-kiwis-behave.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"create-cloudflare": patch
3+
---
4+
5+
fix: generated wrangler.json and wrangler.jsonc files will now be formatted with tabs, to match the rest of the generated files

packages/create-cloudflare/src/wrangler/__tests__/config.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,13 @@ describe("update wrangler config", () => {
107107
* https://developers.cloudflare.com/workers/wrangler/configuration/
108108
*/
109109
{
110-
"$schema": "node_modules/wrangler/config-schema.json",
111-
"name": "test",
112-
"main": "src/index.ts",
113-
"compatibility_date": "2024-01-17",
114-
"observability": {
115-
"enabled": true
116-
}
110+
"$schema": "node_modules/wrangler/config-schema.json",
111+
"name": "test",
112+
"main": "src/index.ts",
113+
"compatibility_date": "2024-01-17",
114+
"observability": {
115+
"enabled": true
116+
}
117117
/**
118118
* Smart Placement
119119
* Docs: https://developers.cloudflare.com/workers/configuration/smart-placement/#smart-placement

packages/create-cloudflare/src/wrangler/config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ export const updateWranglerConfig = async (ctx: C3Context) => {
4545
ensureNameExists(parsed, ctx.project.name),
4646
);
4747

48-
const comment = `/**\n * For more details on how to configure Wrangler, refer to:\n * https://developers.cloudflare.com/workers/wrangler/configuration/\n */\n{\n "$schema": "node_modules/wrangler/config-schema.json",`;
48+
const comment = `/**\n * For more details on how to configure Wrangler, refer to:\n * https://developers.cloudflare.com/workers/wrangler/configuration/\n */\n{\n\t"$schema": "node_modules/wrangler/config-schema.json",`;
4949

5050
if (!modified["observability"]) {
5151
modified["observability"] = { enabled: true };
5252
}
53-
const stringified = comment + JSON.stringify(modified, null, 2).slice(1);
53+
const stringified = comment + JSON.stringify(modified, null, "\t").slice(1);
5454

5555
writeWranglerJson(
5656
ctx,

0 commit comments

Comments
 (0)