Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tRPC v11 #188

Closed
wants to merge 42 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
2ccb93c
fix: typings when using moduleResolution: "bundler"/"node16"
RebeccaStevens Jan 13, 2024
37ce0c6
chore!(deps): update trpc peer deps to v11
KATT Jan 12, 2024
9bec7b2
Merge branch 'main' into fix-types
wobsoriano Jan 13, 2024
8161e72
Merge pull request #138 from RebeccaStevens/fix-types
wobsoriano Jan 13, 2024
d334312
fix links
wobsoriano Jan 13, 2024
bba78b5
chore: bump @trpc/server and @trpc/client to 11.0.0-rc.373
wobsoriano May 18, 2024
e8c91c9
chore: bump all non-major dependencies
wobsoriano May 18, 2024
801e4b6
some updates
wobsoriano Jun 9, 2024
f47736a
chore: Update client types
wobsoriano Aug 10, 2024
208edf0
chore: Remove cjs support
wobsoriano Aug 10, 2024
811f73f
update eslint config
wobsoriano Aug 10, 2024
4ff8653
more clean up
wobsoriano Aug 10, 2024
2b2f192
more clean up
wobsoriano Aug 11, 2024
cad5fa2
chore: add subscription resolver
wobsoriano Aug 11, 2024
296cda4
chore: set existing version
wobsoriano Aug 11, 2024
9b0e558
ci: replace changelogen with bumpp
wobsoriano Aug 11, 2024
ab7edf2
workflow update
wobsoriano Aug 11, 2024
c4c92b0
chore: release v0.11.0-beta.1
wobsoriano Aug 11, 2024
55fd502
chore: release v0.11.0-beta.1
wobsoriano Aug 11, 2024
6965f6d
chore: release v0.11.0-beta.1
wobsoriano Aug 11, 2024
4c7fbb0
chore: release v0.11.0-beta.2
wobsoriano Aug 11, 2024
27486fe
revert version
wobsoriano Aug 11, 2024
716e4ea
chore: release v0.11.0-beta.1
wobsoriano Aug 11, 2024
55a1b9e
revert version
wobsoriano Aug 11, 2024
4f38123
chore: bump version to v0.11.0-beta.1
wobsoriano Aug 11, 2024
847d93e
docs: update readme
wobsoriano Aug 11, 2024
4e22906
chore: remove useLazyQuery
wobsoriano Aug 11, 2024
fb7847c
chore: improve client types
wobsoriano Aug 12, 2024
f618cd2
chore: Update client exports
wobsoriano Aug 12, 2024
a7f647d
chore: add trpc request options type
wobsoriano Aug 12, 2024
2136495
ci: add changesets
wobsoriano Oct 31, 2024
6c3f508
ci: ignore other projects
wobsoriano Oct 31, 2024
8821f20
chore: test workflow for next branch
wobsoriano Oct 31, 2024
56adae1
chore: add changeset
wobsoriano Oct 31, 2024
1212e21
Merge pull request #184 from wobsoriano/test-workflow
wobsoriano Oct 31, 2024
ccb98b2
ci: test next version
wobsoriano Oct 31, 2024
4e02015
chore: add changeset
wobsoriano Oct 31, 2024
41b443f
Version Packages (next)
github-actions[bot] Oct 31, 2024
e5c0623
Merge pull request #186 from wobsoriano/changeset-release/next
wobsoriano Oct 31, 2024
c1101f2
chore: add changeset
wobsoriano Oct 31, 2024
b111605
Version Packages (next)
github-actions[bot] Oct 31, 2024
c316fe5
Merge pull request #187 from wobsoriano/changeset-release/next
wobsoriano Oct 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": ["playground", "docs"]
}
5 changes: 5 additions & 0 deletions .changeset/many-worms-kneel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"trpc-nuxt": patch
---

Initial next version
13 changes: 13 additions & 0 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"mode": "pre",
"tag": "next",
"initialVersions": {
"trpc-nuxt": "0.11.0",
"docs": "0.0.0",
"playground": "0.0.0"
},
"changesets": [
"many-worms-kneel",
"twenty-rabbits-compete"
]
}
5 changes: 5 additions & 0 deletions .changeset/twenty-rabbits-compete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"trpc-nuxt": patch
---

Release next test
36 changes: 29 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,43 @@ name: Release

on:
push:
tags:
- 'v*'
branches:
- main
- next

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
release:
permissions:
contents: write # to create release (changesets/action)
pull-requests: write # to create pull request (changesets/action)
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Checkout Repo
uses: actions/checkout@v4
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0
- uses: pnpm/action-setup@v4
with:
version: 9.12.0

- uses: actions/setup-node@v3
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 16.x
node-version: 20.x
cache: pnpm

- run: npx changelogithub
- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
publish: pnpm release
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
39 changes: 23 additions & 16 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## 0.11.1-next.1

### Patch Changes

- c1101f2: Release next test

## 0.11.1-next.0

### Patch Changes

- 4e02015: Initial next version

## v0.10.15

Expand Down Expand Up @@ -107,7 +118,7 @@

- Add useLazyQuery composable ([93cb442](https://github.com/wobsoriano/trpc-nuxt/commit/93cb442))

### ❤️ Contributors
### ❤️ Contributors

- Wobsoriano ([@wobsoriano](http://github.com/wobsoriano))

Expand All @@ -119,7 +130,7 @@

- Add custom query key option ([f2bcf9b](https://github.com/wobsoriano/trpc-nuxt/commit/f2bcf9b))

### ❤️ Contributors
### ❤️ Contributors

- Wobsoriano ([@wobsoriano](http://github.com/wobsoriano))

Expand All @@ -141,7 +152,7 @@
- **deps:** Bump h3 to 1.8.0 ([3a395a7](https://github.com/wobsoriano/trpc-nuxt/commit/3a395a7))
- Bump local deps ([dc317c2](https://github.com/wobsoriano/trpc-nuxt/commit/dc317c2))

### ❤️ Contributors
### ❤️ Contributors

- Wobsoriano ([@wobsoriano](http://github.com/wobsoriano))

Expand All @@ -157,7 +168,7 @@

- Update Server Side Calls docs ([1c638a8](https://github.com/wobsoriano/trpc-nuxt/commit/1c638a8))

### ❤️ Contributors
### ❤️ Contributors

- Blechlawine <[email protected]>
- Colonel-Sandvich
Expand All @@ -176,46 +187,42 @@

[compare changes](https://github.com/wobsoriano/trpc-nuxt/compare/v0.10.4...v0.10.5)


### 🚀 Enhancements

- Pass input to watched sources if it's a ref ([892d167](https://github.com/wobsoriano/trpc-nuxt/commit/892d167))
- Pass input to watched sources if it's a ref ([892d167](https://github.com/wobsoriano/trpc-nuxt/commit/892d167))

### ❤️ Contributors
### ❤️ Contributors

- Wobsoriano ([@wobsoriano](http://github.com/wobsoriano))

## v0.10.4

[compare changes](https://github.com/wobsoriano/trpc-nuxt/compare/v0.10.3...v0.10.4)


### 🚀 Enhancements

- Add reactive inputs ([054fad9](https://github.com/wobsoriano/trpc-nuxt/commit/054fad9))
- Add reactive inputs ([054fad9](https://github.com/wobsoriano/trpc-nuxt/commit/054fad9))

### 📖 Documentation

- Update local deps ([7683499](https://github.com/wobsoriano/trpc-nuxt/commit/7683499))
- Update local deps ([7683499](https://github.com/wobsoriano/trpc-nuxt/commit/7683499))

### 🏡 Chore

- Remove engines property ([e15a62a](https://github.com/wobsoriano/trpc-nuxt/commit/e15a62a))
- Remove engines property ([e15a62a](https://github.com/wobsoriano/trpc-nuxt/commit/e15a62a))

### ❤️ Contributors
### ❤️ Contributors

- Wobsoriano ([@wobsoriano](http://github.com/wobsoriano))

## v0.10.3

[compare changes](https://github.com/wobsoriano/trpc-nuxt/compare/v0.10.2...v0.10.3)


### 🚀 Enhancements

- Export createH3ApiHandler for h3 apps ([18cd492](https://github.com/wobsoriano/trpc-nuxt/commit/18cd492))
- Export createH3ApiHandler for h3 apps ([18cd492](https://github.com/wobsoriano/trpc-nuxt/commit/18cd492))

### ❤️ Contributors
### ❤️ Contributors

- Wobsoriano ([@wobsoriano](http://github.com/wobsoriano))

11 changes: 4 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
<p align="center">
<figure>
<img src="https://trpc-nuxt.vercel.app/cover.jpg" alt="trpc-nuxt cover image" />
</figure>
</p>

# tRPC-Nuxt

End-to-end typesafe APIs with [tRPC.io](https://trpc.io/) in Nuxt applications.

> [!NOTE]
> You are looking at the branch that supports tRPC v11 which is a work in progress.

<p align="center">
<figure>
<img src="https://i.imgur.com/3AZlBZH.gif" alt="Demo" />
Expand All @@ -29,7 +26,7 @@ For version 3 of this module (tRPC v9, auto-imports, auto handlers), [go here](h

## Acknowledgements

Huge thanks to [Alex / KATT](https://github.com/KATT), the author of [tRPC](https://trpc.io/), for being the first sponsor of this project! 🎉
Huge thanks to [Alex / KATT](https://github.com/KATT), the author of [tRPC](https://trpc.io/), for being the first sponsor of this project! 🎉

## License

Expand Down
1 change: 0 additions & 1 deletion client.d.ts

This file was deleted.

3 changes: 3 additions & 0 deletions client/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"main": "../dist/client/index.js"
}
72 changes: 36 additions & 36 deletions docs/app.config.ts
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
export default defineAppConfig({
docus: {
title: "tRPC Nuxt",
description: "End-to-end typesafe APIs in Nuxt applications.",
image: "https://og-image.vercel.app/tRPC-Nuxt",
alt: "tRPC-Nuxt cover",
url: "https://trpc-nuxt.vercel.app",
debug: false,
socials: {
github: "wobsoriano/trpc-nuxt"
},
cover: {
src: "/cover.jpg",
alt: "tRPC-Nuxt module"
},
header: {
logo: true
},
aside: {
level: 1
},
footer: {
credits: {
icon: "IconDocus",
text: "Powered by Docus",
href: "https://docus.com"
},
iconLinks: [
{
label: "NuxtJS",
href: "https://nuxt.com",
// @ts-expect-error: IDK nuxt
component: "IconNuxtLabs"
}
]
}
}
docus: {
title: 'tRPC Nuxt',
description: 'End-to-end typesafe APIs in Nuxt applications.',
image: 'https://og-image.vercel.app/tRPC-Nuxt',
alt: 'tRPC-Nuxt cover',
url: 'https://trpc-nuxt.vercel.app',
debug: false,
socials: {
github: 'wobsoriano/trpc-nuxt',
},
cover: {
src: '/cover.jpg',
alt: 'tRPC-Nuxt module',
},
header: {
logo: true,
},
aside: {
level: 1,
},
footer: {
credits: {
icon: 'IconDocus',
text: 'Powered by Docus',
href: 'https://docus.com',
},
iconLinks: [
{
label: 'NuxtJS',
href: 'https://nuxt.com',
// @ts-expect-error: IDK nuxt
component: 'IconNuxtLabs',
},
],
},
},
})
14 changes: 7 additions & 7 deletions docs/components/Logo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,16 @@
/>
</svg>
</div>

<ProseStrong>tRPC Nuxt</ProseStrong>
</div>
</template>

<style scoped>
.logo {
display: flex;
align-items: center;
gap: 10px;
font-weight: 800;
}
.logo {
display: flex;
align-items: center;
gap: 10px;
font-weight: 800;
}
</style>
10 changes: 6 additions & 4 deletions docs/content/1.get-started/5.tips/7.mutation.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,21 @@ const { data } = await $client.getTodos.useQuery(undefined);
```vue [components/NewTodo.vue]
<script setup lang="ts">
import { getQueryKey } from 'trpc-nuxt/client'
import type { AppRouter } from '~/server/trpc/routers'

const { $client } = useNuxtApp()
const previousTodos = ref([])

const queryKey = getQueryKey($client.getTodos, undefined)
type RouterOutput = inferRouterOutputs<AppRouter>

const todosKey = getQueryKey($client.getTodos)
// Access to the cached value of useQuery in todos.vue
const { data: todos } = useNuxtData(queryKey)
const { data } = useNuxtData<RouterOutput['getTodos']>(todosKey)

async function addTodo(payload) {
// Store the previously cached value to restore if mutation fails.
previousTodos.value = todos.value

// Optimistically update the todos.
todos.value.push(payload)

Expand All @@ -39,7 +41,7 @@ async function addTodo(payload) {
await refreshNuxtData(queryKey)
} catch {
// Rollback the data if the mutation failed.
todos.value = previousTodos.value
todos.value = previousTodos.value
}
}
</script>
Expand Down
Loading