Development is done on the main branch. We ask contributors to keep commits focused and use Conventional Commits.
Prerequisites:
- Node.js (version 20 or higher)
Repository Setup:
- Clone the repository:
$ git clone git@github.com:TrogonStack/TrogonEventStore-Client-NodeJS.git $ cd TrogonEventStore-Client-NodeJS - Install all necessary dependencies:
yarn install
- Build the project for the first time:
In case of build errors, refresh your setup with:
yarn build
npx lerna clean -y && yarn install
Code Compilation:
- Standard Build:
yarn build
- Continuous Build on Changes:
yarn build:watch
Testing and Linting:
- Run the complete test suite:
yarn test - Perform code style checks:
yarn lint
Tests are written using Jest and require Docker and Docker Compose to be installed. Then run test with:
yarn testTests can be filtered by prepending the test file or folder to the command
$ yarn test connection // all connection tests
$ yarn test ReadAll // only the ReadAll testsTo get debug information when running tests use the test:debug command.
$ yarn test:debug // debug all tests
$ yarn test:debug ReadAll // only the ReadAll testsSpecific Docker images can be specified via the environment variable TROGON_EVENTSTORE_IMAGE.
$ npx cross-env TROGON_EVENTSTORE_IMAGE=ghcr.io/trogonstack/trogoneventstore:ci jestSee Jest documentation for more options.
This project uses the debug module internally to log information about connections, options and GRPC requests.
To see all the internal logs, set the DEBUG environment variable to trogon-eventstore:* when launching your app.
Logs can be further filtered with glob patterns, for example, only connection logs: trogon-eventstore:connection, everything but grpc logs: trogon-eventstore:*,-*:grpc.
You can set a few environment variables that will further change the behavior of the debug logging:
| Name | Purpose |
|---|---|
DEBUG |
Enables/disables specific debugging namespaces. |
DEBUG_COLORS |
Whether or not to use colors in the debug output. |
DEBUG_DEPTH |
Object inspection depth. |
DEBUG_FD |
File descriptor to write debug output to. |
DEBUG_SHOW_HIDDEN |
Shows hidden properties on inspected objects. |
Note: The environment variables beginning with DEBUG_ end up being
converted into an Options object that gets used with %o/%O formatters.
See the Node.js documentation for util.inspect() for the complete list.