|
1 | 1 | <div align="center"> |
2 | | - <img alt="Hey API logo" height="150" src="https://heyapi.dev/assets/.gen/logo-astronaut-300w.png" width="150"> |
3 | | - <h1 align="center"><b>Vite Plugin</b></h1> |
4 | | - <p align="center">🚀 Vite plugin for <code>@hey-api/openapi-ts</code> codegen.</p> |
| 2 | + <img alt="Hey API presents openapi-ts" height="214" src="https://heyapi.dev/assets/.gen/openapi-ts-hero-640w.png" width="438"> |
| 3 | + <h1><b>Vite Plugin</b></h1> |
| 4 | + <p>Vite plugin for <code>@hey-api/openapi-ts</code>.</p> |
5 | 5 | </div> |
6 | 6 |
|
7 | | -## Dashboard |
| 7 | +<p align="center"> |
| 8 | + <a href="https://www.devtrends.dev/trends?c=v1.kZIAzQaO"><img src="https://api.devtrends.dev/badge/npm/%40hey-api%2Fvite-plugin?period=month&style=flat&view=value" alt="DevTrends badge for @hey-api/vite-plugin" /></a> |
| 9 | + <a href="https://www.devtrends.dev/trends?c=v1.kZIAzQaO&v=change"><img src="https://api.devtrends.dev/badge/npm/%40hey-api%2Fvite-plugin?period=year&style=flat&view=change" alt="DevTrends badge for @hey-api/vite-plugin" /></a> |
| 10 | + <a href="https://github.com/hey-api/openapi-ts/actions?query=branch%3Amain"><img src="https://github.com/hey-api/openapi-ts/actions/workflows/ci.yml/badge.svg?event=push&branch=main" alt="CI status" /></a> |
| 11 | + <a href="https://github.com/hey-api/openapi-ts"><img src="https://img.shields.io/github/stars/hey-api/openapi-ts?style=flat&logo=github&label=GitHub&color=54C82D" alt="GitHub stars" /></a> |
| 12 | + <a href="https://github.com/hey-api/openapi-ts/blob/main/LICENSE.md"><img src="https://img.shields.io/github/license/hey-api/openapi-ts" alt="MIT License"></a> |
| 13 | +</p> |
8 | 14 |
|
9 | | -Access your projects and OpenAPI specifications in the [Hey API Platform](https://app.heyapi.dev/). |
| 15 | +<p align="center"> |
| 16 | + <a href="https://heyapi.dev">Manual</a> |
| 17 | + <span> • </span> |
| 18 | + <a href="https://github.com/hey-api/openapi-ts/issues">Issues</a> |
| 19 | + <span> • </span> |
| 20 | + <a href="https://heyapi.dev/openapi-ts/community/contributing">Contribute</a> |
| 21 | +</p> |
| 22 | + |
| 23 | +## About |
| 24 | + |
| 25 | +[Vite](https://vite.dev) is a blazing fast frontend build tool powering the next generation of web applications. |
| 26 | + |
| 27 | +The Vite plugin integrates [`@hey-api/openapi-ts`](https://heyapi.dev/openapi-ts) into the Vite build pipeline, running automatically whenever Vite resolves its configuration – no separate script or manual step required. |
| 28 | + |
| 29 | +Part of the Hey API ecosystem. |
| 30 | + |
| 31 | +## Features |
| 32 | + |
| 33 | +- runs automatically as part of your Vite build |
| 34 | +- reads your existing configuration (or accepts inline config) |
| 35 | +- works with any Vite-based project |
| 36 | +- [sync with Hey API Registry](https://heyapi.dev/openapi-ts/integrations) for spec management |
10 | 37 |
|
11 | 38 | ## Contributing |
12 | 39 |
|
13 | 40 | Want to see your code in products used by millions? |
14 | 41 |
|
15 | 42 | Start with our [Contributing](https://heyapi.dev/openapi-ts/community/contributing) guide and release your first feature. |
16 | 43 |
|
17 | | -## Documentation |
18 | | - |
19 | | -Please visit our [website](https://heyapi.dev) for documentation, guides, migrating, and more. |
20 | | - |
21 | 44 | ## Sponsors |
22 | 45 |
|
23 | | -Help Hey API stay around for the long haul by becoming a [sponsor](https://github.com/sponsors/hey-api). |
| 46 | +Hey API is sponsor-funded. If you rely on Hey API in production, consider becoming a [sponsor](https://github.com/sponsors/hey-api) to accelerate the roadmap. |
24 | 47 |
|
25 | 48 | <h3 align="center">Gold</h3> |
26 | 49 |
|
@@ -125,20 +148,65 @@ Help Hey API stay around for the long haul by becoming a [sponsor](https://githu |
125 | 148 | </tbody> |
126 | 149 | </table> |
127 | 150 |
|
| 151 | +## Installation |
| 152 | + |
| 153 | +You can download `@hey-api/vite-plugin` from npm using your favorite package manager. |
| 154 | + |
| 155 | +#### npm |
| 156 | + |
| 157 | +```sh |
| 158 | +npm add @hey-api/vite-plugin -D -E |
| 159 | +``` |
| 160 | + |
| 161 | +#### pnpm |
| 162 | + |
| 163 | +```sh |
| 164 | +pnpm add @hey-api/vite-plugin -D -E |
| 165 | +``` |
| 166 | + |
| 167 | +#### yarn |
| 168 | + |
| 169 | +```sh |
| 170 | +yarn add @hey-api/vite-plugin -D -E |
| 171 | +``` |
| 172 | + |
| 173 | +#### bun |
| 174 | + |
| 175 | +```sh |
| 176 | +bun add @hey-api/vite-plugin -D -E |
| 177 | +``` |
| 178 | + |
128 | 179 | ## Usage |
129 | 180 |
|
130 | | -Add to `plugins` inside your Vite configuration. |
| 181 | +Add the plugin to your `vite.config.ts`: |
| 182 | + |
| 183 | +```ts |
| 184 | +import { heyApiPlugin } from '@hey-api/vite-plugin'; |
| 185 | +import { defineConfig } from 'vite'; |
| 186 | + |
| 187 | +export default defineConfig({ |
| 188 | + plugins: [heyApiPlugin()], |
| 189 | +}); |
| 190 | +``` |
| 191 | + |
| 192 | +The plugin will automatically pick up your [configuration](https://heyapi.dev/openapi-ts/configuration) file. You can also pass options inline using the `config` option: |
131 | 193 |
|
132 | 194 | ```ts |
133 | 195 | import { heyApiPlugin } from '@hey-api/vite-plugin'; |
| 196 | +import { defineConfig } from 'vite'; |
134 | 197 |
|
135 | 198 | export default defineConfig({ |
136 | 199 | plugins: [ |
137 | 200 | heyApiPlugin({ |
138 | 201 | config: { |
139 | | - // optional configuration instead of using the configuration file |
| 202 | + input: 'hey-api/backend', // sign up at app.heyapi.dev |
| 203 | + output: 'src/client', |
140 | 204 | }, |
141 | 205 | }), |
142 | 206 | ], |
143 | 207 | }); |
144 | 208 | ``` |
| 209 | + |
| 210 | +## License |
| 211 | + |
| 212 | +Released under the [MIT License](https://github.com/hey-api/openapi-ts/blob/main/LICENSE.md). |
0 commit comments