Skip to content

Commit b43e917

Browse files
author
Lubos ​
committed
feat: bundle nuxt client
1 parent 39eee4a commit b43e917

File tree

26 files changed

+86
-545
lines changed

26 files changed

+86
-545
lines changed

docs/openapi-ts/clients/nuxt.md

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ Nuxt client is currently in beta. The interface might change before it becomes s
1313

1414
[Nuxt](https://nuxt.com) is an open source framework that makes web development intuitive and powerful.
1515

16-
::: tip
17-
You might be interested in the [Nuxt module](https://www.npmjs.com/package/@hey-api/nuxt) instead. It offers all the features mentioned in this guide in a more familiar way.
18-
:::
19-
2016
<!-- <button class="buttonLink" @click="(event) => embedProject('hey-api-client-fetch-example')(event)">
2117
Launch demo
2218
</button> -->
@@ -33,24 +29,24 @@ Launch demo
3329

3430
## Installation
3531

36-
Start by adding `@hey-api/client-nuxt` to your dependencies.
32+
Start by adding `@hey-api/nuxt` to your dependencies.
3733

3834
::: code-group
3935

4036
```sh [npm]
41-
npm install @hey-api/client-nuxt
37+
npm install @hey-api/nuxt
4238
```
4339

4440
```sh [pnpm]
45-
pnpm add @hey-api/client-nuxt
41+
pnpm add @hey-api/nuxt
4642
```
4743

4844
```sh [yarn]
49-
yarn add @hey-api/client-nuxt
45+
yarn add @hey-api/nuxt
5046
```
5147

5248
```sh [bun]
53-
bun add @hey-api/client-nuxt
49+
bun add @hey-api/nuxt
5450
```
5551

5652
:::
@@ -76,6 +72,12 @@ npx @hey-api/openapi-ts \
7672

7773
:::
7874

75+
::: tip
76+
77+
If you add `@hey-api/nuxt` to your Nuxt modules, this step is not needed.
78+
79+
:::
80+
7981
## Configuration
8082

8183
The Nuxt client is built as a thin wrapper on top of Nuxt, extending its functionality to work with Hey API. If you're already familiar with Nuxt, configuring your client will feel like working directly with Nuxt.
@@ -135,7 +137,7 @@ With this approach, `client.gen.ts` will call `createClientConfig()` before init
135137
You can also create your own client instance. You can use it to manually send requests or point it to a different domain.
136138

137139
```js
138-
import { createClient } from '@hey-api/client-nuxt';
140+
import { createClient } from './client/client';
139141

140142
const myClient = createClient({
141143
baseURL: 'https://example.com',
@@ -230,22 +232,5 @@ const url = client.buildUrl<FooData>({
230232
console.log(url); // prints '/foo/1?bar=baz'
231233
```
232234

233-
## Bundling
234-
235-
Sometimes, you may not want to declare client packages as a dependency. This scenario is common if you're using Hey API to generate output that is repackaged and published for other consumers under your own brand. For such cases, our clients support bundling through the `client.bundle` configuration option.
236-
237-
```js
238-
export default {
239-
input: 'https://get.heyapi.dev/hey-api/backend',
240-
output: 'src/client',
241-
plugins: [
242-
{
243-
bundle: true, // [!code ++]
244-
name: '@hey-api/client-nuxt',
245-
},
246-
],
247-
};
248-
```
249-
250235
<!--@include: ../../examples.md-->
251236
<!--@include: ../../sponsors.md-->

examples/openapi-ts-nuxt/nuxt.config.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,5 @@ export default defineNuxtConfig({
2727
],
2828
},
2929
},
30-
imports: {
31-
transform: {
32-
// Build was throwing an error.
33-
// see https://github.com/nuxt/nuxt/issues/18823#issuecomment-1419704343
34-
exclude: [/\bclient-nuxt\b/],
35-
},
36-
},
3730
modules: ['@hey-api/nuxt'],
3831
});

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
"@changesets/cli": "2.27.8",
4848
"@config/vite-base": "workspace:*",
4949
"@hey-api/client-custom": "workspace:*",
50-
"@hey-api/client-nuxt": "workspace:*",
5150
"@types/node": "22.10.5",
5251
"@typescript-eslint/eslint-plugin": "8.29.1",
5352
"@vitest/coverage-v8": "3.1.1",

packages/client-nuxt/CHANGELOG.md

Lines changed: 0 additions & 107 deletions
This file was deleted.

packages/client-nuxt/LICENSE.md

Lines changed: 0 additions & 21 deletions
This file was deleted.

packages/client-nuxt/README.md

Lines changed: 0 additions & 102 deletions
This file was deleted.

0 commit comments

Comments
 (0)