Skip to content

Commit f292294

Browse files
authored
feat(create-cloudflare): update experimental remix template to be based on its worker template (#7170)
* feat(create-cloudflare): update experimental remix template to be based on its worker template * add changeset * remove unused imports * fix deploy command * fix entrypoint file path
1 parent a4f5647 commit f292294

File tree

4 files changed

+7
-31
lines changed

4 files changed

+7
-31
lines changed

.changeset/young-lions-type.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"create-cloudflare": minor
3+
---
4+
5+
feat: update experimental remix template to be based on its worker template

packages/create-cloudflare/templates-experimental/remix/c3.ts

+1-26
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import { logRaw } from "@cloudflare/cli";
22
import { brandColor, dim } from "@cloudflare/cli/colors";
3-
import { spinner } from "@cloudflare/cli/interactive";
43
import { runFrameworkGenerator } from "frameworks/index";
5-
import { transformFile } from "helpers/codemod";
64
import { detectPackageManager } from "helpers/packageManagers";
75
import { installPackages } from "helpers/packages";
86
import type { TemplateConfig } from "../../src/templates";
@@ -14,7 +12,7 @@ const generate = async (ctx: C3Context) => {
1412
await runFrameworkGenerator(ctx, [
1513
ctx.project.name,
1614
"--template",
17-
"https://github.com/remix-run/remix/tree/main/templates/cloudflare",
15+
"https://github.com/remix-run/remix/tree/main/templates/cloudflare-workers",
1816
]);
1917

2018
logRaw(""); // newline
@@ -26,27 +24,6 @@ const configure = async () => {
2624
startText: "Updating the Wrangler version",
2725
doneText: `${brandColor(`updated`)} ${dim("wrangler@latest")}`,
2826
});
29-
30-
const typeDefsPath = "load-context.ts";
31-
32-
const s = spinner();
33-
s.start(`Updating \`${typeDefsPath}\``);
34-
35-
// Remove the empty Env declaration from the template to allow the type from
36-
// worker-configuration.d.ts to take over
37-
transformFile(typeDefsPath, {
38-
visitTSInterfaceDeclaration(n) {
39-
if (n.node.id.type === "Identifier" && n.node.id.name !== "Env") {
40-
return this.traverse(n);
41-
}
42-
43-
// Removes the node
44-
n.replace();
45-
return false;
46-
},
47-
});
48-
49-
s.stop(`${brandColor("updated")} \`${dim(typeDefsPath)}\``);
5027
};
5128

5229
const config: TemplateConfig = {
@@ -63,8 +40,6 @@ const config: TemplateConfig = {
6340
configure,
6441
transformPackageJson: async () => ({
6542
scripts: {
66-
build:
67-
"remix vite:build && wrangler pages functions build --outdir build/worker",
6843
deploy: `${npm} run build && wrangler deploy`,
6944
preview: `${npm} run build && wrangler dev`,
7045
"cf-typegen": `wrangler types`,
Original file line numberDiff line numberDiff line change
@@ -1,4 +0,0 @@
1-
_worker.js
2-
_routes.json
3-
_headers
4-
_redirects

packages/create-cloudflare/templates-experimental/remix/templates/wrangler.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#:schema node_modules/wrangler/config-schema.json
22
name = "<TBD>"
33
compatibility_date = "<TBD>"
4-
main = "./build/worker/index.js"
4+
main = "./server.ts"
55
assets = { directory = "./build/client" }
66

77
# Workers Logs

0 commit comments

Comments
 (0)