Skip to main content

Development

To set up a development environment to build this project, you'll need to install some helpful tools.

Clippy

For helpful linting rools, install Clippy

Run it with cargo:

cargo clippy --fix

If you're using VS Code, configure the rust-analyzer plugin to use it (in settings.json):

{
"rust-analyzer.checkOnSave.command": "clippy"
}

pre-commit

Install pre-commit to automatically set up Git hook scripts.

In Ubuntu, the package to install is pre-commit:

sudo apt install pre-commit

On Mac with Homebrew, the package is also pre-commit:

brew install pre-commit

libclang

The cargo-spellcheck utility depends on libclang.

In Ubuntu, the package to install is libclang-dev:

sudo apt install libclang-dev

Cargo Make

To use build scripts from the Makefile.toml, install Cargo Make:

cargo install cargo-make

Run "setup" to install some tooling dependencies:

cargo make setup

Running the Local dev server

Use cargo to run the dev server locally:

cargo make dev

Update Dependencies

First, install the outdated command for cargo:

cargo install cargo-outdated

Then, update and check for any major dependency changes:

cargo update
cargo outdated

Examples: Docker Build

To build locally, use Buildkit:

DOCKER_BUILDKIT=1 docker build -t async-graphql -f examples/async-graphql/Dockerfile .

To clear the build cache:

docker builder prune --filter type=exec.cachemount

To inspect the local filesystem:

docker run --rm -it --entrypoint=/bin/bash async-graphql

To inspect the full build context:

docker image build --no-cache -t build-context -f - . <<EOF
FROM busybox
WORKDIR /build-context
COPY . .
CMD find .
EOF

docker container run --rm build-context

And to clean up the build context test image:

docker image rm build-context