CLI commands to save and restore Prismic custom types Video
npm install -g prismic-ct-versioning
Go to your repository settings (https://your-repository.prismic.io/settings/apps/
) and check if you have access to the Custom Types API
tab.
If not, request feature activation here https://community.prismic.io/t/feature-activations-graphql-integration-fields-etc/847.
As described here https://prismic.io/docs/technologies/custom-types-api#permanent-token-recommended, generate a new token.
Create a .env file in your working directory with token and repository ID (you can also pass them from command arguments)
PRISMIC_TOKEN=your-api-token
PRISMIC_REPOSITORY=your-repository-id
pctv [command] [--exclude-disabled --ed | --output --o | --token --t | --repository --r]
Get all Prismic custom types from your repository and save them in output
directory.
Get all Prismic custom types from your repository, compare them to your local custom types files and :
- If it exists in your Prismic repository and not in your local files: Delete it from your Prismic repository
- If it doesn't exists in your Prismic repository but in your local files: Add it to your Prismic repository
- If it exists in your Prismic repository and in your local files: Update it in your Prismic repository if
json
schema orstatus
state differs
Exclude disabled custom types from pull
command.
Directory where your Prismic custom types are saved (relative to current directory).
Prismic Custom Types API token (Override .env PRISMIC_TOKEN variable).
Prismic repository ID (Override .env PRISMIC_REPOSITORY variable).
- Error handling
- Warning if content exists that is related to a custom type that will be updated/deleted