|
4 | 4 |
|
5 | 5 | ### DDN CLI |
6 | 6 |
|
7 | | -DDN CLI automatically starts the connector with `ddn dev` command that uses Docker Compose internally. |
8 | | -Docker Compose can watch changes in the source code and rebuild the connector. However, this connector limits the changes in the root folder only to avoid rebuild noises. |
9 | | -After editing files in child folders, save any `*.go` file in the root folder to trigger the build. |
| 7 | +The boilerplate follows [Native Connector Packaging](https://github.com/hasura/ndc-hub/blob/main/rfcs/0004-native-packaging.md) with convenience shell scripts at [the connector definition folder](.hasura-connector/scripts). DDN CLI can automatically invoke those scripts when developing with DDN projects. |
10 | 8 |
|
11 | | -### Native Go |
| 9 | +### Convenience scripts (Linux & MacOS) |
12 | 10 |
|
13 | | -Start the connector server at http://localhost:8080 |
| 11 | +You can run the convenience script with `make`. Those commands reuse native scripts at [the connector definition folder](.hasura-connector/scripts). |
14 | 12 |
|
15 | | -```go |
16 | | -go run . serve |
| 13 | +```sh |
| 14 | +Usage: |
| 15 | + start Start the server with go run |
| 16 | + update Update schema and code generation |
| 17 | + watch Watch code changes and live reload |
17 | 18 | ``` |
18 | 19 |
|
19 | | -## Code generation |
| 20 | +### Manual installation |
20 | 21 |
|
21 | | -### Convenience script (Linux & MacOS only) |
| 22 | +Install following tools for development: |
22 | 23 |
|
23 | | -You can run the convenience script with `make` or with the bash file directly. |
24 | | -The script automatically downloads the tool and runs the `generate` command. |
| 24 | +- [hasura-ndc-go](https://github.com/hasura/ndc-sdk-go/tree/main/cmd/hasura-ndc-go) |
| 25 | +- [air](https://github.com/cosmtrek/air) (optional, install if you want live reload) |
25 | 26 |
|
26 | | -```bash |
27 | | -make generate |
| 27 | +```sh |
| 28 | +go install github.com/hasura/ndc-sdk-go/cmd/hasura-ndc-go@latest |
| 29 | +# downgrade lower version if you don't use the latest Go |
| 30 | +go install github.com/cosmtrek/air@latest |
28 | 31 | ``` |
29 | 32 |
|
30 | | -```bash |
31 | | -sh ./scripts/generate.sh |
| 33 | +#### Live reload |
| 34 | + |
| 35 | +**Linux & MacOS** |
| 36 | + |
| 37 | +```sh |
| 38 | +air -c air -c .air.toml |
32 | 39 | ``` |
33 | 40 |
|
34 | | -### Manually download |
| 41 | +**Windows** |
35 | 42 |
|
36 | | -Download the `hasura-ndc-go` tool at the [release page](https://github.com/hasura/ndc-sdk-go/releases/tag/{{.Version}}) page. |
37 | | -Navigate to the root project folder and run `generate` whenever there are new changes from NDC functions and types. |
| 43 | +```sh |
| 44 | +air -c air -c .air.windows.toml |
| 45 | +``` |
| 46 | + |
| 47 | +#### Manual |
| 48 | + |
| 49 | +Whenever modifying NDC types and functions in the `functions` folder, you need to generate NDC schema and codes. |
38 | 50 |
|
39 | 51 | ```sh |
40 | 52 | hasura-ndc-go generate |
41 | 53 | ``` |
42 | 54 |
|
43 | | -See [NDC Go SDK](https://github.com/hasura/ndc-sdk-go/tree/v0) for more information and [the generation tool](https://github.com/hasura/ndc-sdk-go/tree/v0/cmd/hasura-ndc-go) for command documentation. |
| 55 | +Start the connector server at http://localhost:8080 |
| 56 | + |
| 57 | +```go |
| 58 | +go run . serve |
| 59 | +``` |
0 commit comments