mirror of
https://github.com/ArthurDanjou/trpc-nuxt.git
synced 2026-01-21 23:40:38 +01:00
Compare commits
33 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
019bb20e50 | ||
|
|
695ce4c56e | ||
|
|
38649b7023 | ||
|
|
5cfef32baa | ||
|
|
8497289c65 | ||
|
|
224c4b317b | ||
|
|
d5d6780ca8 | ||
|
|
252d0f6692 | ||
|
|
d022710591 | ||
|
|
a926968f13 | ||
|
|
a8eba5ab8d | ||
|
|
5871528d67 | ||
|
|
def9d0b19d | ||
|
|
34f50fc4d6 | ||
|
|
9fe1469eba | ||
|
|
e48d7cd42c | ||
|
|
2b517ad77b | ||
|
|
77ee994e13 | ||
|
|
67a8a2a3ed | ||
|
|
556b5c8e08 | ||
|
|
85154f12d7 | ||
|
|
26ce46e12b | ||
|
|
c2cfd9a214 | ||
|
|
f736545128 | ||
|
|
59a9eb5f95 | ||
|
|
48fc19076f | ||
|
|
6b83e5d4ea | ||
|
|
0358a258d7 | ||
|
|
8e7f33c9d2 | ||
|
|
b8f4af2df3 | ||
|
|
666751678c | ||
|
|
cab89aaa66 | ||
|
|
4c9850fafc |
22
.github/workflows/release.yml
vendored
Normal file
22
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
name: Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 16.x
|
||||||
|
|
||||||
|
- run: npx changelogithub
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
||||||
@@ -15,6 +15,8 @@ End-to-end typesafe APIs with [tRPC.io](https://trpc.io/) in Nuxt applications.
|
|||||||
</figure>
|
</figure>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
**⚠️ Currently works on Node v16 until [this issue](https://github.com/trpc/trpc/issues/2420) gets fixed.**
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -111,7 +113,6 @@ const { data: token } = await useAsyncQuery(['auth.login', { username, password
|
|||||||
headers.value.Authorization = `Bearer ${token}`
|
headers.value.Authorization = `Bearer ${token}`
|
||||||
|
|
||||||
// All client calls will now include the Authorization header.
|
// All client calls will now include the Authorization header.
|
||||||
// For SSR, please follow this link https://github.com/trpc/trpc/discussions/1686
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Options
|
## Options
|
||||||
|
|||||||
32
package.json
32
package.json
@@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name": "trpc-nuxt",
|
"name": "trpc-nuxt",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "0.2.2",
|
"version": "0.2.6",
|
||||||
"packageManager": "pnpm@7.1.1",
|
"packageManager": "pnpm@7.5.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "./dist/module.cjs",
|
"main": "./dist/module.cjs",
|
||||||
"types": "./dist/types.d.ts",
|
"types": "./dist/types.d.ts",
|
||||||
@@ -32,26 +32,27 @@
|
|||||||
"prepare": "nuxi prepare playground"
|
"prepare": "nuxi prepare playground"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nuxt/kit": "^3.0.0-rc.4",
|
"@nuxt/kit": "3.0.0-rc.8",
|
||||||
"@trpc/client": "^9.25.2",
|
"@trpc/client": "^9.27.1",
|
||||||
"@trpc/server": "^9.25.2",
|
"@trpc/server": "^9.27.1",
|
||||||
"@vueuse/core": "^8.6.0",
|
"@vueuse/core": "^9.1.0",
|
||||||
"@vueuse/nuxt": "^8.6.0",
|
"@vueuse/nuxt": "^9.1.0",
|
||||||
"dedent": "^0.7.0",
|
"dedent": "^0.7.0",
|
||||||
"defu": "^6.0.0",
|
"defu": "^6.0.0",
|
||||||
"h3": "^0.7.9",
|
"h3": "^0.7.10",
|
||||||
|
"ohash": "^0.1.5",
|
||||||
"pathe": "^0.3.0",
|
"pathe": "^0.3.0",
|
||||||
"ufo": "^0.8.4"
|
"ufo": "^0.8.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@antfu/eslint-config": "^0.23.1",
|
"@antfu/eslint-config": "^0.23.1",
|
||||||
"@antfu/ni": "^0.16.2",
|
"@antfu/ni": "^0.16.2",
|
||||||
"@nuxt/module-builder": "latest",
|
"@nuxt/module-builder": "^0.1.7",
|
||||||
"bumpp": "^7.1.1",
|
"@types/dedent": "^0.7.0",
|
||||||
|
"bumpp": "^7.2.0",
|
||||||
"eslint": "^8.14.0",
|
"eslint": "^8.14.0",
|
||||||
"nuxt": "3.0.0-rc.4",
|
"nuxt": "3.0.0-rc.8",
|
||||||
"ohash": "^0.1.0",
|
"pnpm": "^7.5.0",
|
||||||
"pnpm": "^7.1.1",
|
|
||||||
"trpc-nuxt": "workspace:*",
|
"trpc-nuxt": "workspace:*",
|
||||||
"zod": "^3.16.0"
|
"zod": "^3.16.0"
|
||||||
},
|
},
|
||||||
@@ -60,5 +61,8 @@
|
|||||||
"rules": {
|
"rules": {
|
||||||
"no-console": "warn"
|
"no-console": "warn"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"volta": {
|
||||||
|
"node": "16.14.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
3097
pnpm-lock.yaml
generated
3097
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -1,2 +1,2 @@
|
|||||||
packages:
|
packages:
|
||||||
- playground/*
|
- playground
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { fileURLToPath } from 'url'
|
import { fileURLToPath } from 'url'
|
||||||
import { join, resolve } from 'pathe'
|
import { join, resolve } from 'pathe'
|
||||||
import { defu } from 'defu'
|
import { defu } from 'defu'
|
||||||
// @ts-expect-error: No types
|
|
||||||
import dedent from 'dedent'
|
import dedent from 'dedent'
|
||||||
|
|
||||||
import { addAutoImport, addPlugin, addServerHandler, addTemplate, defineNuxtModule } from '@nuxt/kit'
|
import { addAutoImport, addPlugin, addServerHandler, addTemplate, defineNuxtModule } from '@nuxt/kit'
|
||||||
|
|||||||
@@ -13,10 +13,13 @@ export default defineNuxtPlugin((nuxtApp) => {
|
|||||||
const client = trpc.createTRPCClient<AppRouter>({
|
const client = trpc.createTRPCClient<AppRouter>({
|
||||||
url: `${config.baseURL}${config.endpoint}`,
|
url: `${config.baseURL}${config.endpoint}`,
|
||||||
headers: () => {
|
headers: () => {
|
||||||
return {
|
if (nuxtApp.ssrContext) {
|
||||||
...unref(otherHeaders),
|
return {
|
||||||
...headers,
|
...unref(otherHeaders),
|
||||||
|
...headers,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return {}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user