Skip to content

Comments

Bug: Graphql codegen issue in checkout folder#1114

Open
krunal-ss wants to merge 4 commits intosaleor:mainfrom
krunal-ss:fix-checkout-graphql-codegen
Open

Bug: Graphql codegen issue in checkout folder#1114
krunal-ss wants to merge 4 commits intosaleor:mainfrom
krunal-ss:fix-checkout-graphql-codegen

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 February 5, 2025 09:29
@vercel
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.

"version": "0.1.0",
"private": true,
"type": "module",
"license": "BSD-3-Clause",
Copy link
Contributor

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
"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
Contributor

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
"@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
Contributor

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.

@krunal-ss krunal-ss requested a review from kzuraw February 5, 2025 12:43
"src/checkout/graphql/index.ts": {
plugins: [
{
add: {
Copy link
Contributor

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