As an open-source project, anyone can contribute to the development of @craftgate/craftgate
. If you decide to do so, please be aware of the guidelines outlined below.
@craftgate/craftgate
is written in TypeScript, which can be considered as a superset of JavaScript, so in order to contribute to the project, some familiarity with type systems and overall JavaScript knowledge is welcome.
This project uses ava as its test runner, which in turn uses yargs-parser to parse command-line arguments.
This dependency enforces an unnecessary Node.js version limitation which can be limiting for some people. In the future we might consider switching to a different test runner if this turns into an unmanageable issue.
- Node.js v10+
The project has a straightforward folder structure; the source files are located under the src/, sample integrations are located under samples/, and tests are located under test/. Any build or test/coverage artifacts are placed under untracked folder such as:
dist/
: Build artifacts.nyc_output
andcoverage
: Coverage results
As outlined in the README, the bulk of the project is split into the following categories:
- Adapters: Located under the src/adapter folder, these are classes that are responsible for managing a certain domain
- Libraries and Utilities: Located under src/lib, these are utility functions and libraries that can be used project-wide
- Enumerations and Domain Objects: Located under src/model, these are enumerations, constants and domain object models that can be used by request and response classes
- Requests: Located under src/request, these are type definitions for request formats. Note that these are only
type
definitions, so they don't enforce or validate any request data, and only serve as type hints - Response: Located under src/response, these are type definitions for response formats. Note that these are only
type
definitions, so they don't enforce or validate any response data, and only serve as type hints - Module Globals: Located under src/, these files define global classes for the project, as well as the export the root module for Common-JS compatibility
This project contains an ESLint configuration that includes recommended settings for both JavaScript and TypeScript, arbitrary prettier
settings that are built on JavaScript conventions, as well some import ordering rules. Before opening up a PR, please run the following command to check the code for errors:
$ npm run lint:check
While this command only lists any errors and warnings that are encountered, you can also try to fix them automatically, which will probably work most of the time:
$ npm run lint:fix
As a payment systems client, it's important to have a high test coverage. In addition to tests that test crucial parts of the libraries and utilities, we also have tests with mock HTTP clients for request/response formats, which act as contact tests.