The Whook server CLI

Usage no npm install needed!

<script type="module">
  import whookCli from 'https://cdn.skypack.dev/@whook/cli';



The Whook server CLI

GitHub license NPM version

This is the Whook server CLI tool. Its goal is to allow you to create commands right in your project instead of in external tools. By doing so, it provides you a convenient way to reuse your Whook's project configuration, services and handlers easily in you day to day command line programs.

To create new commands, you simply have to create new files in the src/commands folder of your Whook project and let the autoloader detect it ;).

By setting @whook/cli in the WHOOK_PLUGINS constant, you will benefit of the commands provided by this module:

  // (...)
  // Setup your own whook plugins or avoid whook defaults by leaving it empty
-  $.register(constant('WHOOK_PLUGINS', ['@whook/whook']));
+  $.register(constant('WHOOK_PLUGINS', ['@whook/cli', '@whook/whook']));
  // (...)

See the Whook example server commands for simple examples on creating your own commands in a whook project.

You can also create a new command by running:

npx whook create --type commands


To test the CLI script, go to a project (in this repo @whook/example):

npm run compile
cd ../whook-example

# Debugging compiled commands
node ../whook-cli/bin/whook.js ls

# Debugging source commands
PROJECT_SRC="$PWD/src" NODE_ENV=${NODE_ENV:-development} npm run cli -- babel-node --extensions '.ts,.js' -- ../whook-cli/bin/whook.js ls