I'm currently migrating a (pretty big) website from gatsby to nextjs using typescript. While this process is taking a few weeks/months I also have to maintain new feature requests on the old platform. Meaning, I need to modify existing slices that are still integrated with gatsby. This means I can not use the new slices and I need to keep the legacy slices until I finish with the next js migration.
My problem is that after updating an existing legacy slice inside a custom type I don't know how to pull the changes in the nextjs project.
I've tried to re-run npx @slicemachine/init@latest but the modified slices do not appear
Do I need to manually change the json structure in the customtypes/article/index.json file?
If I need to manually change the json, how can I regenerate the prismicio-types.d.ts file so that I use the changes in my typescript code?
To address your issue, here are the steps you need to follow:
Manually Update JSON Structure:
Yes, you will need to manually update the JSON structure in your customtypes/article/index.json file to reflect the changes made to your legacy slices.
Regenerate TypeScript Types:
After updating the JSON structure, you can regenerate the TypeScript types using prismic-ts-codegen. Here’s how you can do it:
Ensure you have prismic-ts-codegen and its peer dependencies installed:
This will load your models, convert them to TypeScript types, and save them to a TypeScript file in your project. By default, the output is saved to types.generated.ts.