Console Client

There is console client available which allows you to automate some routine Heretic tasks such as creating or removing new pages.

To use CLI, please run the following command:

npm run cli --

Parameters available:

OptionDescription
--addModule <id> [--navigation]Create a new page (optionally add to navbar)
--removeModule <id>Delete existing page
--addLanguage <id:name>Add new language (example: de-de:Deutsch)
--removeLanguage <id>Delete existing language
--importGeoDataImport geo database (requires MongoDB to be enabled)
--createAdminCreate admin user with access to admin panel (requires MongoDB to be enabled)
--resetPassword <username>Create user or reset existing user's password to "password"

Examples

Add a new page with ID test, route /test and include it into the navbar:

npm run cli -- --addModule test --navigation

Remove a page with ID test (also removes the corresponding entries in the navbar):

npm run cli -- --removeModule test

Add a new language (with ISO code de-de and name Deutsch):

npm run cli -- --addLanguage de-de:Deutsch

Remove an existing language de-de:

npm run cli -- --removeLanguage de-de

Backup

In order to create full backup of your website, please run the following command:

npm run backup

By default, backup archive is saved to backup folder, example: backup/heretic_YYYYMMDD_HHMMDD.zip. You may change this behavior by using options:

npm run backup -- --dir "myBackupDir" --filename "sample.zip"

The directory is relative to Heretic root.

Archive Structure

Heretic backup file is a regular ZIP archive which contains the following directories:

OptionDescription
distCopy of dist directory
dumpDatabase dump created by mongodump utility
etcAll configuration files from etc directory
rootCopy of root directory
srcCopy of src directory
siteCopy of site directory

Restore Backup

In order to restore backup archive, please run the following command:

npm run restore -- --path "path/to/your/backup.zip"

The directory is relative to Heretic root. Your current site will be saved to save_YYYYMMDD_HHMMSS directory, including current database dump. If you don't wish to save current website, you may wish to specify --no-save option:

npm run restore -- --path "path/to/your/backup.zip" --no-save

What happens if you restore your backup archive using this utility:

  • src, dist, site and etc directories of your website are dropped and replaced by the corresponding directories from backup archive
  • All collections from your database are dropped and replaced by collections from backup archive
  • The following files are dropped and replaced in the root folder of your site: webpack.config.js, webpack.utils.js, package.json, package-lock.json

Interactive Console Client

You may wish to use an user-friendly interactive version of console client if you don't want to keep all the parameter names in mind:

npm run cli-interactive