Skip to content

Commit

Permalink
Cloudflare stuff (#1116)
Browse files Browse the repository at this point in the history
* fix cloudflare config

* generate required package.json

* lockfile
  • Loading branch information
Rich Harris authored Apr 18, 2021
1 parent 46092e9 commit b372d61
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 16 deletions.
5 changes: 5 additions & 0 deletions .changeset/brown-bugs-arrive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/adapter-cloudflare-workers': patch
---

Generate required package.json
4 changes: 3 additions & 1 deletion packages/adapter-cloudflare-workers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ module.exports = function () {
entryPoints: ['.svelte/cloudflare-workers/entry.js'],
outfile: `${entrypoint}/index.js`,
bundle: true,
platform: 'node'
platform: 'node' // TODO would be great if we could generate ESM and use type = "javascript"
});

fs.writeFileSync(`${entrypoint}/package.json`, JSON.stringify({ main: 'index.js' }));

utils.log.info('Prerendering static pages...');
await utils.prerender({
dest: bucket
Expand Down
7 changes: 4 additions & 3 deletions packages/create-svelte/templates/default/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
"start": "svelte-kit start"
},
"devDependencies": {
"@sveltejs/adapter-cloudflare-workers": "next",
"@sveltejs/adapter-netlify": "next",
"@sveltejs/adapter-vercel": "next",
"@sveltejs/kit": "next",
"svelte": "^3.29.0",
"svelte-preprocess": "^4.7.0",
"svelte": "^3.37.0",
"svelte-preprocess": "^4.7.1",
"typescript": "^4.2.4",
"vite": "^2.1.0"
"vite": "^2.1.5"
},
"type": "module",
"dependencies": {
Expand Down
9 changes: 6 additions & 3 deletions packages/create-svelte/templates/default/wrangler.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
name = "svelte-kit-demo"
type = "javascript"
account_id = "f60df21486a4f0e5dbd85493882f1d53"
type = "webpack"
account_id = "32a8245cd45a24083dd0acae1d482048"
workers_dev = true
route = ""
zone_id = ""

[site]
bucket = "./.cloudflare/assets"
entry-point = "./.cloudflare/worker"
entry-point = "./.cloudflare/worker"

[build]
upload = { format = "service-worker" }
44 changes: 35 additions & 9 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 comment on commit b372d61

@vercel
Copy link

@vercel vercel bot commented on b372d61 Apr 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.