prismic-cli - V4
Introduction
A Node CLI for developing JavaScript apps with Prismic.
Dependencies and requirements
Runs on Node.js, and requires npm
or yarn
for installation.
Installation
Install globally via the command line:
npm install -global prismic-cli
Usage
Basic commands
Prepend the prismic
reserved identifier words before each theme command.
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. |
Slice Machine commands
Prepend the prismic slicemachine
, or prismic sm
reserved identifier words before each Slice Machine command option.
| 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. |
| The name of the slice in the library. |
Common options
These options work with prismic new
, prismic theme
, and prismic sm --setup
.
--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. |
prismic new options
Prepend the prismic theme
reserved identifier words before each theme command option.
--template | Prismic template for the project. |
prismic sm —setup options
--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. |
prismic theme options
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.
| Path to the Prismic configuration file containing your repository’s API endpoint. Default: |
| HTTPS path to a ZIP file or a GitHub repository. |
| Path to the custom types directory in the project. Default: Your project can contain up to 20 types. |
prismic signup and prismic login options
--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] |
| Use this for the prismic login command to add the oauth access token. |
Examples
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