prismic-cli - v4
A Node CLI for developing JavaScript apps with Prismic.
Runs on Node.js, and requires npm
or yarn
for installation.
Install globally via the command line:
- npm
- Yarn
npm install -global prismic-cli
yarn global add prismic-cli
prismic
The reserved identifier word before each CLI command.
prismic list
List all the available project template generators.
prismic signup
Create a new Prismic account.
prismic login
Log in to your Prismic account.
prismic logout
Log out of your Prismic account.
prismic whoami
Shows the email of the current user.
prismic new
Create a project with a new Prismic repository.
prismic theme
Create a project from a ZIP file or a GitHub repository with a new Prismic repository.
Prepend the prismic slicemachine
, or prismic sm
reserved identifier words before each Slice Machine command option.
prismic sm prismic slicemachine
Display all the available command help options for Slice Machine.
prismic sm --setup
Set up a Slice Machine environment in an already existing project. In the root folder of a supported framework (Nuxt.js and Next.js as of January, 2021), it will add dependencies for Slice Machine and the Slice Builder. Then, it creates a repository in Prismic.
prismic sm --add-storybook
Install Storybook at the root of your Slice Machine project. It will configure it automatically to display your local Slices.
prismic sm --develop
Launch the Slice Builder locally. Storybook must already be running.
prismic sm --create-slice
Create a new Slice component in your file system and a corresponding Slice in your Prismic repository.
prismic sm --list
List all the Slices from libraries and the local files.
prismic sm --bootstrap
Bootstrap a project with Slice Machine from an existing configuration.
prismic sm --sliceName [slice-name]
The name of the Slice in the library.
--help
Show the available command options.
--domain [repo-name]
Create a new Prismic repository. For example, your-repo-name creates the URL https://your-repo-name.prismic.io.
--folder [folder-name]
Name a new local project folder. Use it to create a new Prismic repository and select a technology.
--template [template-url]
Install a project from a Prismic template.
--force
Overwrite local files.
--skip-install
Prevent running install command after generating project.
Prepend the prismic theme
reserved identifier words before each theme command option.
--template
Prismic template for the project.
--framework [next||nuxt]
Select any of the supported frameworks (Nuxt.js and Next.js as of January, 2021).
--library
The name of the Slice Library.
Prepend the prismic theme
reserved identifier words before each theme command option.
Creates a project from a ZIP file or GitHub repository. Then uploads the theme’s custom types to a new Prismic repository. Add a [theme-url]
with a path to the hosted ZIP file or GitHub Repository.
--conf [configuration-path]
Path to the Prismic configuration file containing your repository’s API endpoint. Default: prismic-configuration.js
.
This file should include the project’s client configuration, with the API endpoint set to 'https://your-repo-name.cdn.prismic.io/api/v2'
.
When launching the theme, the command will replace any instances of the string your-repo-name
with the name of the newly created repository. However, the theme can also contain a prismic-theme.json
file, which contains a replaceRepositoryName
property (e.g { "replaceRepositoryName": "my-repo-name" }
). This allows you to include a default repository to demo the theme.
--theme-url [theme-url]
HTTPS path to a ZIP file or a GitHub repository.
--customTypes [custom-types]
Path to the custom types directory in the project. Default: custom_types
.
The directory must contain a JSON file for each custom type and an index.json
file listing the custom types.
The index.json
file should contain an array of objects, where each object has the following properties: { "id": "home", "name": "Home", "repeatable": false, "value": "home.json" }
. The value
is the path to the JSON file for the type.
The JSON file for each type should contain the JSON from the Legacy Type Builder.
Your project can contain up to 20 types.
--email [account-email]
The email of the Prismic account.
--password [account-password]
The password of the Prismic account.
--port [port-name]
Port to start the local login server. Default: [5555]
--oauthaccesstoken [oauth-access-token]
Use this for the prismic login command to add the oauth access token.
prismic new
# Create a project with a new prismic repository.
prismic --help
# Show all available help options for the Prismic CLI
prismic signup
# Create a new Prismic account. It'll ask you to add your email and a unique password.
prismic sm --setup
# Setup a nuxt.js or next.js project with Slice Machine.
prismic theme --theme-url https://github.com/prismicio/gatsby-js-sample
# Create a project from a ZIP file with a new prismic repository.
prismic sm --develop
# Run the Slice Builder locally to start creating the content modeling for your Slice machine repository.
prismic sm --add-storybook
# Install Storybook in your Slice Machine project to visualize your Slices and variations locally.
prismic sm --ls
# List all the slices.
prismic sm --create-slice
# Setup a slice
Was this article helpful?
Can't find what you're looking for? Spot an error in the documentation? Get in touch with us on our Community Forum or using the feedback form above.