Skip to content

Commit 23356b4

Browse files
authored
fix(worker): use worker static assets instead of baked assets (#978)
* fix: use assets instead of baked content * chore: bump the compat date * chore: make sure you're on recent wrangler
1 parent 5aa0148 commit 23356b4

11 files changed

Lines changed: 88 additions & 92 deletions

File tree

.changes/config.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@
4444
"postversion": [
4545
"cargo check",
4646
"node .scripts/sync-scripts-tagname.js ${ release.type }",
47-
"cp create-tauri-app.ps1 worker/scripts",
48-
"cp create-tauri-app.sh worker/scripts"
47+
"cp create-tauri-app.ps1 worker/public/scripts",
48+
"cp create-tauri-app.sh worker/public/scripts"
4949
],
5050
"assets": [
5151
{

pnpm-lock.yaml

Lines changed: 68 additions & 68 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

worker/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
# SPDX-License-Identifier: Apache-2.0
33
# SPDX-License-Identifier: MIT
44

5-
/node_modules
5+
/node_modules
6+
/.wrangler

worker/index.js

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,20 @@
22
// SPDX-License-Identifier: Apache-2.0
33
// SPDX-License-Identifier: MIT
44

5-
import sh from "./scripts/create-tauri-app.sh";
6-
import ps from "./scripts/create-tauri-app.ps1";
7-
import index from "./index.html";
8-
95
export default {
10-
async fetch(request) {
6+
async fetch(request, env) {
117
const { pathname, searchParams } = new URL(request.url);
128

139
if (pathname.startsWith("/sh")) {
14-
return new Response(sh, {
15-
headers: { "Content-Type": "text/plain" },
16-
});
10+
return env.ASSETS.fetch(
11+
new URL("/scripts/create-tauri-app.sh", request.url),
12+
);
1713
}
1814

1915
if (pathname.startsWith("/ps")) {
20-
return new Response(ps, {
21-
headers: { "Content-Type": "text/plain" },
22-
});
16+
return env.ASSETS.fetch(
17+
new URL("/scripts/create-tauri-app.ps1", request.url),
18+
);
2319
}
2420

2521
if (pathname.startsWith("/v")) {
@@ -54,8 +50,6 @@ export default {
5450
});
5551
}
5652

57-
return new Response(index, {
58-
headers: { "Content-Type": "text/html" },
59-
});
53+
return env.ASSETS.fetch(new URL("/index.html", request.url));
6054
},
6155
};

worker/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
"version": "0.0.0",
44
"license": "Apache-2.0 OR MIT",
55
"devDependencies": {
6-
"wrangler": "^4.0.0"
6+
"wrangler": "^4.101.0"
77
}
88
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
README.md
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)