-
Notifications
You must be signed in to change notification settings - Fork 734
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Turn on
wrangler.json(c)
support by default (#7230)
- Loading branch information
Showing
141 changed files
with
2,933 additions
and
2,646 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
"wrangler": minor | ||
--- | ||
|
||
Turn on `wrangler.json(c)` support by default | ||
|
||
Wrangler now supports both JSON (`wrangler.json`) and TOML (`wrangler.toml`) for it's configuration file. The format of Wrangler's configuration file is exactly the same across both languages, except that the syntax is `JSON` rather than `TOML`. e.g. | ||
|
||
```toml | ||
name = "worker-ts" | ||
main = "src/index.ts" | ||
compatibility_date = "2023-05-04" | ||
``` | ||
|
||
would be interpreted the same as the equivalent JSON | ||
|
||
```json | ||
{ | ||
"name": "worker-ts", | ||
"main": "src/index.ts", | ||
"compatibility_date": "2023-05-04" | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,7 +59,7 @@ describe("types", () => { | |
`📣 Since you have Node.js compatibility mode enabled, you should consider adding Node.js for TypeScript by running "npm i --save-dev @types/[email protected]". Please see the docs for more details: https://developers.cloudflare.com/workers/languages/typescript/#transitive-loading-of-typesnode-overrides-cloudflareworkers-types` | ||
); | ||
expect(output.stdout).toContain( | ||
`Remember to run 'wrangler types --x-include-runtime' again if you change 'compatibility_date' or 'compatibility_flags' in your wrangler.toml.` | ||
`Remember to run 'wrangler types --x-include-runtime' again if you change 'compatibility_date' or 'compatibility_flags' in your wrangler.toml file.` | ||
); | ||
}); | ||
|
||
|
97 changes: 97 additions & 0 deletions
97
packages/wrangler/src/__tests__/__snapshots__/kv.test.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html | ||
|
||
exports[`wrangler > kv namespace > create > wrangler.json > should create a namespace 1`] = ` | ||
"🌀 Creating namespace with title \\"worker-UnitTestNamespace\\" | ||
✨ Success! | ||
Add the following to your configuration file in your kv_namespaces array: | ||
{ | ||
\\"kv_namespaces\\": [ | ||
{ | ||
\\"binding\\": \\"UnitTestNamespace\\", | ||
\\"id\\": \\"some-namespace-id\\" | ||
} | ||
] | ||
}" | ||
`; | ||
|
||
exports[`wrangler > kv namespace > create > wrangler.json > should create a namespace in an environment if configured to do so 1`] = ` | ||
"🌀 Creating namespace with title \\"worker-customEnv-UnitTestNamespace\\" | ||
✨ Success! | ||
Add the following to your configuration file in your kv_namespaces array under [env.customEnv]: | ||
{ | ||
\\"kv_namespaces\\": [ | ||
{ | ||
\\"binding\\": \\"UnitTestNamespace\\", | ||
\\"id\\": \\"some-namespace-id\\" | ||
} | ||
] | ||
}" | ||
`; | ||
|
||
exports[`wrangler > kv namespace > create > wrangler.json > should create a namespace using configured worker name 1`] = ` | ||
"🌀 Creating namespace with title \\"other-worker-UnitTestNamespace\\" | ||
✨ Success! | ||
Add the following to your configuration file in your kv_namespaces array: | ||
{ | ||
\\"kv_namespaces\\": [ | ||
{ | ||
\\"binding\\": \\"UnitTestNamespace\\", | ||
\\"id\\": \\"some-namespace-id\\" | ||
} | ||
] | ||
}" | ||
`; | ||
|
||
exports[`wrangler > kv namespace > create > wrangler.json > should create a preview namespace if configured to do so 1`] = ` | ||
"🌀 Creating namespace with title \\"worker-UnitTestNamespace_preview\\" | ||
✨ Success! | ||
Add the following to your configuration file in your kv_namespaces array: | ||
{ | ||
\\"kv_namespaces\\": [ | ||
{ | ||
\\"binding\\": \\"UnitTestNamespace\\", | ||
\\"preview_id\\": \\"some-namespace-id\\" | ||
} | ||
] | ||
}" | ||
`; | ||
|
||
exports[`wrangler > kv namespace > create > wrangler.toml > should create a namespace 1`] = ` | ||
"🌀 Creating namespace with title \\"worker-UnitTestNamespace\\" | ||
✨ Success! | ||
Add the following to your configuration file in your kv_namespaces array: | ||
[[kv_namespaces]] | ||
binding = \\"UnitTestNamespace\\" | ||
id = \\"some-namespace-id\\" | ||
" | ||
`; | ||
|
||
exports[`wrangler > kv namespace > create > wrangler.toml > should create a namespace in an environment if configured to do so 1`] = ` | ||
"🌀 Creating namespace with title \\"worker-customEnv-UnitTestNamespace\\" | ||
✨ Success! | ||
Add the following to your configuration file in your kv_namespaces array under [env.customEnv]: | ||
[[kv_namespaces]] | ||
binding = \\"UnitTestNamespace\\" | ||
id = \\"some-namespace-id\\" | ||
" | ||
`; | ||
|
||
exports[`wrangler > kv namespace > create > wrangler.toml > should create a namespace using configured worker name 1`] = ` | ||
"🌀 Creating namespace with title \\"other-worker-UnitTestNamespace\\" | ||
✨ Success! | ||
Add the following to your configuration file in your kv_namespaces array: | ||
[[kv_namespaces]] | ||
binding = \\"UnitTestNamespace\\" | ||
id = \\"some-namespace-id\\" | ||
" | ||
`; | ||
|
||
exports[`wrangler > kv namespace > create > wrangler.toml > should create a preview namespace if configured to do so 1`] = ` | ||
"🌀 Creating namespace with title \\"worker-UnitTestNamespace_preview\\" | ||
✨ Success! | ||
Add the following to your configuration file in your kv_namespaces array: | ||
[[kv_namespaces]] | ||
binding = \\"UnitTestNamespace\\" | ||
preview_id = \\"some-namespace-id\\" | ||
" | ||
`; |
93 changes: 93 additions & 0 deletions
93
packages/wrangler/src/__tests__/__snapshots__/queues.test.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html | ||
|
||
exports[`wrangler > queues > create > wrangler.json > should create a queue 1`] = ` | ||
"🌀 Creating queue 'testQueue' | ||
✅ Created queue 'testQueue' | ||
Configure your Worker to send messages to this queue: | ||
{ | ||
\\"queues\\": { | ||
\\"producers\\": [ | ||
{ | ||
\\"queue\\": \\"testQueue\\", | ||
\\"binding\\": \\"testQueue\\" | ||
} | ||
] | ||
} | ||
} | ||
Configure your Worker to consume messages from this queue: | ||
{ | ||
\\"queues\\": { | ||
\\"consumers\\": [ | ||
{ | ||
\\"queue\\": \\"testQueue\\" | ||
} | ||
] | ||
} | ||
}" | ||
`; | ||
|
||
exports[`wrangler > queues > create > wrangler.json > should send queue settings with delivery delay 1`] = ` | ||
"🌀 Creating queue 'testQueue' | ||
✅ Created queue 'testQueue' | ||
Configure your Worker to send messages to this queue: | ||
{ | ||
\\"queues\\": { | ||
\\"producers\\": [ | ||
{ | ||
\\"queue\\": \\"testQueue\\", | ||
\\"binding\\": \\"testQueue\\" | ||
} | ||
] | ||
} | ||
} | ||
Configure your Worker to consume messages from this queue: | ||
{ | ||
\\"queues\\": { | ||
\\"consumers\\": [ | ||
{ | ||
\\"queue\\": \\"testQueue\\" | ||
} | ||
] | ||
} | ||
}" | ||
`; | ||
|
||
exports[`wrangler > queues > create > wrangler.toml > should create a queue 1`] = ` | ||
"🌀 Creating queue 'testQueue' | ||
✅ Created queue 'testQueue' | ||
Configure your Worker to send messages to this queue: | ||
[[queues.producers]] | ||
queue = \\"testQueue\\" | ||
binding = \\"testQueue\\" | ||
Configure your Worker to consume messages from this queue: | ||
[[queues.consumers]] | ||
queue = \\"testQueue\\" | ||
" | ||
`; | ||
|
||
exports[`wrangler > queues > create > wrangler.toml > should send queue settings with delivery delay 1`] = ` | ||
"🌀 Creating queue 'testQueue' | ||
✅ Created queue 'testQueue' | ||
Configure your Worker to send messages to this queue: | ||
[[queues.producers]] | ||
queue = \\"testQueue\\" | ||
binding = \\"testQueue\\" | ||
Configure your Worker to consume messages from this queue: | ||
[[queues.consumers]] | ||
queue = \\"testQueue\\" | ||
" | ||
`; |
Oops, something went wrong.