Setup Content Publisher CLI
This guide walks you through setting up Content Publisher CLI (CPUB) command line interface for the first time
The instructions below will guide developers through the commands to install and connect Pantheon Content Publisher to a site.
Before proceeding, please ensure you have a NextJS-ready development environment available:
Skip this step if you already have Node and NPM installed in your dev environment.
To run the Content Publisher CLI, you’ll need Node and NPM.
Download the latest version of Node.JS for your OS:
- Go to https://nodejs.org/en/download/package-manager and follow the instructions there (we recommend running each command individually vs the full command at once).
- Install Node.js - for this field select the latest version with LTS.
- OS - Select the operating system (OS) where you will be installing Node.JS.
- Using - We recommend using NVM, although select the package manager that you are comfortable with.
Now that you have Node and NPM installed, the first step to implementing Pantheon Content Publisher is installing the Content Publisher CLI (cpub). Run the following command to download and install the CLI.
npm add @pantheon-systems/cpub-cli --global
Note that we currently require Node v.18x to install. Please let us know if your team requires a lower Node version ([email protected]).
Setup
To login to the CLI, run:
cpub login
You will need a Google account to login. This command will open a tab in your web browser where you can either select an already logged-in Google account or login to a new one.
Once logged in, you can use all the CLI features. Use the help command to explore capabilities and check exact syntax:
% cpub --help
cpub <cmd>
Commands:
cpub version Prints the version of this CLI
cpub init <project_directory> [options] Sets up project with required files.
cpub token <cmd> [options] Manage tokens for a CPUB project.
cpub config <cmd> [options] Manage configuration for this CLI.
cpub site <cmd> [options] Manage sites for a CPUB project.
cpub document <cmd> [options] Manage documents for a CPUB Project.
cpub import Imports posts from a Drupal JSON API endpoint into CPUB
cpub whoami Print information about yourself.
cpub login Logs you in you to CPUB client.
cpub logout Logs you out you from CPUB client.