From: Ardis Lu Date: Sun, 29 Sep 2024 06:04:35 +0000 (-0700) Subject: Document helper scripts to create wrangler.toml quickly X-Git-Url: https://git.ardis.lu/?a=commitdiff_plain;h=98e8e33eef4e5fdf8abe190eed92297a21ee195b;p=cloudflare-workers Document helper scripts to create wrangler.toml quickly --- diff --git a/README.md b/README.md index 08548f7..e3d926b 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,19 @@ npm i [Customize the fields](https://developers.cloudflare.com/workers/wrangler/configuration/) as required. +You can use this bash script to quickly make a `wrangler.toml` file from the +`wrangler.toml.example` file in each folder: + +```bash +find -name '*.example' | xargs -I {} sh -c 'cp -u "$1" "${1%.*}"' -- {} +``` + +Or using PowerShell: + +```PowerShell +Get-ChildItem -Recurse -Filter '*.example' | Where-Object { -Not (Test-Path "$($_.DirectoryName)\$($_.BaseName)" -PathType Leaf) } | ForEach-Object { Copy-Item -LiteralPath "$($_.FullName)" -Destination "$($_.DirectoryName)\$($_.BaseName)" } +``` + 4. Test that each Cloudflare Worker works: ``` @@ -107,7 +120,8 @@ https://x.y.workers.dev?https://site-with-no-styles.example.com Before (https://www.cs.virginia.edu/~robins/YouAndYourResearch.html): An unstyled page. The body text stretches the entire width of the screen, making it hard to read. -After (https://x.y.workers.dev?https://www.cs.virginia.edu/~robins/YouAndYourResearch.html): +After +(https://x.y.workers.dev?https://www.cs.virginia.edu/~robins/YouAndYourResearch.html): A styled version of the previous page. The body text is centered with a max width of about 700px, making a much easier reading experience. ## buttcoin