Skip to content

Commit edf0702

Browse files
committed
introduce tools commands for the compiler
1 parent 14eeccb commit edf0702

4 files changed

Lines changed: 33 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# master
22

3+
- Introduce `rescript-relay-compiler tools`, exposing Relay analysis commands like `definition-audit`, `find-schema-references`, `fragment-dependents`, and `print-operation`.
4+
35
# 4.3.0
46

57
- Respect `noFutureProofEnums` in generated ReScript enum types, disabling `FutureAddedValue(...)` when configured.

rescript-relay-documentation/docs/getting-started.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ module.exports = {
102102
};
103103
```
104104

105-
> All configuration options can be seen by running `yarn relay-compiler --help` in your project.
105+
> All configuration options can be seen by running `yarn rescript-relay-compiler --help` in your project.
106106
107107
> Read more about [custom scalars here.](custom-scalars)
108108
@@ -126,6 +126,13 @@ You can go ahead and start it in watch mode right away (`yarn relay:watch`) in a
126126

127127
The Relay compiler is really awesome. If you're interested there's plenty more to read about the compiler and how RescriptRelay uses it [here](the-compiler).
128128

129+
## Tools and utils
130+
131+
RescriptRelay ships two CLIs that are useful to know about:
132+
133+
- `rescript-relay-compiler` for running the compiler itself, plus Relay compiler tools like `yarn relay tools --help` or `yarn relay tools definition-audit --min-selection-lines 40`. These `tools` commands are especially useful for agents and automation, because they can introspect the Relay parts of your codebase directly.
134+
- `rescript-relay-cli` for RescriptRelay-specific utilities like `yarn rescript-relay-cli remove-unused-fields` and `yarn rescript-relay-cli format-all-graphql`.
135+
129136
## Setting up the Relay environment
130137

131138
Finally time for some actual code. Next thing is setting up the Relay environment. The Relay environment consists of a network layer responsible for dispatching your GraphQL queries, and a store responsible for storing data and supplying it to your components.

rescript-relay-documentation/docs/rescript-relay-cli.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,28 @@ sidebar_label: RescriptRelay CLI
66

77
`rescript-relay-cli` is a CLI for making life using RescriptRelay just a tiny bit easier. It's automatically included with every release of `rescript-relay`.
88

9+
There are two different CLIs worth knowing about:
10+
11+
- `rescript-relay-cli` for RescriptRelay-specific maintenance commands like removing unused fields and formatting GraphQL.
12+
- `rescript-relay-compiler` for the Relay compiler itself, including the `tools` analysis commands.
13+
14+
At some point, these two will likely be merged into one, but for now they're separate.
15+
16+
## RescriptRelay compiler tools
17+
18+
The RescriptRelay compiler tools ship through `rescript-relay-compiler`, not `rescript-relay-cli`.
19+
20+
Examples:
21+
22+
```bash
23+
rescript-relay-compiler tools --help
24+
rescript-relay-compiler tools definition-audit --min-selection-lines 40
25+
rescript-relay-compiler tools find-schema-references User.name
26+
rescript-relay-compiler tools fragment-dependents UserCard_user --transitive
27+
```
28+
29+
Use these compiler tools for codebase audits, impact analysis, and mechanical Relay refactors. Keep using `rescript-relay-cli` for the commands below. They're especially useful for code agents.
30+
931
## Commands
1032

1133
### remove-unused-fields

0 commit comments

Comments
 (0)