1.2.0 • Published 4 years ago

regal-cli v1.2.0

Weekly downloads
6
License
MIT
Repository
github
Last release
4 years ago

regal-cli

npm version CircleCI Coverage Status code style: prettier

Command line interface for creating games with the Regal Framework

Installation

In most cases, the Regal CLI should be installed as a global dependency.

npm install -g regal-cli

The CLI peer depends on regal, so you'll have to install it if you haven't already.

npm install -g regal

Confirm that you've installed everything correctly:

regal

The program should display some information and list the available commands.

Usage

The Regal CLI automates several tasks related to making and playing Regal games.

Currently, the following commands are available:

CommandDescriptionReference
bundle [options]create a Regal game bundleLink
play [options] <file>play a standard Regal game bundle from the terminalLink

bundle

The bundle command creates a Regal game bundle with regal-bundler.

Basic Usage

regal bundle

The bundler will attempt to load configuration values from regal.json or package.json. If no values are found, their defaults will be used. For more information, see the bundler documentation.

Options

To see a list of all options, run:

regal bundle --help

The following options are available for the bundle command:

OptionDescriptionBundler Default*
-c, --config <dir>load configuration from a specific directoryprocess.cwd()
-i, --input-file <file>the root file of the game to bundlesrc/index.ts
--input-ts [boolean]whether the source is TypeScripttrue
-o, --output-file <file>game bundle output file[GAME_NAME].regal.js
-f, --format <type>module format of the bundle: cjs, esm, or umdcjs
-m, --minify [boolean]whether the bundle should be minifiedfalse

*The default values will be used if no configuration values can be found in regal.json, package.json, or the CLI. If an option is specified in one of these configuration files, there is no need to specify it in the CLI command. The CLI options override everything else, so they are used to bundle games differently than specified in the configuration file.

Examples

Bundle the game as a minified UMD file:

regal bundle -f umd --minify

Load an alternate configuration from the test directory and save the bundle as ./test/game-test.regal.js:

regal bundle -c ./test -o ./test/game-test.regal.js

play

The play command plays a standard Regal game bundle from the terminal.

Basic Usage

regal play ./my-game.regal.js

Options

To see a list of all options, run:

regal play --help

The following options are available for the play command:

OptionDescriptionGame Default*
--debug [boolean]load the game bundle in debug modefalse
--showMinor [boolean]whether minor output should be showntrue
--trackAgentChanges [boolean]whether all changes to agent properties should be trackedfalse
--seed <string>Optional string used to initialize psuedorandom number generation in each game instanceNone

When one or more options are specified, a new game instance is generated with those game options. For more information, see the Regal Game Library's configuration docs.

*The default values will be used if no option overrides were specified in regal.json, package.json, or the CLI. If an option is specified in one of these configuration files, there is no need to specify it in the CLI command. The CLI options override everything else, so they are used to play games configured differently than they are specified in their configuration files.

Examples

Play a game in debug mode:

regal play ./bundle.regal.js --debug

Play a game that's seeded and doesn't show minor output:

regal play ./bundle.regal.js --showMinor false --seed hello
1.2.0

4 years ago

1.1.0

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago