prismicio / prismic-ts-codegen

A Prismic model-to-TypeScript-type generator.
Apache License 2.0
18 stars 6 forks source link

CLI not taking into account Integration Fields Types in config #18

Closed chamois-d-or closed 2 years ago

chamois-d-or commented 2 years ago

First time I do this! I hope this is the way!

Versions

Reproduction

Steps to reproduce

Add an integration fields configuration to prismicCodegen.config and run CLI : npm run prismic-ts-codegen

What is expected?

The CLI takes into account the configuration and creates types for Integration Fields relying on custom config. Here is an example

video: prismicT.IntegrationFields<import("./types").IntegrationFieldExternalVideos>;

What is actually happening?

CLI is only generating a default field type for integration fields

video: prismicT.IntegrationFields

Guess

fieldConfigs that are in the config file are not passed to generateTypes by the CLI, so the configuration is not taken into account. see here: https://github.com/prismicio/prismic-ts-codegen/blob/main/src/cli/index.ts#L106

I hope that helps! thanks

angeloashmore commented 2 years ago

Thanks @chamois-d-or!

You're right; the fields property from the config file was not being passed to generateTypes(). My mistake!

The fix has been published in v0.0.6 and can be installed with the following command:

npm run install --save-dev prismic-ts-codegen@latest