Skip to content

Commit

Permalink
update solid c3 configs to work with new solid-start beta-2
Browse files Browse the repository at this point in the history
  • Loading branch information
dario-piotrowicz committed Jan 3, 2024
1 parent 259b5a6 commit 75aab9f
Showing 1 changed file with 6 additions and 17 deletions.
23 changes: 6 additions & 17 deletions packages/create-cloudflare/src/frameworks/solid/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,20 @@ const generate = async (ctx: PagesGeneratorContext) => {
const configure = async (ctx: PagesGeneratorContext) => {
process.chdir(ctx.project.path);

// Install the pages adapter
const pkg = "solid-start-cloudflare-pages";
await installPackages([pkg], {
dev: true,
startText: "Adding the Cloudflare Pages adapter",
doneText: `${brandColor(`installed`)} ${dim(pkg)}`,
});

// modify the vite config
const viteConfigPath = usesTypescript()
? `./vite.config.ts`
: `./vite.config.js`;
writeFile(viteConfigPath, viteConfig);
updateStatus(
`Adding the Cloudflare Pages adapter to ${blue(viteConfigPath)}`
);
// Note: we should update the vite.config.ts/js file here and set the preset on
// start.server.preset (as described in the solidStart docs: https://start.solidjs.com/api/vite#configuring-your-application)
// but that doesn't seem to work, so for now we just set the PRESET env variable in the build script
// later we should amend this when it's properly handled on solidStart's side
};

const config: FrameworkConfig = {
generate,
configure,
displayName: "Solid",
getPackageScripts: async () => ({
build: (cmd) => `PRESET=cloudflare-pages ${cmd}`,
"pages:dev": `wrangler pages dev ${await compatDateFlag()} --proxy 3000 -- ${npm} run dev`,
"pages:deploy": `${npm} run build && wrangler pages deploy ./dist/public`,
"pages:deploy": `${npm} run build && wrangler pages deploy ./dist`,
}),
};
export default config;

0 comments on commit 75aab9f

Please sign in to comment.