Skip to content

Commit 17531bf

Browse files
committed
fixup! use the <SUBSTIUTION_NAME> format
1 parent b403d67 commit 17531bf

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

.changeset/brave-lights-run.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22
"create-cloudflare": minor
33
---
44

5-
Add template substitution
5+
Add template string substitution in wrangler config files.
6+
7+
The value `"<WORKER_NAME>"` will be replaced by the project name when wrangler create a config file (in all of the toml, json, and jsonc formats).

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ describe("update wrangler config", () => {
3737
`compatibility_date = "<TBD>"`,
3838
`[[services]]`,
3939
`binding = "SELF_SERVICE"`,
40-
`service = "__WORKER_NAME__"`,
40+
`service = "<WORKER_NAME>"`,
4141
].join("\n");
4242
vi.mocked(readFile).mockReturnValue(toml);
4343

@@ -105,7 +105,7 @@ describe("update wrangler config", () => {
105105
services: [
106106
{
107107
binding: "SELF_SERVICE",
108-
service: "__WORKER_NAME__",
108+
service: "<WORKER_NAME>",
109109
},
110110
],
111111
});

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ import type { C3Context } from "types";
2121
* - enabling observability
2222
* - adding comments with links to documentation for common configuration options
2323
* - substituting placeholders with actual values
24-
* - `__WORKER_NAME__` with the project name
24+
* - `<WORKER_NAME>` with the project name
2525
*
2626
* If both `wrangler.toml` and `wrangler.json`/`wrangler.jsonc` are present, only
2727
* the `wrangler.json`/`wrangler.jsonc` file will be updated.
2828
*/
2929
export const updateWranglerConfig = async (ctx: C3Context) => {
3030
// Placeholders to replace in the wrangler config files
3131
const substitutions: Record<string, string> = {
32-
__WORKER_NAME__: ctx.project.name,
32+
"<WORKER_NAME>": ctx.project.name,
3333
};
3434

3535
if (wranglerJsonExists(ctx)) {

0 commit comments

Comments
 (0)