Skip to content

Latest commit

 

History

History
45 lines (26 loc) · 2.56 KB

README.md

File metadata and controls

45 lines (26 loc) · 2.56 KB

Tooling to Clone Prismic Repositories

This is a project that you should clone and run in an environment where you have PHP 8.4 installed.

It's not fancy, but it seems to work OK.

It's also still WIP…

Things that definitely don't work

Cloning multiple locales hasn't been implemented. I currently have no need for it, so it's unlikely to be implemented unless someone else does it.

Usage

Clone

You know how to do this already right?

Setup Environment

Create a new repository at prismic.io and go through the initial on-boarding until you can set the master locale. Use a master locale that matches the source locale, however, you can override the locale to match the target (blindly) if you are confident that'd be OK. For example, copying from en-us to en-gb or vice versa would be fine. Look at ./config/autoload/repository.global.php for more details.

Copy the ./example.env.dist file to ./.env and fill out the relevant details. You only need to supply read tokens if your repository requires them. Write tokens are mandatory for both source and target, but no writes happen on the source.

If you need to make other configuration changes, create a file called whatever.local.php in ./config/autoload/ and return a regular array with the desired config. *.local.* is git-ignored along with .env.

On your source repo, make sure that any documents you want to be cloned have been published. Un-published docs, or docs published to releases will not be copied.

Run

php bin/run.php

What happens

  • All assets are copied from source to target, not just the ones that are used in your documents. If an error occurs during asset copying, You can re-try safely. You won't end up with duplicated assets.
  • All document type definitions are cloned from source to target along with any shared slices. Again, these are tracked, so can be retried if any errors occur during transfer.
  • All source documents are downloaded at the master ref.
  • Works through source documents one at a time, adjusting image identifiers and sends the data to the target migration release.
  • Once all documents are processed, all internal document links are updated to point at the new equivalent document.

Auto-tagging assets based on alt text or private notes

There's a feature you can enable to automatically tag assets as they are copied. For more details, look at the asset-tags.global.php file