Content model migration CLI/API

I'm starting a new repo in prismic and would like to know if there is a way for me to create the model from code.

I have worked with contentful before and used contentful-migration-cli.

Is there a similar tool in prismic land?

I would like to get help with this question https://stackoverflow.com/questions/62283917

2 Likes

Hello @fidel,

Welcome to the community!

We have a feature called Themes that allows you to launch a new project and create a new Prismic repository that is automatically filled with your defined Custom Types, is this. what you’re looking for?

Take a look and read more about it here:

Hi @Phil

I think that is part of the feature I’m looking for.
I think this is closer to what I’m trying to find: https://github.com/prismicio/prismic-cli/issues/11

So as I understand it now, I have custom_types folder with JSON files per type.

The only way for me to go from

{"Foo": {"bar": {...}}} --> {"Foo": {"bar": {...}, "baz": {...}}}

Is to copy-paste the JSON and update it on the UI in app.prismic.io

I’m looking to define the custom types with a typescript object and the ability to update them ie add/change fields

prismic update --env=dev // this would read and update any change on custom_types folder to the prismic dev env(not sure if prismic has emvironments)

Hey Fidel,

At the moment this is as you’ve seen, only possible on the Slice Level with Slice Machine projects. The only way to update your full custom type is to copy and paste the JSON like you’ve described.

I would also love to see this made available on the custom type level, so I’ll add another tick to the feature request tracker. Although for the moment this isn’t something that we are working on.

If/When we decide to implement this we’ll update you here and in the GitHub issue you referenced.

Also, yes Prismic has environments :slight_smile:

Thanks.

This is being tracked as an open feature request.

If you have another use-case for this feature, you can 'Flag' this topic to reopen. Please use the :heart: button to show your support for the feature and check out our Feature Request Guidelines.