Skip to content

Commit

Permalink
Fix: prpc vite / packages
Browse files Browse the repository at this point in the history
  • Loading branch information
OrJDev committed Mar 2, 2023
1 parent f3ef91c commit 0d70686
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
5 changes: 5 additions & 0 deletions .changeset/modern-foxes-drum.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"create-jd-app": patch
---

Fix: prpc vite / packages
2 changes: 1 addition & 1 deletion src/helpers/packages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const packages = {
// prisma
"@prisma/client": "^4.10.1",
// prpc
"@prpc/solid": "^0.2.0",
"@prpc/solid": "^0.2.1",
"@adeora/solid-query": "^0.20.0",
// trpc
"@tanstack/solid-query": "^5.0.0-alpha.0",
Expand Down
17 changes: 9 additions & 8 deletions src/helpers/vite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,29 @@ import type { ICtx, IUtil } from "~types";
export const getViteConfig: IUtil = (ctx) => {
const useUno = ctx.installers.includes("UnoCSS");
const usePrisma = ctx.installers.includes("Prisma");
const usePrpc = ctx.installers.includes("pRPC");
const withPrpc = usePrpc ? "prpc(), " : "";
const getPlugins = () => {
if (useUno && ctx.vercel) {
return `[
solid({ ssr: ${ctx.ssr}, adapter: vercel({ edge: false }) }),
UnoCSS(),
]`;
} else if (useUno) {
return `[solid({ ssr: ${ctx.ssr} }), UnoCSS()]`;
return `[${withPrpc}solid({ ssr: ${ctx.ssr} }), UnoCSS()]`;
} else if (ctx.vercel) {
return `[solid({ ssr: ${ctx.ssr}, adapter: vercel({ edge: false }) })]`;
return `[${withPrpc}solid({ ssr: ${ctx.ssr}, adapter: vercel({ edge: false }) })]`;
} else {
return `[solid({ ssr: ${ctx.ssr} })]`;
return `[${withPrpc}solid({ ssr: ${ctx.ssr} })]`;
}
};
const plugins = getPlugins();
return `import solid from "solid-start/vite";${
useUno ? `\nimport UnoCSS from "unocss/vite";` : ""
}
import { defineConfig } from "vite";${
ctx.vercel
? `\nimport vercel from "solid-start-vercel";`
: ""
}
ctx.vercel ? `\nimport vercel from "solid-start-vercel";` : ""
}${usePrpc ? `\nimport prpc from "@prpc/solid";` : ""}
export default defineConfig(() => {
return {
Expand All @@ -44,7 +44,8 @@ export const modifyConfigIfNeeded = async (ctx: ICtx) => {
ctx.vercel ||
ctx.installers.includes("UnoCSS") ||
!ctx.ssr ||
ctx.installers.includes("Prisma")
ctx.installers.includes("Prisma") ||
ctx.installers.includes("pRPC")
) {
await fs.writeFile(
path.join(ctx.userDir, "vite.config.ts"),
Expand Down

0 comments on commit 0d70686

Please sign in to comment.