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

Update custom-type schema from CLI #11

Closed
ryami333 opened this issue Jan 18, 2017 · 19 comments
Closed

Update custom-type schema from CLI #11

ryami333 opened this issue Jan 18, 2017 · 19 comments

Comments

@ryami333
Copy link

Feature Request

Currently, we are able to create an entirely new repository with the prismic theme command, using a custom_types/index.json file as the custom-types schema. In order to source-control your schema there needs to be a workflow to programmatically update an existing schema.

Something along the lines of:

prismic theme --update http://foo.bar

Benefits:

  • Ability to source-control our schema.
  • Ability to update 'dev' or 'staging' repos and immediately push to the 'production' repo once we're satisfied with changes.
@ryami333
Copy link
Author

ryami333 commented Jan 19, 2017

I could possibly do this myself, but I would require some documentation for the available API endpoints, as there is none that currently publicly exist - as far as I can see.

For example, I can deduce from source that there's an /authentication/newrepository endpoint, but I'm pretty sure that its existence is 'tribal' knowledge. Is there an authentication/updaterepository endpoint or something similiar? Who knows?

@arnaudlewis
Copy link
Member

@ryami333 It could be a great feature but we currently don't have any endpoint for this kind of thing. Maybe you could open a pull request with such feature to send an object like :
{
custom-types: {...}
}
And we'll implement the endpoint to update the repository directly. But i cannot give you a release date right now.
If you prefer to wait for it, it will be consider for next release :)

@ryami333
Copy link
Author

ryami333 commented Mar 1, 2017

I had a dig around the source-code, and I'll be honest I can't work out what's going on for the life of me, and I'd be blindly trying to interface with an endpoint that doesn't exist anyway.

Has there been any progress on this? Has it been added to the roadmap? This is really holding us back from using your otherwise-stellar service on any project larger than a simple blog.

@arnaudlewis
Copy link
Member

arnaudlewis commented Mar 1, 2017 via email

@ryami333
Copy link
Author

ryami333 commented Mar 1, 2017

With pleasure @arnaudlewis :)

Before I endeavour on any new project, I spend a fair amount of time architecting the services, build tools, and deployment procedures required. As it currently stands, we cannot use Prismic because there are no procedures which allow us to source-control and deploy changes to custom-types.

Fundamentally, it would appear that Prismic could be equipped to handle this, because custom-types are actually all represented by a single JSON object which we can hand-edit on the page https://foo.prismic.io/masks/bar.json/. All we really require, is a means to download and upload those JSON files, to prevent having to paste in new contents and click save.

What this means for me, is that I can test a new feature which might involve modifications to my custom-types on my 'staging' repo, without affecting my 'production' repo. I need to easily revert when the feature is abandoned, and I need to easily propagate the changes to 'production' when the feature is merged. In an ideal world, I'd even bundle these processes into my CI/CD pipelines.

Practical use aside, in some cases it's important to me that I can represent the schema of my CMS within the source-code of my project, as a means of documentation. I might want to archive the project and spin it up again a few months down the track, in which case I have to 'guess' what my custom-types schema looks like.

Hope this helps!

@arnaudlewis
Copy link
Member

Ok I get it, it's like defining a nosql model on your code and propagate it to your repository.
Your feedback is really interesting but currently nobody asked for this kind of feature yet so it needs to be prioritized. If it's really required to help you grow your business, you should contact Nathan or Renaud or Intercom from your writing room, they could give you more info about specific dev like this.
In the meantime, I keep it in mind for the future :)

@talbet
Copy link

talbet commented Jul 12, 2017

I am researching Prismic for a future project and have a similar use case. I know there is a lot progress on import/export of content, but import/export of custom-types schema would be essential for the dev team I am working with for all the reasons above.

@ryami333
Copy link
Author

Months on, this remains the only reason why I have chosen to stay with Contentful, despite preferring Prismic in most other regards. For reference, I'm going to put these links here:

https://github.com/contentful/contentful-import
https://github.com/contentful/contentful-export

These are the tools that Contentful provide as a means for exporting and importing schema (and/or content), allowing for integration into source-control and CD.

@paulj
Copy link

paulj commented Oct 18, 2019

Is this something that has come under further consideration in the past few years? I’d also like to be able to version control my schema, and am also using it to code generate richer models for interacting with received data. At the moment, we have to copy and paste; but if we could integrate it with scripts, this would make our workflow much smoother.

@cooervo
Copy link

cooervo commented Nov 19, 2019

We also need this feature to integrate prismic into our CI/CD worfklow. It is a deal breaker for us.

@poornerd
Copy link

+1

@pdeka
Copy link

pdeka commented Feb 4, 2020

+1 The absence of this feature is making Prismic untenable.

@mbbillz
Copy link

mbbillz commented Apr 21, 2020

+1 this would make creating new projects 100x easier

@saltman424
Copy link

+1

@pdeka
Copy link

pdeka commented Jun 12, 2020

+1. Why is it that Prismic is spending so much time in slices etc. but not enough it the basic of getting a good architecture going? If you have 50 sites and want to do continuous delivery you are basically screwed.

@arnaudlewis
Copy link
Member

Hey guys,
Keep a close look on the CLI, in the context of slicemachine, and only slicemachine for now, I’m working on interacting between your project and Prismic through the CLI.
In the current dev, I’ll add a command to sync your slices definitions but this command also sync all your custom types locally.

prismicio/slice-machine#8

If you want more, don’t hesitate to submit a PR, but at least you’ll get everything you need to access the custom types from the CLI if you want to do so.

@arnaudlewis
Copy link
Member

An implementation to synchronize the slices coming from prismic to your project.
It includes a piece of code that will download the custom types to write them in a dedicated folder in your project so you have a local versioned copy of it ;)
#48

@arnaudlewis
Copy link
Member

We have also a command prismic sm --create-slice that create a slice remotely in Prismic, if you want to take inspiration from this code.
Happy to help if you need any help or improvement on our side to open new ways no manage your custom types.

@phillysnow
Copy link
Contributor

phillysnow commented Oct 29, 2020

This is something done with the latest beta of the CLI and Slicemachine:
https://www.slicemachine.dev/documentation/slice-builder

Please try it out and let us know what you think :)

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

No branches or pull requests