Skip to content

Instantly share code, notes, and snippets.

View parkerself22's full-sized avatar
๐Ÿ€
#TrustTheProcess

Parker Self parkerself22

๐Ÿ€
#TrustTheProcess
View GitHub Profile
@parkerself22
parkerself22 / ShopQueryPlugin.ts
Last active August 7, 2022 21:30
Quick MVP of graphql-codegen plugin for Shopify hydrogen's useShopQuery
import { ReactShopQueryVisitor } from './visitor.js';
import { oldVisit, PluginFunction, PluginValidateFn, Types } from '@graphql-codegen/plugin-helpers';
import { LoadedFragment, RawClientSideBasePluginConfig } from '@graphql-codegen/visitor-plugin-common';
import { concatAST, FragmentDefinitionNode, GraphQLSchema, Kind } from 'graphql';
import { extname } from 'path';
export const plugin: PluginFunction<RawClientSideBasePluginConfig, Types.ComplexPluginOutput> = (
schema: GraphQLSchema,
documents: Types.DocumentFile[],
config: RawClientSideBasePluginConfig