Skip to content

Commit a3d5aad

Browse files
fix: C3 experimental template for Solid now uses correct preset (#7343)
1 parent 5e69799 commit a3d5aad

File tree

3 files changed

+14
-52
lines changed

3 files changed

+14
-52
lines changed

.changeset/quick-bananas-refuse.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"create-cloudflare": patch
3+
---
4+
5+
fix: C3 experimental template for Solid now uses correct preset

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

Lines changed: 7 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { logRaw, updateStatus } from "@cloudflare/cli";
22
import { blue, brandColor, dim } from "@cloudflare/cli/colors";
33
import { runFrameworkGenerator } from "frameworks/index";
44
import { mergeObjectProperties, transformFile } from "helpers/codemod";
5+
import { getWorkerdCompatibilityDate } from "helpers/compatDate";
56
import { usesTypescript } from "helpers/files";
67
import { detectPackageManager } from "helpers/packageManagers";
78
import { installPackages } from "helpers/packages";
@@ -30,6 +31,8 @@ const configure = async (ctx: C3Context) => {
3031
usesTypescript(ctx);
3132
const filePath = `app.config.${usesTypescript(ctx) ? "ts" : "js"}`;
3233

34+
const compatDate = await getWorkerdCompatibilityDate();
35+
3336
updateStatus(`Updating configuration in ${blue(filePath)}`);
3437

3538
transformFile(filePath, {
@@ -46,60 +49,14 @@ const configure = async (ctx: C3Context) => {
4649
b.objectProperty(
4750
b.identifier("server"),
4851
b.objectExpression([
49-
// preset: "cloudflare-pages"
52+
// preset: "cloudflare_module"
5053
b.objectProperty(
5154
b.identifier("preset"),
52-
b.stringLiteral("cloudflare-pages"),
53-
),
54-
// output: {
55-
// dir: "{{ rootDir }}/dist",
56-
// publicDir: "{{ output.dir }}/public",
57-
// serverDir: "{{ output.dir }}/worker",
58-
// },
59-
b.objectProperty(
60-
b.identifier("output"),
61-
b.objectExpression([
62-
b.objectProperty(
63-
b.identifier("dir"),
64-
b.stringLiteral("{{ rootDir }}/dist"),
65-
),
66-
b.objectProperty(
67-
b.identifier("publicDir"),
68-
b.stringLiteral("{{ output.dir }}/public"),
69-
),
70-
b.objectProperty(
71-
b.identifier("serverDir"),
72-
b.stringLiteral("{{ output.dir }}/worker"),
73-
),
74-
]),
75-
),
76-
// rollupConfig: {
77-
// external: ["node:async_hooks"],
78-
// },
79-
b.objectProperty(
80-
b.identifier("rollupConfig"),
81-
b.objectExpression([
82-
b.objectProperty(
83-
b.identifier("external"),
84-
b.arrayExpression([b.stringLiteral("node:async_hooks")]),
85-
),
86-
]),
55+
b.stringLiteral("cloudflare_module"),
8756
),
88-
// hooks: {
89-
// // Prevent the Pages preset from writing the _routes.json etc.
90-
// compiled() {},
91-
// },
9257
b.objectProperty(
93-
b.identifier("hooks"),
94-
b.objectExpression([
95-
b.objectMethod(
96-
"method",
97-
b.identifier("compiled"),
98-
[],
99-
b.blockStatement([]),
100-
false,
101-
),
102-
]),
58+
b.identifier("compatibilityDate"),
59+
b.stringLiteral(compatDate),
10360
),
10461
]),
10562
),

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
name = "<TBD>"
33
compatibility_date = "<TBD>"
44
compatibility_flags = ["nodejs_compat"]
5-
main = "./dist/worker/index.js"
6-
assets = { directory = "./dist/public", binding = "ASSETS" }
5+
main = "./.output/server/index.mjs"
6+
assets = { directory = "./.output/public", binding = "ASSETS" }
77

88
# Workers Logs
99
# Docs: https://developers.cloudflare.com/workers/observability/logs/workers-logs/

0 commit comments

Comments
 (0)