prismic-cli - V4

Introduction

A Node CLI for developing JavaScript apps with Prismic. Includes utilities for Slice Machine and for Prismic Themes.

Dependencies and requirements

Runs on Node.js, and requires npm or yarn for installation.

Installation

Install globally via the command line:

  • npm
  • Yarn
Copy
npm install -global prismic-cli
Copy
yarn add -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.

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 repo 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 --boostrap

Bootstrap a project with Slice Machine from an existing configuration.

prismic sm --sliceName [slice-name]

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.

Create a project from a ZIP file or GitHub repository and a new Prismic repository. Add a [theme-url], a path, or URL to a ZIP file or a GitHub Repository.

--conf [configuration-path]

Path to prismic configuration file. Default: prismic-configuration.js.

--theme-url [theme-url]

Path to a ZIP file or a GitHub repository.

--customTypes [custom-types]

Path to the custom types directory in the project. Default: custom_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]

--oauthaccesstoken [oauth-access-token]

Use this for the prismic login command to add the oauth access token.

Examples

Copy
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?
Not really
Yes, Thanks

Can't find what you're looking for? Get in touch with us on our Community Forum.