Skip to content
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

Bug: Graphql codegen issue in checkout folder #1114

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

krunal-ss
Copy link

Description

  • In the storefront, the GraphQL code generation (codegen) configuration was previously set to look for files only in the src/graphql/ folder.
  • As a result, it excluded files from src/checkout/graphql/*.graphql and worked only for the src/app folder.

Solution

  • The codegen configuration will now also look into the src/checkout/graphql/ folder.
  • It will execute the codegen.yml file and generate/modify the index.ts file in src/checkout/graphql/.
  • Additionally, it will create a schema.graphql.json file.

@krunal-ss krunal-ss requested a review from a team as a code owner February 5, 2025 09:29
Copy link

vercel bot commented Feb 5, 2025

@krunal-ss is attempting to deploy a commit to the Saleor Commerce Team on Vercel.

A member of the Team first needs to authorize it.

@CLAassistant
Copy link

CLAassistant commented Feb 5, 2025

CLA assistant check
All committers have signed the CLA.

package.json Outdated
@@ -3,28 +3,31 @@
"version": "0.1.0",
"private": true,
"type": "module",
"license": "BSD-3-Clause",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please don't remove license from package.json 😄

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed 😅

package.json Outdated
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"predev": "pnpm run generate",
"prebuild": "pnpm run generate",
"lint": "next lint --dir src --fix",
"generate": "graphql-codegen --config .graphqlrc.ts",
"generate": "DOTENV_CONFIG_PATH=.env graphql-codegen -r dotenv/config --config ./src/checkout/codegen.yml && graphql-codegen --config .graphqlrc.ts",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: I would rather see you add additional config entry to existing .graphqlrc.ts instead of creating new config file.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a new config. in .graphqlrc.ts and remove codegen.yml file

package.json Outdated
"prepare": "husky install",
"test": "playwright test"
},
"dependencies": {
"@adyen/adyen-web": "5.53.3",
"@adyen/api-library": "15.0.0-beta",
"@headlessui/react": "1.7.18",
"@hookform/resolvers": "3.10.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: why those new dependencies are needed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove unwanted dependency as I was working with some new functionality.

"src/checkout/graphql/index.ts": {
plugins: [
{
add: {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: why do you need to add this?

// THIS FILE IS GENERATED WITH `pnpm generate`
import "graphql/language/ast"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants