GITHUB_PR_NUMBER: 6640 GITHUB_PR_URL: https://github.com/hasura/graphql-engine/pull/6640 Co-authored-by: Vishnu Bharathi <4211715+scriptnull@users.noreply.github.com> Co-authored-by: Aravind K P <8335904+scriptonist@users.noreply.github.com> GitOrigin-RevId: 362d82d8ee18afd7efa63e9c8912f6c5444f82dd
2.9 KiB
Contributing
Thanks for your interest in Hasura GraphQL Engine CLI.
The CLI is written in Go using the popular
package spf13/cobra
.
All CLI related issues are labelled as c/cli
which stands for
component/cli. If you're new to the CLI codebase, you can checkout the
good-first-issue
label for issues that
are fairly easy to implement.
If you are a first-time contributor, feel free to post your doubts/questions in #contrib
channel on hasura discord server.
Pre-requisites
You can follow your existing Golang workflow to fork, work on a branch and submit PR. If you're new to forking and working on Golang repositories, please follow the instructions below to make sure the import paths are correct:
- Fork the repo on GitHub
git clone https://github.com/<your-username>/graphql-engine
cd graphql-engine/cli
git remote add upstream https://github.com/hasura/graphql-engine
git checkout -b <branch-name>
make deps
make build-cli-ext
- Work on the feature/fix
- If you modify files in
assets/
, runmake assets
- Add tests and ensure all tests are passing (check Tests section below)
- Commit, push and submit PR
Development workflow
For faster development workflow, you may use tools that watch the directory for changes and rebuilds the cli whenever a new change happens. realize and watchrun are two such examples. The configuration file for realize
is already included in the repo at .realize/realize.yaml
.
Tests
When you're adding a new feature, it is encouraged to add integration tests (unit tests also if possible) for the functions/api. You should run all the tests and make sure everything passes before submitting the PR.
The tests expect a GraphQL Engine server instance to be running. You can point the tests to any GraphQL Engine server but please note that the database should be empty. The easiest way to do this is to run Postgres and GraphQL Engine using Docker Compose. Once the server is running, you can run the tests by executing the make command:
HASURA_GRAPHQL_TEST_ENDPOINT=http://localhost:8080 VERSION=dev make test
Builds
To build a binary, execute the following command:
# make deps to install all go packages
make build
This will output cross-platform binaries to _output
directory.