-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Wrangler config updates #18313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Wrangler config updates #18313
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
eca7e28
Add WranglerConfig component
penalosa b2b70f2
Wrangler config
penalosa c3cdd6f
fixup
penalosa d52da17
Convert all existing config
penalosa 2697abb
add docs
penalosa 2fa68de
Merge remote-tracking branch 'origin/production' into penalosa/wrangl…
penalosa 5bb59af
Simple replace
penalosa a490440
replace duplicates
penalosa 69d99bc
-or
penalosa fc6c7db
toml syntax
penalosa 7fe989d
fix indent
penalosa 459ad2c
fix final TOML syntax
penalosa 7dabf49
Merge branch 'production' into penalosa/wrangler-config-component
penalosa ed2602c
Update configuration.mdx
penalosa 9dcf61f
Merge branch 'production' into penalosa/wrangler-config-component
penalosa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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,54 @@ | ||
| --- | ||
| import { parse } from "node-html-parser"; | ||
| import { Code, Tabs, TabItem } from "@astrojs/starlight/components"; | ||
| import TOML from "@iarna/toml"; | ||
| import { parse as jsoncParse } from "jsonc-parser"; | ||
|
|
||
| const slot = await Astro.slots.render("default"); | ||
|
|
||
| const html = parse(slot); | ||
|
|
||
| const copy = html.querySelector("div.copy > button"); | ||
|
|
||
| if (!copy) { | ||
| throw new Error( | ||
| `[WranglerConfig] Unable to find copy button in rendered code block HTML.`, | ||
| ); | ||
| } | ||
|
|
||
| let code = copy.attributes["data-code"]; | ||
|
|
||
| if (!code) { | ||
| throw new Error( | ||
| `[WranglerConfig] Unable to find data-code attribute on copy button.`, | ||
| ); | ||
| } | ||
|
|
||
| code = code.replace(/\u007f/g, "\n"); | ||
|
|
||
| const language = | ||
| html.querySelector("[data-language]")?.attributes["data-language"]; | ||
|
|
||
| if (!language) { | ||
| throw new Error(`[WranglerConfig] Unable to find data-language.`); | ||
| } | ||
|
|
||
| let toml, json; | ||
|
|
||
| if (language === "toml") { | ||
| toml = code; | ||
| json = JSON.stringify(TOML.parse(code), null, 2); | ||
| } else { | ||
| json = code; | ||
| toml = TOML.stringify(jsoncParse(code)); | ||
| } | ||
| --- | ||
|
|
||
| <Tabs syncKey="wranglerConfig"> | ||
| <TabItem label="wrangler.toml" icon="setting"> | ||
| <Code lang="toml" code={toml} /> | ||
| </TabItem> | ||
| <TabItem label="wrangler.json" icon="seti:json"> | ||
| <Code lang="jsonc" code={json} /> | ||
| </TabItem> | ||
| </Tabs> | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -25,13 +25,19 @@ To use Outbound Workers: | |
|
|
||
| Make sure that you have `[email protected]` or later [installed](/workers/wrangler/install-and-update/). | ||
|
|
||
| import { WranglerConfig } from "~/components"; | ||
|
|
||
| <WranglerConfig> | ||
|
|
||
| ```toml | ||
| [[dispatch_namespaces]] | ||
| binding = "dispatcher" | ||
| namespace = "<NAMESPACE_NAME>" | ||
| outbound = {service = "<SERVICE_NAME>", parameters = ["params_object"]} | ||
| ``` | ||
|
|
||
| </WranglerConfig> | ||
|
|
||
| 3. Edit your dynamic dispatch Worker to call the Outbound Worker and declare variables to pass on `dispatcher.get()`. | ||
|
|
||
| ```js | ||
|
|
||
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really nice solution, love it!