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

How to generate the types/generated/ctp.ts file? #3512

Open
jluterek opened this issue May 6, 2024 · 1 comment
Open

How to generate the types/generated/ctp.ts file? #3512

jluterek opened this issue May 6, 2024 · 1 comment

Comments

@jluterek
Copy link

jluterek commented May 6, 2024

Which part of the documentation does it affect and which topic does it refer to?

The typescript starter project leverages the file types/generated/ctp.ts for things like TFetchChannelsQuery. We are trying to follow this example for fetching other commercetools objects, but do not see a script for generating an updated version of this file.

We are looking for guidance on how to update this generated file to include the other query endpoints besides channel.

Describe what needs to be improved

I'd like to see the typescript page - https://docs.commercetools.com/merchant-center-customizations/development/adding-typescript - talk about generating the necessary types from the CTP graphql endpoint.

@CarlosCortizasCT
Copy link
Contributor

Hello James,

Thanks for letting us know about this missing feature in our typescript starter templates!

We would like to work on improving the templates DX by providing a way for developers to autogenerate typescript types based on the different commercetools GraphQL schemas and so, this is actually something we already have in our backlog.

We don’t have an estimated release date yet, but we will let you know as soon as we have something decided about it.

In the meantime, we would suggest to take a look at the setup we have in this repository as a guidance for setting it up in your own projects.
Here are the custom scripts that we use and the codegen.*.yml files are what we use for the configuration (example).

Hope this can help in the meantime.

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

No branches or pull requests

2 participants