Skip to content

Commit

Permalink
Update docs on how to use the plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
romeovs committed Aug 31, 2023
1 parent 9a903cc commit 6064e76
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,17 @@ Add it as a plugin in `sanity.config.ts` (or .js):

```ts
import {defineConfig} from 'sanity'
import {myPlugin} from 'sanity-plugin-graphiql'
import {graphiql} from 'sanity-plugin-graphiql'

export default defineConfig({
//...
plugins: [myPlugin({})],
plugins: [
graphiql({
version: 'v2023-08-01',
dataset: 'production',
tag: 'default',
}),
],
})
```

Expand All @@ -34,10 +40,9 @@ with default configuration for build & watch scripts.
See [Testing a plugin in Sanity Studio](https://github.com/sanity-io/plugin-kit#testing-a-plugin-in-sanity-studio)
on how to run this plugin with hotreload in the studio.


### Release new version

Run ["CI & Release" workflow](https://github.com/romeovs/sanity-plugin-graphiql/actions/workflows/main.yml).
Make sure to select the main branch and check "Release new version".

Semantic release will only release on configured branches, so it is safe to run release on any branch.
Semantic release will only release on configured branches, so it is safe to run release on any branch.
12 changes: 9 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,21 @@ const GraphiQLTool = lazy(() => import('./component'))
*
* ```ts
* import {defineConfig} from 'sanity'
* import {myPlugin} from 'sanity-plugin-graphiql'
* import {graphiql} from 'sanity-plugin-graphiql'
*
* export default defineConfig({
* // ...
* plugins: [myPlugin()],
* plugins: [
* graphiql({
* version: 'v2023-08-01',
* dataset: 'production',
* tag: 'default',
* }),
* ],
* })
* ```
*/
export const myPlugin = definePlugin<GraphiQLToolConfig>(function (config) {
export const graphiql = definePlugin<GraphiQLToolConfig>(function (config) {
return {
name: 'sanity-plugin-graphiql',
title: 'GraphiQL',
Expand Down

0 comments on commit 6064e76

Please sign in to comment.