Command line interface for creating games with the Regal Framework
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.
The Regal CLI automates several tasks related to making and playing Regal games.
Currently, the following commands are available:
Command | Description | Reference |
---|---|---|
bundle [options] |
create a Regal game bundle | Link |
play [options] <file> |
play a standard Regal game bundle from the terminal | Link |
The bundle
command creates a Regal game bundle with regal-bundler.
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.
To see a list of all options, run:
regal bundle --help
The following options are available for the bundle
command:
Option | Description | Bundler Default* |
---|---|---|
-c, --config <dir> |
load configuration from a specific directory | process.cwd() |
-i, --input-file <file> |
the root file of the game to bundle | src/index.ts |
--input-ts [boolean] |
whether the source is TypeScript | true |
-o, --output-file <file> |
game bundle output file | [GAME_NAME].regal.js |
-f, --format <type> |
module format of the bundle: cjs , esm , or umd |
cjs |
-m, --minify [boolean] |
whether the bundle should be minified | false |
*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.
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
The play
command plays a standard Regal game bundle from the terminal.
regal play ./my-game.regal.js
To see a list of all options, run:
regal play --help
The following options are available for the play
command:
Option | Description | Game Default* |
---|---|---|
--debug [boolean] |
load the game bundle in debug mode | false |
--showMinor [boolean] |
whether minor output should be shown | true |
--trackAgentChanges [boolean] |
whether all changes to agent properties should be tracked | false |
--seed <string> |
Optional string used to initialize psuedorandom number generation in each game instance | None |
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.
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