Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/akirak/vite-plugin-genql
A Genql GraphQL code generator plugin for Vite
https://github.com/akirak/vite-plugin-genql
Last synced: 7 days ago
JSON representation
A Genql GraphQL code generator plugin for Vite
- Host: GitHub
- URL: https://github.com/akirak/vite-plugin-genql
- Owner: akirak
- License: mit
- Created: 2024-04-01T11:50:39.000Z (7 months ago)
- Default Branch: master
- Last Pushed: 2024-10-29T22:57:19.000Z (8 days ago)
- Last Synced: 2024-10-30T00:48:12.306Z (8 days ago)
- Language: TypeScript
- Homepage:
- Size: 685 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Genql Plugin for Vite
This is a [Genql](https://github.com/remorses/genql) plugin for Vite. It
regenerates client types every time a schema file (`*.graphql`) is updated or
when your project is built for production.## Configuration
Below is an example where the source schema file is `./schema.graphql` and files
are generated into `src/generated` directory:``` typescript
import { defineConfig } from "vite"
import genql from "vite-plugin-genql"export default defineConfig({
plugins: [
genql({
schemaFile: "./schema.graphql",
config: {
output: "src/generated",
}
}),
],
})
```The full options are defined as follows:
``` typescript
export interface Options {
schemaFile: string
events?: {
onBuild?: boolean
onServerStart?: boolean
onFileChange?: boolean
}
config: Omit
}
```By default, the plugin regenerates your types in the following events:
- When the entire project is built (`onBuild`)
- When the schema file is updated (`onFileChange`)The following events are disabled by default:
- When the server starts (`onServerStart`)
You can set extra options for Genql via `config`.