Shopify / shopify-app-js

MIT License
262 stars 101 forks source link

@shopify/api-codegen-preset is not working at all for me #1338

Closed aurelienbobenrieth closed 2 weeks ago

aurelienbobenrieth commented 1 month ago

Issue summary

Before opening this issue, I have:

I've been trying to set up codegen following what is describe here:

First thing, if I do not specify with the --config flag the path of the config file, nothing is found. Even though my file is definitely at te root of my dir and has the proper name.

Then when specifying the config file path I can see that the schemas and documents are loading but then it fails with an exit code 1 without any error logs even though I sepcified the --debug --verbose flags.

On a side note it feels like the syntax of projects etc... written in the doc does not totally match what is expected by import type { CodegenConfig } from "@graphql-codegen/cli";.

Expected behavior

Well it should generate my types.

Actual behavior

It fails ungracefully.

Steps to reproduce the problem

Follow precisely what's given here:

Debug logs

Running lifecycle hook "afterStart" scripts...
[CLI] Loading Schemas
[CLI] Loading Documents
error Command failed with exit code 1.
aurelienbobenrieth commented 1 month ago

It seems that when I only have documents: ["!node_modules"],the codegen works fine.

However when I include documents: ["*.ts", "!node_modules"],it fails.

I need to understand what is causing the failure. However withou any specific error thrown it's really hard to understand.

paulomarg commented 1 month ago

Hi, thanks for raising this. This is a curious one, we haven't had those issues, but maybe it's related to running it on Windows. We'll investigate it!

Just as a bit of extra context, have you tried skipping the helper functions and setting up the full configuration using the preset?

First thing, if I do not specify with the --config flag the path of the config file

You could add the flag to the command in the template. We can do that as well so others don't run into this.

On a side note it feels like the syntax of projects etc... written in the doc does not totally match what is expected by import type { CodegenConfig } from "@graphql-codegen/cli";.

Could you please provide some examples of the errors you're seeing here?

paulomarg commented 4 weeks ago

I've tried running the command on Windows, on Node 20/22, using the latest versions of all packages in a freshly created app, and I didn't get any errors.

I think the problems you're facing are related to graphql-codegen, more so than our preset - especially if you still see the issue without using the helpers.

My suggestion would be to see if:

If the error isn't related to our package, I'd suggest looking for a solution in the graphql-codegen repos, since there won't be much we can do.

Hope this helps!

github-actions[bot] commented 2 weeks ago

We are closing this issue because we did not hear back regarding additional details we needed to resolve this issue. If the issue persists and you are able to provide the missing clarification we need, feel free to respond and reopen this issue.

We appreciate your understanding as we try to manage our number of open issues.