You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[docs] update wrangler.toml example to wrangler@2 (#5187)
* fix: update wrangler.toml example to wrangler@2
Updates the example provided for `wrangler.toml` file for
the `adapter-cloudflare-workers` documentation, to follow
the specs on wrangler@2.
* align README with the error message printed when wrangler.toml is missing
* changeset
Co-authored-by: Rich Harris <[email protected]>
Copy file name to clipboardExpand all lines: packages/adapter-cloudflare-workers/README.md
+19-39
Original file line number
Diff line number
Diff line change
@@ -33,62 +33,42 @@ export default {
33
33
34
34
## Basic Configuration
35
35
36
-
**You will need [Wrangler](https://developers.cloudflare.com/workers/cli-wrangler/install-update) installed on your system**
37
-
38
-
This adapter expects to find a [wrangler.toml](https://developers.cloudflare.com/workers/platform/sites/configuration) file in the project root. It will determine where to write static assets and the worker based on the `site.bucket` and `site.entry-point` settings.
39
-
40
-
Generate this file using `wrangler` from your project directory
41
-
42
-
```sh
43
-
wrangler init --site my-site-name
44
-
```
45
-
46
-
Now you should get some details from Cloudflare. You should get your:
47
-
48
-
1. Account ID
49
-
2. And your Zone-ID (Optional)
50
-
51
-
Get them by visiting your [Cloudflare dashboard](https://dash.cloudflare.com) and click on any domain. There, you can scroll down and on the left, you can see your details under **API**.
52
-
53
-
Then configure your sites build directory and your account-details in the config file:
36
+
This adapter expects to find a [wrangler.toml](https://developers.cloudflare.com/workers/platform/sites/configuration) file in the project root. It should look something like this:
54
37
55
38
```toml
56
-
account_id = 'YOUR ACCOUNT_ID'
57
-
zone_id = 'YOUR ZONE_ID'# optional, if you don't specify this a workers.dev subdomain will be used.
39
+
name = "<your-service-name>"
40
+
account_id = "<your-account-id>"
41
+
42
+
main = "./.cloudflare/worker.js"
43
+
site.bucket = "./.cloudflare/public"
58
44
59
-
type = "javascript"
45
+
build.command = "npm run build"
60
46
61
-
[build]
62
-
# Assume it's already been built. You can make this "npm run build" to ensure a build before publishing
63
-
command = ""
47
+
compatibility_date = "2021-11-12"
48
+
workers_dev = true
49
+
```
64
50
65
-
[build.upload]
66
-
format = "modules"
67
-
main = "./worker.mjs"
51
+
`<your-service-name>` can be anything. `<your-account-id>` can be found by logging into your [Cloudflare dashboard](https://dash.cloudflare.com) and grabbing it from the end of the URL:
68
52
69
-
[site]
70
-
bucket = "./.cloudflare/assets"
71
-
entry-point = "./.cloudflare/worker"
53
+
```
54
+
https://dash.cloudflare.com/<your-account-id>
72
55
```
73
56
74
-
It's recommended that you add the `build` and `workers-site` folders (or whichever other folders you specify) to your `.gitignore`.
57
+
> It's recommended that you add the `.cloudflare` directory (or whichever directories you specified for `main` and `site.bucket`) to your `.gitignore`.
75
58
76
-
Now, log in with wrangler:
59
+
You will need to install [wrangler](https://developers.cloudflare.com/workers/wrangler/get-started/) and log in, if you haven't already:
77
60
78
-
```sh
61
+
```
62
+
npm i -g wrangler
79
63
wrangler login
80
64
```
81
65
82
-
Build your project and publish it:
66
+
Then, you can build your app and deploy it:
83
67
84
68
```sh
85
-
npm run build &&wrangler publish
69
+
wrangler publish
86
70
```
87
71
88
-
**You are done!**
89
-
90
-
More info on configuring a cloudflare worker site can be found [here](https://developers.cloudflare.com/workers/platform/sites/start-from-existing)
91
-
92
72
## Changelog
93
73
94
74
[The Changelog for this package is available on GitHub](https://github.com/sveltejs/kit/blob/master/packages/adapter-cloudflare-workers/CHANGELOG.md).
0 commit comments