Skip to content

Commit fa91ff5

Browse files
C3: update the solidStart logic to work with their latest (beta-2) implementation (#4711)
* C3: update the solidStart logic to work with their latest (beta-2) implementation * remove pages:dev in favour of pages:preview * make prettier ignore c3 template files * skip windows for solid in c3 e2es
1 parent 0123eef commit fa91ff5

File tree

6 files changed

+34
-24
lines changed

6 files changed

+34
-24
lines changed

.changeset/giant-sloths-check.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+
update the solidStart logic to work with their latest (beta-2) implementation

.prettierignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,9 @@ fixtures/**/dist/**
3737

3838
# Miniflare shouldn't be formatted with the root `prettier` version
3939
packages/miniflare
40+
41+
# In the C3 templates, in particular framework templates, we want to be able to
42+
# use any format that the framework authors prefer/use in their own templates,
43+
# so let's ignore all the c3 template files, exlcuding the c3.ts ones
44+
packages/create-cloudflare/templates/**/*.*
45+
!packages/create-cloudflare/templates/**/c3.ts

packages/create-cloudflare/e2e-tests/frameworks.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ describe.concurrent(`E2E: Web frameworks`, () => {
124124
],
125125
testCommitMessage: true,
126126
timeout: LONG_TIMEOUT,
127-
quarantine: true,
127+
unsupportedOSs: ["win32"],
128128
},
129129
svelte: {
130130
expectResponseToContain: "SvelteKit app",

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

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,6 @@ const generate = async (ctx: C3Context) => {
1515
logRaw("");
1616
};
1717

18-
const configure = async (ctx: C3Context) => {
19-
// Install the pages adapter
20-
const pkg = "solid-start-cloudflare-pages";
21-
await installPackages([pkg], {
22-
dev: true,
23-
startText: "Adding the Cloudflare Pages adapter",
24-
doneText: `${brandColor(`installed`)} ${dim(pkg)}`,
25-
});
26-
27-
updateStatus(`Adding the Cloudflare Pages adapter to vite config`);
28-
};
29-
3018
const config: TemplateConfig = {
3119
configVersion: 1,
3220
id: "solid",
@@ -37,12 +25,13 @@ const config: TemplateConfig = {
3725
ts: { path: "./ts" },
3826
},
3927
generate,
40-
configure,
4128
transformPackageJson: async () => ({
4229
scripts: {
43-
"pages:dev": `wrangler pages dev ${await compatDateFlag()} --proxy 3000 -- ${npm} run dev`,
44-
"pages:deploy": `${npm} run build && wrangler pages deploy ./dist/public`,
30+
"pages:preview": `${npm} run build && npx wrangler pages dev dist ${await compatDateFlag()} --compatibility-flag nodejs_compat`,
31+
"pages:deploy": `${npm} run build && wrangler pages deploy ./dist`,
4532
},
4633
}),
34+
devScript: "dev",
35+
compatibilityFlags: ["nodejs_compat"],
4736
};
4837
export default config;
Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
import cloudflare from "solid-start-cloudflare-pages";
2-
import solid from "solid-start/vite";
3-
import { defineConfig } from "vite";
1+
import { defineConfig } from "@solidjs/start/config";
42

53
export default defineConfig({
6-
plugins: [solid({ adapter: cloudflare({}) })],
4+
start: {
5+
server: {
6+
preset: "cloudflare-pages",
7+
rollupConfig: {
8+
external: ["node:async_hooks"]
9+
},
10+
}
11+
}
712
});
Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
import cloudflare from "solid-start-cloudflare-pages";
2-
import solid from "solid-start/vite";
3-
import { defineConfig } from "vite";
1+
import { defineConfig } from "@solidjs/start/config";
42

53
export default defineConfig({
6-
plugins: [solid({ adapter: cloudflare({}) })],
4+
start: {
5+
server: {
6+
preset: "cloudflare-pages",
7+
rollupConfig: {
8+
external: ["node:async_hooks"]
9+
},
10+
}
11+
}
712
});

0 commit comments

Comments
 (0)