Skip to content

Commit

Permalink
remove-trpc-v9
Browse files Browse the repository at this point in the history
remove trpc v9
  • Loading branch information
OrJDev authored Nov 17, 2022
2 parents 94055e7 + 6a488fd commit 6cc4579
Show file tree
Hide file tree
Showing 29 changed files with 13 additions and 188 deletions.
4 changes: 4 additions & 0 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,7 @@ The server folder is where you put all of your server side code (anything that w

- /server/trpc - tRPC server side code: routers, context, utils, etc.
- /server/db - `client.ts` = Where the prisma client is being created.

### T3 Relation

I really like the T3 stack, however I prefer using Solid more than React, now that Solid Start is in beta I thought it would be a great idea to integrate some of the t3 features into create-jd-app.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-jd-app",
"version": "1.0.82",
"version": "1.0.83",
"main": "dist/index.js",
"scripts": {
"test": "ts-node -r tsconfig-paths/register src",
Expand Down
24 changes: 1 addition & 23 deletions src/helpers/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,7 @@ import ora from "ora";
import path from "path";
import fs from "fs-extra";
import inquirer from "inquirer";
import {
IInstaller,
IPkg,
ICtx,
IEnv,
IAppCtx,
ITRPCVersion,
IConfig,
} from "~types";
import { IInstaller, IPkg, ICtx, IEnv, IAppCtx, IConfig } from "~types";
import { execFiles } from "~utils/files";
import { execa, formatError, getUserPackageManager } from "~utils/helpers";
import { vercelPackages, vercelEnv } from "~vercel";
Expand Down Expand Up @@ -199,22 +191,8 @@ export async function getCtxWithInstallers(
)} ${chalk.red("script")}`
);
}
let trpcVersion: ITRPCVersion | undefined;
if (pkgs.includes("tRPC")) {
trpcVersion = (
await inquirer.prompt<{
trpcVersion: ITRPCVersion;
}>({
name: "trpcVersion",
message: "Please select a version of tRPC",
type: "list",
choices: ["V10", "V9"],
})
).trpcVersion;
}
return {
...ctx,
installers: pkgs,
trpcVersion,
};
}
5 changes: 1 addition & 4 deletions src/helpers/utils/getIndexPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@ export default Home;
export default getIndexPage;

const getRes = (ctx: ICtx, shouldUsePrisma: boolean, useTRPC: boolean) => {
const res =
ctx.trpcVersion === "V10"
? `trpc.hello.useQuery(() => ({ name: "from tRPC" }));`
: `trpc.createQuery(() => ["example.hello", { name: "from tRPC" }]);`;
const res = `trpc.hello.useQuery(() => ({ name: "from tRPC" }));`;
return shouldUsePrisma
? `\n const [res] = createResource(() =>
fetch("/api/notes").then((res) => res.json())
Expand Down
31 changes: 0 additions & 31 deletions src/installers/Upstash Ratelimit/files/V9.txt

This file was deleted.

2 changes: 1 addition & 1 deletion src/installers/Upstash Ratelimit/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const config: IInstaller = (ctx) => ({
files: [
ctx.installers.includes("tRPC")
? {
path: `${__dirname}/files/${ctx.trpcVersion}.txt`,
path: `${__dirname}/files/trpcUtils.txt`,
to: `${ctx.userDir}/src/server/trpc/utils.ts`,
}
: {
Expand Down
15 changes: 0 additions & 15 deletions src/installers/tRPC/files/utils-V9.txt

This file was deleted.

File renamed without changes.
10 changes: 5 additions & 5 deletions src/installers/tRPC/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ const config: IInstaller = (ctx) => ({
name: "tRPC",
files: [
{
path: `${__dirname}/files/utils-${ctx.trpcVersion}.txt`,
path: `${__dirname}/files/utils.txt`,
to: `${ctx.userDir}/src/utils/trpc.ts`,
},
{
path: `${__dirname}/files/entryClient.txt`,
to: `${ctx.userDir}/src/entry-client.tsx`,
},
{
path: `${ctx.templateDir}/trpc/${ctx.trpcVersion}/server${
path: `${ctx.templateDir}/trpc/inner/server${
ctx.installers.includes("Prisma") ? "-prisma" : ""
}`,
to: `${ctx.userDir}/src/server/trpc`,
Expand All @@ -25,12 +25,12 @@ const config: IInstaller = (ctx) => ({
pkgs: {
// i don't want to use @next because its not an offical trpc package and i need to update it manually every realase
"@trpc/client": {
customVersion: ctx.trpcVersion === "V9" ? "9.27.2" : "10.0.0-rc.2",
customVersion: "10.0.0-rc.2",
},
"@trpc/server": {
customVersion: ctx.trpcVersion === "V9" ? "9.27.2" : "10.0.0-rc.2",
customVersion: "10.0.0-rc.2",
},
"solid-trpc": ctx.trpcVersion === "V9" ? {} : { customVersion: "next" },
"solid-trpc": { customVersion: "next" },
"solid-start-trpc": {},
"@tanstack/solid-query": {},
},
Expand Down
3 changes: 0 additions & 3 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,8 @@ export type IPromiseOrType<T> = Promise<T> | T;

export type ICtxWith<T> = IAppCtx & T;

export type ITRPCVersion = "V10" | "V9";

export type ICtx = ICtxWith<{
installers: string[];
trpcVersion?: ITRPCVersion;
}>;

export type IConfig = {
Expand Down
18 changes: 0 additions & 18 deletions template/trpc/V9/server-prisma/context.ts

This file was deleted.

9 changes: 0 additions & 9 deletions template/trpc/V9/server-prisma/router/_app.ts

This file was deleted.

16 changes: 0 additions & 16 deletions template/trpc/V9/server-prisma/router/example.ts

This file was deleted.

16 changes: 0 additions & 16 deletions template/trpc/V9/server-prisma/router/notes.ts

This file was deleted.

4 changes: 0 additions & 4 deletions template/trpc/V9/server-prisma/utils.ts

This file was deleted.

16 changes: 0 additions & 16 deletions template/trpc/V9/server/context.ts

This file was deleted.

6 changes: 0 additions & 6 deletions template/trpc/V9/server/router/_app.ts

This file was deleted.

16 changes: 0 additions & 16 deletions template/trpc/V9/server/router/example.ts

This file was deleted.

4 changes: 0 additions & 4 deletions template/trpc/V9/server/utils.ts

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 6cc4579

Please sign in to comment.