-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Docs] Add examples for codgen for UI extensions and functions #1955
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just adding my 2 cents, as I got confused while adding codegen to Checkout UI extensions.
Also, took me longer than I like do admit, that I have to use --project
param to generate for different projects. Could be made more clear?
default: shopifyApiProject({ | ||
apiType: ApiType.Storefront, | ||
apiVersion: LATEST_API_VERSION, | ||
documents: ["./extensions/**/*.{js,ts,jsx,tsx}", "./extensions/.server/**/*.{js,ts,jsx,tsx}"], | ||
outputDir: "./extensions/types", | ||
}), | ||
UIExtensions: shopifyApiProject({ | ||
apiType: ApiType.Admin, | ||
apiVersion: LATEST_API_VERSION, | ||
documents: ["./app/**/*.{js,ts,jsx,tsx}", "./app/.server/**/*.{js,ts,jsx,tsx}" ], | ||
outputDir: "./app/types", | ||
}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you have swapped default
and UIExtensions
here.
const config: IGraphQLConfig = { | ||
projects: { | ||
default: shopifyApiProject({ | ||
apiType: ApiType.Storefront, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may be me who is confused, but Function Extensions are these ones, right? If so, should be renamed to "... For Shopify Functions".
I don't think these has access to the Storefront API?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this example is for an app that is using the storefront API and Shopify Functions.
The code 229 to 239 is for Shopify Functions. I can clarify that with a comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put up a PR here to clarify.
WHY are these changes introduced?
Fixes #1081
WHAT is this pull request doing?
This PR adds example documentation for setting up a
.graphqlrc.ts
file for generating types for UI extensions as well as adding autocomplete for Shopify Functions extensions.Type of change
Checklist
pnpm changeset
to create a draft changelog entry (do NOT update theCHANGELOG.md
files manually)