CLI

The Wonderpress CLI is a Node-based commandline interface that is intended to be globally installed on a development machine. In addition to the documentation provided here, more documentation may be found on NPM.

Installation

To install the Wonderpress CLI:

$ npm install @wndrfl/wonderpress-cli -g

Quick Start

After installing the CLI, you can easily bootstrap a new Wonderpress Development Environment like so:

$ mkdir my-project
$ cd my-project
$ wonderpress init

The CLI will then do the following:

  1. Download the Wonderpress Development Environment
  2. Download the WordPress Core (without the wp-content directory)
  3. Walk you through the configuration of a wp-config.php with a wizard-style prompt. This step will also optionally help you create a database for the new installation.
  4. Optionally download and initialize the Wonderpress Theme. This step will also download and initialize Static Kit within the theme directory.
  5. Walk you through the creation of a README.md with a wizard-style prompt

Usage

In general, the CLI “prefers” to be run in the root directory of your Wonderpress Development Environment (which is also the root directory of your WordPress installation). This is because many of the commands it provides require the CLI to navigate the directory structure of the WordPress installation to complete the task.

However, even thought it’s most foolproof to run the CLI from the root directory, the CLI is equipped with a mechanism to attempt to “find” the root directory and run commands from the context of said directory, if you find it more convenient to run commands from a different directory (for example, if you are needing to run a command from your theme’s directory). The Wonderpress CLI does this by looking for the .wonderpressrc file that exists in the root of the Wonderpress Development Environment. If this file exists in the root of the installation, then the CLI will generally be able to work from any subdirectory of the installation by “looking for” the .wonderpressrc file and setting the context of the command to run from the directory that the file is found in.

Note: If your installation doesn’t have a .wonderpressrc file in the root directory, you might notice the CLI has trouble. If that is the case, please add a .wonderpressrc file to the root of your project, with a blank JSON construct inside of it, like so:

{
  // Hi, Wonderpress!
}