Files
speckle-server/packages/server/modules/cli
Iain Sproat 444d2ca7dd Structured logging (attempt 2) (#1234)
* Revert "Revert "feat(structured logging): implements structured logging for backend (#1217)" (#1227)"

This reverts commit 63e6581162.

* Use pino-http instead of express pino logger
* Use correct reference to knex and do not instantiate HttpLogger prematurely
* Adds missing dependency for pino to webhook-service
* Do not instantiate middleware when passed to express
* Refactor to move logging into shared
* Copy shared packages into dockerfiles
* Build shared workspace in docker build-stage for fileimport & webhook
2022-12-05 14:49:52 +00:00
..
2022-03-29 16:30:49 +03:00

Using CLI

You can run it like so from the server package's root directory: ./bin/cli

Use the --help argument to get more info about each command.

Example for running migrations: ./bin/cli db migrate latest

Creating new commands

CLI is defined using yargs.We use it to define hierarchical trees of commands which allows for better organization both for command definition and for using the CLI.

All commands are created in the commands directory. Commands should be defined using command modules.

Any top-level modules under commands will be assumed to be command modules. If you want to define a child command for a top-level command, then configure the top-level command to look for further child commands using .commandDir().

Then put those child command modules in a subdirectory that is named after the top level command. So if the top level command is "db", then all of its child commands should be put inside a "db" subfolder.

Example commands dir:

- commands
    - db
        - migrate.js
    - db.js

In this case, db.js is the command module for the top-level db command. And then inside the db folder there's a command module migrate.js for the migrate child command of db.

This results in 2 commands - db and db migrate.