2.0.1 • Published 8 months ago

@amplience/dc-demostore-cli v2.0.1

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
8 months ago

@amplience/dc-demostore-cli

Demonstration Command line interface for Amplience Demo Store.

Description

dc-demostore-cli or CLI alias demostore is a command line interface application to manage an installation of the Amplience Demo Store (demostore). It builds on top of the Amplience DC CLI and Amplience Management APIs

Run demostore --help to get a list of available commands.

See v2.0.0 Changes if you already have an existing version of demostore that you wish to update.

Building

This demo appliction was developed and tested with:

  • Node version 18.x
  • NPM version 9.x

To switch to the correct node version it is recommended to have Node Version Manager installed.

nvm install 18
nvm use 18

Installation

Installing the demostore CLI from the NPM package manager can be achieved using the following command:

npm install -g @amplience/dc-demostore-cli

Configuration

demostore requires a demostore environment configuration to run.

Prerequisites

  • Amplience account
  • Details and where to get them from.
    • Hub Name
    • App URL - ( link to your deployed dc-demostore-core app )
    • Client ID / Secret - Sent via support@amplience.com - One Time Secret
    • Hub ID
    • Username & Password for Content Hub (used to map media)

On your first invocation of any demostore command, the CLI will prompt you to create an environment:

dave@po:~ $ demostore env add
✔ env name: hub-name-from-hub-settings-properties
✔ app deployment url: https://your-deployed-dc-demostore-core-url.com
✔ cms client id: amplience-client-id
✔ cms client secret: ***********************
✔ cms hub id: hub-id-from-hub-settings-properties
✔ dam username: foo@baz.com
✔ dam password: *****************
info: [ foo ] configure dc-cli...
info: [ foo ] environment active

You will set these to the values you received from Amplience Support when you created your account.

By default the configuration is saved to a file in the directory <HOME_DIR>/.amplience/, this can be overridden using the --config option.

Options

Option NameTypeDescription
--versionbooleanShow version number
--configstringdefault: "~/.amplience/dc-cli-config.json"Path to JSON config file
--helpbooleanShow help

Command categories

Using a demostore environment

Common Options

The following options are available for all content-type-schema commands.

Option NameTypeDescription
--versionbooleanShow version number
--helpbooleanShow help

Commands

cleanup

Clean a hub.

Options

Option NameTypeDescription
--logRequests, -rbooleanlog http requests/responses
--tempDir, -tstringtemp dir for run files
--matchingSchema, -marrayapply to (types, schemas, items) matching schema id
--include, -iarraytypes to include
--skipConfirmation, -cbooleandon't ask for confirmation
--all, -abooleanclean up all resource types

Valid resource types are contentTypeSchema, contentTypes, contentItems, searchIndexes, extensions, webhooks, and events.

Active properties handling

Content Items containing one of the following active field will go through an additional process:

  • filterActive
  • active

If these properties are true, the cleanup process will:

  • update the delivery key (adding a random string at the end)
  • set the active flag to false
  • publish the content

Examples

Clean a hub

demostore cleanup

Clean content types, schemas, and items without asking for confirmation

demostore cleanup -ci contentTypes -i contentTypeSchema -i contentItems

import

Import data using automation packages found in dc-demostore-automation

When running an import you get provided with the environment variables to configure for your Front End deployment of dc-demostore-core. See specific information in the docs on this project about how to use.

Example output after import where all values marked as XXX will be specific to your account configuration

info: .env.local file format
info: 
----------------------- COPY START ----------------------
NEXT_PUBLIC_DEMOSTORE_CONFIG_JSON='{"url":"XXX","algolia":{"appId":"XXX","apiKey":"XXX"},"cms":{"hub":"XXX","stagingApi":"XXX","imageHub":"XXX"}}'
------------------------ COPY END -----------------------
info: 
info: Vercel format
info: 
----------------------- COPY START ----------------------
{"url":"XXX","algolia":{"appId":"XXX","apiKey":"XXX"},"cms":{"hub":"XXX","stagingApi":"XXX","imageHub":"XXX"}}
------------------------ COPY END -----------------------

Options

Option NameTypeDescription
--logRequests, -rbooleanlog http requests/responses
--tempDir, -tstringtemp dir for run files
--matchingSchema, -marrayapply to (types, schemas, items) matching schema id
--automationDir, -astringpath to import directory
--skipContentImport, -sbooleanskip content import
--latest, -lbooleanusing this flag will download the latest automation
--openaiKey, -ostringoptional openai key for generative rich text automation

Examples

Import the latest automation data

demostore import -l

Import only items matching schema 'schema'

demostore import -m <schema>

publish

Publish all unpublished content items.

Options

Option NameTypeDescription
--logRequests, -rbooleanlog http requests/responses
--tempDir, -tstringtemp dir for run files
--matchingSchema, -marrayapply to (types, schemas, items) matching schema id

Examples

Publish

demostore publish

show

Show the status of a demostore environment.

Examples

demostore show

env

This category includes interactions with environments.

View commands for env

FAQ