From 6064e768fa02b2aa67e01bac35239bf1f5ce2b53 Mon Sep 17 00:00:00 2001 From: Romeo Van Snick Date: Thu, 31 Aug 2023 15:07:20 +0200 Subject: [PATCH] Update docs on how to use the plugin --- README.md | 13 +++++++++---- src/index.ts | 12 +++++++++--- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 8ee6f5e..6fa670a 100644 --- a/README.md +++ b/README.md @@ -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', + }), + ], }) ``` @@ -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. \ No newline at end of file +Semantic release will only release on configured branches, so it is safe to run release on any branch. diff --git a/src/index.ts b/src/index.ts index 9e81810..bc2d2a1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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(function (config) { +export const graphiql = definePlugin(function (config) { return { name: 'sanity-plugin-graphiql', title: 'GraphiQL',