
Golemio CLI
Golemio CLI is a collection of executables intended to be used with Golemio projects and modules
Install the CLI
Prerequisites
Install locally (recommended)
$ cd my-project
$ yarn add --dev @golemio/cli
$ npm install --save-dev @golemio/cli
$ yarn golemio
$ npm exec golemio
Install globally
$ yarn global add @golemio/cli
$ npm install -g @golemio/cli
$ golemio
Commands summary
Command | Description |
---|
golemio | Default command (welcome) |
golemio help | View available commands |
golemio migrate-db help | View available migration commands and flags |
golemio migrate-db create <name> | Create new migration scripts (--postgres or --mongo) |
golemio migrate-db up | Execute up migrations (--postgres and/or --mongo) |
golemio migrate-db down | Execute down migrations (--postgres and/or --mongo) |
golemio migrate-db reset | Reset all executed migrations (--postgres and/or --mongo) |
golemio import-db-data help | View available db data import commands and flags |
golemio import-db-data | Import db data (--postgres and/or --mongo) |
golemio rabbitmq help | View available rabbitmq commands and flags |
golemio rabbitmq send --help | View available rabbitmq send flags |
golemio rabbitmq receive --help | View available rabbitmq receive flags |
Environmental variables
Variable | Example | Required |
---|
POSTGRES_CONN | postgres://oict:oict-pass@localhost/oict-test | :white_check_mark: (mdb and idd postgres) |
MONGO_CONN | mongodb://localhost:27017/oict-test | :white_check_mark: (mdb and idd mongo) |
RABBIT_CONN | amqp://rabbit:pass@localhost | :white_check_mark: (rmq) |
POSTGRES_MIGRATIONS_DIR | db/migrations/postgresql (default) | :negative_squared_cross_mark: |
SQL_DUMP_FILES | db/example/*.sql | :white_check_mark: (idd postgres) |
MONGO_DATA_PATHS | db/example/**/mongo_data | :white_check_mark: (idd mongo) |
Development
Prerequisites
Local environment
To set up your local development environment, install project dependencies and create .env file in the root of the project (see .env.template for reference)
$ yarn
$ cp .env.template .env
Now you can run the CLI in development mode, just type
$ ./bin/golemio.js
You don't need to compile the source code as the script automatically registers the ts-node loader in development mode
Unit tests
Unit tests are located at test/unit. You can run them by typing
$ yarn test-unit
Integration tests
Integration tests are located at test/integration. You can run them by typing
$ docker-compose up -d
$ yarn test-integration
License
MIT