Command Line Interface

Although spike does have a Javascript API, most people will find it easiest to use through the command line. Here's a quick rundown of the available commands:

🚧

CLI Argument Syntax

Command line arguments can be a little tricky to figure out, so we're using a standard syntax here to denote what's necessary and what's not, and what format the arguments should come in:

  • Any word typed out directly is a necessary part of the command, like spike watch
  • Any word enclosed by angled brackets is necessary, but a word of your choice, like <name>
  • Any word prefixed by two dashes is a "flag argument", like --env
  • Any piece of the arguments enclosed by square brackets is optional, like [--env]
  • For any flag argument with a second flag after it in parens, either can be used, like --env (-e)

We know this is not the most intuitive or easy-to-read thing ever. If you mess up or need more support, the command will help you out if you type it wrong.

New

Command: spike new
Arguments: <name> [--template (-tpl) (-t) <name>] [--overrides (-o) <keyval>]

Creates a new project using the default template. Optionally pass the a template to create the project with, and/or overrides to questions asked by the template so they are not asked via the command line. Overrides accepts a quoted comma-separated key-value list, like 'a: b, c: d'

Watch

Command: spike watch
Arguments: [<path>] [--env (-e) <name>] [--port (-p) <number>]

Compiles your project, watches for changes, and reloads. Optionally pass the path to the project you want to compile (default is the current directory), environment name, and/or port to run the server on.

Compile

Command: spike compile
Arguments: [<path>] [--env (-e) <name>]

Compiles your project once. Optionally pass the path to the project you want to compile (default is the current directory), and/or environment name.

Clean

Command: spike clean
Arguments: [<path>]

Removes the output directory. Optionally pass the path to project you want to remove output for (default is the current directory).

Add Template

Command: spike tpl add
Arguments: <name> <src>

Add a new template to be used with spike. Specify the name of the template, and a source, which is a git clone-able link.

Remove Template

Command: spike tpl remove
Arguments: <name>

Remove an existing template. Specify the name of the template to be removed.

List Templates

Command: spike tpl list

List out all the templates that have been added by name.

Change Default Template

Command: spike tpl default
Arguments: <name>

Make an existing template the default template when creating new projects.

Reset Templates

Command: `spike tpl reset

Removes all existing templates and resets all template-related settings to their defaults.