add superjson to playground

This commit is contained in:
Robert Soriano
2022-10-29 22:33:59 -07:00
parent b61dbd1786
commit 97dfefe6cd
4 changed files with 29 additions and 1 deletions

View File

@@ -9,6 +9,7 @@
"postinstall": "nuxt prepare"
},
"dependencies": {
"superjson": "^1.11.0",
"trpc-nuxt": "workspace:*",
"zod": "^3.19.1"
},

View File

@@ -1,9 +1,12 @@
import { httpBatchLink, loggerLink } from '@trpc/client'
import { createTRPCNuxtProxyClient } from 'trpc-nuxt/client'
import superjson from 'superjson'
import type { AppRouter } from '~~/server/trpc/routers'
export default defineNuxtPlugin(() => {
const client = createTRPCNuxtProxyClient<AppRouter>({
transformer: superjson,
links: [
// adds pretty logs to your console in development and logs errors in production
loggerLink({

View File

@@ -1,7 +1,10 @@
import { initTRPC } from '@trpc/server'
import superjson from 'superjson'
import type { Context } from './context'
const t = initTRPC.context<Context>().create()
const t = initTRPC.context<Context>().create({
transformer: superjson
})
/**
* Create a router

21
pnpm-lock.yaml generated
View File

@@ -38,9 +38,11 @@ importers:
playground:
specifiers:
nuxt: 3.0.0-rc.12
superjson: ^1.11.0
trpc-nuxt: workspace:*
zod: ^3.19.1
dependencies:
superjson: 1.11.0
trpc-nuxt: link:..
zod: 3.19.1
devDependencies:
@@ -1878,6 +1880,13 @@ packages:
/cookie-es/0.5.0:
resolution: {integrity: sha512-RyZrFi6PNpBFbIaQjXDlFIhFVqV42QeKSZX1yQIl6ihImq6vcHNGMtqQ/QzY3RMPuYSkvsRwtnt5M9NeYxKt0g==}
/copy-anything/3.0.2:
resolution: {integrity: sha512-CzATjGXzUQ0EvuvgOCI6A4BGOo2bcVx8B+eC2nF862iv9fopnPQwlrbACakNCHRIJbCSBj+J/9JeDf60k64MkA==}
engines: {node: '>=12.13'}
dependencies:
is-what: 4.1.7
dev: false
/core-util-is/1.0.3:
resolution: {integrity: sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==}
dev: true
@@ -3741,6 +3750,11 @@ packages:
call-bind: 1.0.2
dev: true
/is-what/4.1.7:
resolution: {integrity: sha512-DBVOQNiPKnGMxRMLIYSwERAS5MVY1B7xYiGnpgctsOFvVDz9f9PFXXxMcTOHuoqYp4NK9qFYQaIC1NRRxLMpBQ==}
engines: {node: '>=12.13'}
dev: false
/is-wsl/2.2.0:
resolution: {integrity: sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==}
engines: {node: '>=8'}
@@ -5772,6 +5786,13 @@ packages:
ts-interface-checker: 0.1.13
dev: true
/superjson/1.11.0:
resolution: {integrity: sha512-6PfAg1FKhqkwWvPb2uXhH4MkMttdc17eJ91+Aoz4s1XUEDZFmLfFx/xVA3wgkPxAGy5dpozgGdK6V/n20Wj9yg==}
engines: {node: '>=10'}
dependencies:
copy-anything: 3.0.2
dev: false
/supports-color/5.5.0:
resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==}
engines: {node: '>=4'}