2023-12-19 12:04:02 +03:00
|
|
|
# V3 Contributing Guide
|
|
|
|
|
|
|
|
## Getting Started
|
|
|
|
|
|
|
|
### Using Docker
|
|
|
|
|
|
|
|
Start a development container (which includes NDC agents for testing):
|
|
|
|
|
|
|
|
```
|
|
|
|
docker compose run --build --rm dev_setup bash
|
|
|
|
```
|
|
|
|
|
|
|
|
### Without Docker
|
|
|
|
|
|
|
|
You will need to install some packages:
|
|
|
|
|
|
|
|
- The Rust compiler
|
|
|
|
- `protobuf-compiler`
|
|
|
|
|
Format everything with Prettier. (#530)
I found myself wanting to rewrite JSON files with `sed`. The problem is,
then I want to run a formatter over them afterwards, and this will
change the whole file, not just the area I touched.
I would like to propose the nuclear option in remedying this: format
everything now. This is a very large change that should make it easier
to keep files to a consistent format in the future.
I have chosen to use Prettier for this because (a) it has a useful
`--write` command and (b) it also does GraphQL, Markdown, YAML, etc.
I've elected to exclude two sets of files:
1. `crates/custom-connector/data/*.json`, because they are actually
multiple JSON objects, one per line, which Prettier cannot parse.
2. `crates/lang-graphql/tests/**/*.graphql`, because it contains invalid
GraphQL, and the parser is intended to work with strangely-formatted
GraphQL.
The main changes are standardizing whitespace, adding a newline at the
end of files, and putting JSON arrays on one line when they fit.
V3_GIT_ORIGIN_REV_ID: 92d4a535c34a3cc00721e8ddc6f17c5717e8ff76
2024-04-30 17:58:09 +03:00
|
|
|
For development, you may need to install some additional tools such as
|
|
|
|
`nextest`. See the [Dockerfile](Dockerfile).
|
2023-12-19 12:04:02 +03:00
|
|
|
|
|
|
|
### Building the source
|
|
|
|
|
Format everything with Prettier. (#530)
I found myself wanting to rewrite JSON files with `sed`. The problem is,
then I want to run a formatter over them afterwards, and this will
change the whole file, not just the area I touched.
I would like to propose the nuclear option in remedying this: format
everything now. This is a very large change that should make it easier
to keep files to a consistent format in the future.
I have chosen to use Prettier for this because (a) it has a useful
`--write` command and (b) it also does GraphQL, Markdown, YAML, etc.
I've elected to exclude two sets of files:
1. `crates/custom-connector/data/*.json`, because they are actually
multiple JSON objects, one per line, which Prettier cannot parse.
2. `crates/lang-graphql/tests/**/*.graphql`, because it contains invalid
GraphQL, and the parser is intended to work with strangely-formatted
GraphQL.
The main changes are standardizing whitespace, adding a newline at the
end of files, and putting JSON arrays on one line when they fit.
V3_GIT_ORIGIN_REV_ID: 92d4a535c34a3cc00721e8ddc6f17c5717e8ff76
2024-04-30 17:58:09 +03:00
|
|
|
If the dependencies are correctly installed as above, you should now be able to
|
|
|
|
run
|
2023-12-19 12:04:02 +03:00
|
|
|
|
|
|
|
```
|
|
|
|
cargo build
|
|
|
|
```
|
|
|
|
|
Format everything with Prettier. (#530)
I found myself wanting to rewrite JSON files with `sed`. The problem is,
then I want to run a formatter over them afterwards, and this will
change the whole file, not just the area I touched.
I would like to propose the nuclear option in remedying this: format
everything now. This is a very large change that should make it easier
to keep files to a consistent format in the future.
I have chosen to use Prettier for this because (a) it has a useful
`--write` command and (b) it also does GraphQL, Markdown, YAML, etc.
I've elected to exclude two sets of files:
1. `crates/custom-connector/data/*.json`, because they are actually
multiple JSON objects, one per line, which Prettier cannot parse.
2. `crates/lang-graphql/tests/**/*.graphql`, because it contains invalid
GraphQL, and the parser is intended to work with strangely-formatted
GraphQL.
The main changes are standardizing whitespace, adding a newline at the
end of files, and putting JSON arrays on one line when they fit.
V3_GIT_ORIGIN_REV_ID: 92d4a535c34a3cc00721e8ddc6f17c5717e8ff76
2024-04-30 17:58:09 +03:00
|
|
|
From here, you can follow the instructions in <README.md> to set up a working
|
|
|
|
server.
|
2023-12-19 12:04:02 +03:00
|
|
|
|
2024-05-07 12:54:58 +03:00
|
|
|
## Installing project dependencies with Nix
|
|
|
|
|
|
|
|
We maintain a [Nix Flake](flake.nix) that will install all of the project
|
|
|
|
dependencies required to work on `v3-engine`.
|
|
|
|
|
|
|
|
To use it:
|
|
|
|
|
|
|
|
1. [Install Nix](https://github.com/DeterminateSystems/nix-installer)
|
|
|
|
2. Run `nix develop` in the project root. This starts a new shell which exposes
|
|
|
|
the Nix project dependencies on your `$PATH`, and can be exited with `exit`.
|
|
|
|
3. Type `echo $IN_NIX_SHELL` to confirm you're in a Nix shell. It should print
|
|
|
|
"impure".
|
|
|
|
4. Run `which rustc` to verify that the Rust compiler is being provided by Nix.
|
|
|
|
You should see a path starting with `/nix/store/` and ending in `/bin/rustc`.
|
|
|
|
|
|
|
|
We also supply configuration for [direnv](https://direnv.net/) to allow
|
|
|
|
autoloading the Nix dependencies upon entering the project folder.
|
|
|
|
|
|
|
|
To use this:
|
|
|
|
|
|
|
|
1. Install direnv:
|
|
|
|
1. [Install the direnv program](https://direnv.net/docs/installation.html)
|
|
|
|
1. [Add the direnv hook to your shell](https://direnv.net/docs/hook.html)
|
|
|
|
1. Open a new terminal
|
|
|
|
1. `cp .envrc.local.example .envrc.local`
|
|
|
|
1. Run `direnv allow`
|
|
|
|
1. Nix should now install project dependencies and put them in your `$PATH`
|
|
|
|
whenever you enter the project folder.
|
|
|
|
1. Type `echo $IN_NIX_SHELL` to confirm you're in a Nix shell. It should print
|
|
|
|
"impure".
|
|
|
|
1. Run `which rustc` to verify that the Rust compiler is being provided by Nix.
|
|
|
|
You should see a path starting with `/nix/store/` and ending in `/bin/rustc`.
|
|
|
|
|
2024-05-08 15:26:34 +03:00
|
|
|
## Additional Reading
|
2023-12-19 12:04:02 +03:00
|
|
|
|
2024-05-08 15:26:34 +03:00
|
|
|
- [Architecture](docs/architecture.md)
|
|
|
|
- [Roles and Annotations](docs/roles-and-annotations.md)
|
|
|
|
- [Errors](docs/errors.md)
|