Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions docs/.vitepress/config/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ export default defineConfig({
link: '/openapi-ts/configuration/parser',
text: 'Parser',
},
{
link: '/openapi-ts/configuration/vite',
text: 'Vite',
},
],
link: '/openapi-ts/configuration',
text: 'Configuration',
Expand Down
2 changes: 1 addition & 1 deletion docs/openapi-ts/clients/nuxt.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Start by adding `@hey-api/nuxt` to your dependencies.
::: code-group

```sh [npm]
npm install @hey-api/nuxt
npm add @hey-api/nuxt
```

```sh [pnpm]
Expand Down
84 changes: 84 additions & 0 deletions docs/openapi-ts/configuration/vite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
---
title: Vite Plugin
description: Integrate @hey-api/openapi-ts into your Vite build pipeline with the official Vite plugin.
---

# Vite

### About
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

### About (h3) directly under # Vite (h1) skips h2 and is inconsistent with the sibling config pages (input.md, output.md, parser.md), which all jump straight into ## sections after the h1. Consider either promoting this to ## About or dropping the heading and folding the two sentences into the intro paragraph under # Vite.

Suggested change
### About
## About


[Vite](https://vite.dev) is a blazing fast frontend build tool powering the next generation of web applications.

The Vite plugin integrates `@hey-api/openapi-ts` into the Vite build pipeline, running automatically whenever Vite resolves its configuration – no separate script or manual step required.

## Features

- runs automatically as part of your Vite build
- reads your existing [configuration](/openapi-ts/get-started) (or accepts inline config)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This links to /openapi-ts/get-started, but that page covers installation & quickstart, not the configuration file format. Line 61 of this same file already links correctly to /openapi-ts/configuration. Should this point there too?

Suggested change
- reads your existing [configuration](/openapi-ts/get-started) (or accepts inline config)
- reads your existing [configuration](/openapi-ts/configuration) (or accepts inline config)

- works with any Vite-based project

## Installation

You can download `@hey-api/vite-plugin` from npm using your favorite package manager.

::: code-group

```sh [npm]
npm add @hey-api/vite-plugin -D -E
```

```sh [pnpm]
pnpm add @hey-api/vite-plugin -D -E
```

```sh [yarn]
yarn add @hey-api/vite-plugin -D -E
```

```sh [bun]
bun add @hey-api/vite-plugin -D -E
```

:::

## Usage

Add the plugin to your `vite.config.ts`:

::: code-group

```ts [vite.config.ts]
import { heyApiPlugin } from '@hey-api/vite-plugin';
import { defineConfig } from 'vite';

export default defineConfig({
plugins: [heyApiPlugin()],
});
```

:::

The plugin will automatically pick up your [configuration](/openapi-ts/configuration) file. You can also pass options inline using the `config` option:

::: code-group

```ts [vite.config.ts]
import { heyApiPlugin } from '@hey-api/vite-plugin';
import { defineConfig } from 'vite';

export default defineConfig({
plugins: [
heyApiPlugin({
config: {
input: 'hey-api/backend', // sign up at app.heyapi.dev
output: 'src/client',
},
}),
],
});
```

:::

<!--@include: ../../partials/examples.md-->
<!--@include: ../../partials/sponsors.md-->
50 changes: 49 additions & 1 deletion docs/openapi-ts/get-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ You can download `@hey-api/openapi-ts` from npm using your favorite package mana
::: code-group

```sh [npm]
npm install @hey-api/openapi-ts -D -E
npm add @hey-api/openapi-ts -D -E
```

```sh [pnpm]
Expand Down Expand Up @@ -105,6 +105,54 @@ createClient({

:::

### Vite

If you're using [Vite](https://vite.dev), you can integrate `@hey-api/openapi-ts` directly into your build pipeline with `@hey-api/vite-plugin`. Install it alongside the main package:

::: code-group

```sh [npm]
npm add @hey-api/vite-plugin -D -E
```

```sh [pnpm]
pnpm add @hey-api/vite-plugin -D -E
```

```sh [yarn]
yarn add @hey-api/vite-plugin -D -E
```

```sh [bun]
bun add @hey-api/vite-plugin -D -E
```

:::

Then add the plugin to your Vite configuration:

::: code-group

```ts [vite.config.ts]
import { heyApiPlugin } from '@hey-api/vite-plugin';
import { defineConfig } from 'vite';

export default defineConfig({
plugins: [
heyApiPlugin({
config: {
input: 'hey-api/backend', // sign up at app.heyapi.dev
output: 'src/client',
},
}),
],
});
```

:::

See the [Vite](/openapi-ts/configuration/vite) page for full configuration options.

### Configuration

It's a good practice to extract your configuration into a separate file. Learn how to do that and discover available options on the [Configuration](/openapi-ts/configuration) page.
Expand Down
2 changes: 1 addition & 1 deletion docs/openapi-ts/migrating.md
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ If you need to access individual fields, you can do so using the [`.shape`](http

### Bundle `@hey-api/client-*` plugins

In previous releases, you had to install a separate client package to generate a fully working output, e.g., `npm install @hey-api/client-fetch`. This created a few challenges: getting started was slower, upgrading was sometimes painful, and bundling too. Beginning with v0.73.0, all Hey API clients are bundled by default and don't require installing any additional dependencies. You can remove any installed client packages and re-run `@hey-api/openapi-ts`.
In previous releases, you had to install a separate client package to generate a fully working output, e.g., `npm add @hey-api/client-fetch`. This created a few challenges: getting started was slower, upgrading was sometimes painful, and bundling too. Beginning with v0.73.0, all Hey API clients are bundled by default and don't require installing any additional dependencies. You can remove any installed client packages and re-run `@hey-api/openapi-ts`.

```sh
npm uninstall @hey-api/client-fetch
Expand Down
2 changes: 1 addition & 1 deletion docs/openapi-ts/plugins/sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ export default {

### Display

Enabling examples does not produce visible output on its own. Examples are written into the source specification and can be consumed by documentation tools such as [Mintlify](https://kutt.to/6vrYy9) or [Scalar](https://kutt.to/skQUVd). To persist that specification, enable [Source](/openapi-ts/configuration/output#source) generation.
Enabling examples does not produce visible output on its own. Examples are written into the source specification and can be consumed by documentation tools such as [Scalar](https://kutt.to/skQUVd). To persist that specification, enable [Source](/openapi-ts/configuration/output#source) generation.

## API

Expand Down
3 changes: 2 additions & 1 deletion packages/json-schema-ref-parser/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
Install using [npm](https://docs.npmjs.com/about-npm/):

```bash
npm install @hey-api/json-schema-ref-parser
npm add @hey-api/json-schema-ref-parser
pnpm add @hey-api/json-schema-ref-parser
yarn add @hey-api/json-schema-ref-parser
bun add @hey-api/json-schema-ref-parser
```
Expand Down
2 changes: 1 addition & 1 deletion packages/openapi-ts/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -1636,7 +1636,7 @@ export default {

### Bundle `@hey-api/client-*` plugins

In previous releases, you had to install a separate client package to generate a fully working output, e.g. `npm install @hey-api/client-fetch`. This created a few challenges: getting started was slower, upgrading was sometimes painful, and bundling too. Beginning with v0.73.0, all Hey API clients are bundled by default and don't require installing any additional dependencies. You can remove any installed client packages and re-run `@hey-api/openapi-ts`.
In previous releases, you had to install a separate client package to generate a fully working output, e.g. `npm add @hey-api/client-fetch`. This created a few challenges: getting started was slower, upgrading was sometimes painful, and bundling too. Beginning with v0.73.0, all Hey API clients are bundled by default and don't require installing any additional dependencies. You can remove any installed client packages and re-run `@hey-api/openapi-ts`.

```sh
npm uninstall @hey-api/client-fetch
Expand Down
52 changes: 51 additions & 1 deletion packages/openapi-ts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ You can download `@hey-api/openapi-ts` from npm using your favorite package mana
#### npm

```sh
npm install @hey-api/openapi-ts -D -E
npm add @hey-api/openapi-ts -D -E
```

#### pnpm
Expand Down Expand Up @@ -227,6 +227,56 @@ createClient({
});
```

### Vite

If you're using [Vite](https://vite.dev), you can integrate `@hey-api/openapi-ts` directly into your build pipeline with `@hey-api/vite-plugin`. Install it alongside the main package:

#### npm

```sh
npm add @hey-api/vite-plugin -D -E
```

#### pnpm

```sh
pnpm add @hey-api/vite-plugin -D -E
```

#### yarn

```sh
yarn add @hey-api/vite-plugin -D -E
```

#### bun

```sh
bun add @hey-api/vite-plugin -D -E
```

Then add the plugin to your Vite configuration:

#### `vite.config.ts`

```ts
import { heyApiPlugin } from '@hey-api/vite-plugin';
import { defineConfig } from 'vite';

export default defineConfig({
plugins: [
heyApiPlugin({
config: {
input: 'hey-api/backend', // sign up at app.heyapi.dev
output: 'src/client',
},
}),
],
});
```

See the [Vite](https://heyapi.dev/openapi-ts/configuration/vite) page for full configuration options.

## Configuration

`@hey-api/openapi-ts` supports loading configuration from any file inside your project root folder supported by [jiti loader](https://github.com/unjs/c12?tab=readme-ov-file#-features). Below are the most common file formats.
Expand Down
Loading