Skip to content

Command Line Interface

James Messinger edited this page Mar 10, 2020 · 8 revisions

CodeEngine

Once installed, you can use the code-engine command to run CodeEngine. Start by running code-engine --help to see the CLI usage information.

> code-engine --help

 ______            __          ______
|   ___|          |  |        |   ___|               __
|  |     _____  __|  | _____  |  |_    __ __  _____ |__| __ __  _____
|  |    |  _  ||  _  ||  __ | |   _|  |  \  ||  _  ||  ||  \  ||  __ |
|  |___ | |_| || |_| ||  __|  |  |___ |     || |_| ||  ||     ||  __|
|______||_____||_____||_____| |______||__\__||___  ||__||__\__||_____|
                                             |_____|
           build tool | code generator | static site builder
                                v0.0.5

Usage: code-engine [options] [generator] [sources...]

options:
  --dev                 Runs for local development instead of production

  -w, --watch           Watch source files and automatically re-runs when changed

  -d, --debug           Enable verbose debug logging

  -q, --quiet           Suppress unnecessary output

  -v, --version         Show the version number

  -h, --help            Show usage information

generator:
  The name or path of the CodeEngine generator to run. Generators are Node packages
  that configure CodeEngine plugins, sources, destinations, etc. Defaults to "./"

sources...
  One or more files, directories, and/or globs to process (eg: README.md *.txt docs/**/*).
  Defaults to all files in the current directory and subdirectories (i.e. **/*)

Generators

The CodeEngine CLI runs a generator, which is a Node package that exports a Generator object. The generator tells CodeEngine which plugins to use, which source(s) to read from, and which destination(s) to write to.

See "Creating a Generator" to learn how to create a generator.

Defaults to Current Directory

If you don't specify a generator when running the CLI, then it will default to the current directory. That is, it will expect the current directory to have a package.json, index.js, or index.ts file. It will run that file and expect it to export a Generator object.

Specifying a Generator

You can specify the generator to run via the CLI. This can be an absolute or relative path, like this:

code-engine path/to/my/generator

Or you can specify the name of an NPM package that is installed in the current directory or globally. This is useful when sharing generators with other people via NPM, or when using someone else's generator that you installed via NPM.

code-engine my-generator
Clone this wiki locally