Slice Machine & Multi Repo Functionality

Hi Prismic Team.

I first want to say thank you for all of the recent updates to Prismic as well as all the help you all have given my team and I as we've upgraded our site to the latest version of Prismic.

As we look at ways we can utilize all that Prismic has to offer it's obvious that Slice Machine is an immense upgrade to the legacy builder. It's a great tool and we look forward to use it. Unfortunately it seems that we've reached a bit of an impasse in using it due to how it has been built up to this point.

For what it's worth I recognize that this conversation has been had in numerous discussions and while I do not mean to belabor the request or continue to ad nauseam - I would like to garner where the prismic team is at with bringing about multi repo functionality with Slice Machine.

At this moment, after reading everything that I can about the topic, it seems that this is a feature that has been requested, met with agreement by Prismic, and Prismic has expressed a desire for this feature. However whenever I look anywhere prismic related (discussion boards, Prismic Life, etc.), there is almost no mention of progress.

For clarity's sake our team is look for the following functionality (this is an ideal scenario but I think it's best to give the complete picture):

  • Use Slice Machine to create Types and Slices for mulitple repos (let's call them repo A & B) that utilize one codebase.
  • Repo A would have it's own Types & Slices
  • Repo B would have it's own Types & Slices
  • Repo A & B can pull from a "Shared Slices" folder
    • To note, this last bullet point is incredibly idealistic and we could still get by with just the first 3 (no shared folder).

From what we have gathered, the problem seems to be that Slice Machine cannot distinguish from different libraries. Our sm.json (pasted below) will put our created slices into different folders however Custom Types does not nor does Slice Machine when publishing changes. It all gets lumped into the same folder and can be seen by either repo. While being a great product, Slice Machine is rather rigid and seems to be made solely for one kind of project (monorepos).

I would thoroughly appreciate any and all help with the matter and a status update if there's any at all. We thoroughly enjoy the Prismic update and we look forward to continued use. Thank you.

{
"apiEndpoint": "https://OUR_API.prismic.io/api/v2",
"libraries": [
"@/slices/shared-slices",
"@/slices/A-slices",
"@/slices/B-slices"
],
"_latest": "0.6.1",
"localSliceSimulatorURL": "http://localhost:3000/slice-simulator",
"generateTypes": true
}

1 Like

Hey @vincent.nyamu, I think that Slice Machine is meant to be used with one repo. But you can definitely try and set a mono repo configuration if you have proper communication with your team because this involves having access to git, and there can be breaking changes if there are conflicts in the model versions.

I haven't tried this setup myself but I guess you could have two projects, with two Slice Machine instances and create a folder at the root level of your mono repo with a "Shared Slices" directory that you'd reference in both libraries.

1 Like

Incredibly late on this reply but that is a great idea.
It may be feasibile to do just that and then have them pull from both of them.

We're upgrading to v7 so it can be a way for us to test that out