relay-compiler 0.0.0-main-60e18491 → 0.0.0-main-3c45f957
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +101 -0
- package/linux-x64/relay +0 -0
- package/macos-arm64/relay +0 -0
- package/macos-x64/relay +0 -0
- package/package.json +1 -1
- package/win-x64/relay.exe +0 -0
package/README.md
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
# Relay Compiler
|
2
|
+
|
3
|
+
Relay-Compiler is a code-generation toolkit for GraphQL. It contains the core
|
4
|
+
functionalities of GraphQL code-gen, including file parsing, validation, syntax
|
5
|
+
tree parsing and transformation.
|
6
|
+
|
7
|
+
## Configuration in package.json
|
8
|
+
|
9
|
+
The simplest way to configure relay is to add a new `relay` section to your
|
10
|
+
`package.json` that contains the relay config.
|
11
|
+
|
12
|
+
At minimum, the relay config must specify where to find source files (i.e. files
|
13
|
+
containing `graphql` literals) and the GraphQL schema for the project.
|
14
|
+
|
15
|
+
```
|
16
|
+
// adding new section to package json
|
17
|
+
{
|
18
|
+
...
|
19
|
+
"scripts": {
|
20
|
+
"relay": "relay-compiler"
|
21
|
+
},
|
22
|
+
...
|
23
|
+
// relay configuration
|
24
|
+
"relay": {
|
25
|
+
"src": "./src",
|
26
|
+
"schema": "./src/schema/app_schema.graphql"
|
27
|
+
}
|
28
|
+
}
|
29
|
+
```
|
30
|
+
Relay Compiler will automatically discover the config if:
|
31
|
+
|
32
|
+
- There is a `relay.config.json`, `relay.config.js`, `relay.config.cjs`
|
33
|
+
or `relay.config.mjs` file at the root of the project (i.e. in the same folder
|
34
|
+
as the `package.json` file).
|
35
|
+
- There is a `.relayrc.json`, `.relayrc.js`, `.relayrc.cjs`, `.relayrc.mjs`
|
36
|
+
or `.relayrc` file at the root of the project (i.e. in the same folder as
|
37
|
+
the `package.json` file).
|
38
|
+
- The `package.json` file contains a `"relay"` key.
|
39
|
+
|
40
|
+
Additionally, this config file can be specified with the CLI argument `--config`
|
41
|
+
as follows:
|
42
|
+
|
43
|
+
```shell
|
44
|
+
npm run relay --config ./relay.json
|
45
|
+
```
|
46
|
+
|
47
|
+
or with yarn
|
48
|
+
|
49
|
+
```shell
|
50
|
+
yarn relay --config ./relay.json
|
51
|
+
```
|
52
|
+
|
53
|
+
## File Finder
|
54
|
+
Relay compiler uses [`watchman`](https://facebook.github.io/watchman/) to find
|
55
|
+
file souces, and "listen" to the file changes in the "watch" mode.
|
56
|
+
If `watchman` is not available, the compiler will
|
57
|
+
use [glob](https://docs.rs/glob/latest/glob/) to query the filesystem for files.
|
58
|
+
|
59
|
+
## Configuration
|
60
|
+
|
61
|
+
### Supported compiler configuration options
|
62
|
+
|
63
|
+
- `src` Root directory of application code. [string] [required]
|
64
|
+
- `schema` Relative path to the file with GraphQL SDL file.
|
65
|
+
[string] [required]
|
66
|
+
- `artifactDirectory` A specific directory to output all artifacts to. When
|
67
|
+
enabling this the babel plugin needs `artifactDirectory`
|
68
|
+
to be set as well. [string]
|
69
|
+
- `language` The name of the language used for input files and
|
70
|
+
generated artifacts.
|
71
|
+
["flow" | "typescript"] [default: "flow"]
|
72
|
+
- `excludes` Directories to ignore under `src`. [array] [default:
|
73
|
+
["**/node_modules/**", "**/__mocks__/**", "**/__generated__/**"]]
|
74
|
+
- `schemaExtensions` List of directories with schema extensions. [array]
|
75
|
+
- `noFutureProofEnums` For `flow` only. This option controls whether or not
|
76
|
+
a catch-all entry is added to enum type definitions
|
77
|
+
values that may be added in the future. Enabling this
|
78
|
+
means you will have to update your application whenever
|
79
|
+
the GraphQL server schema adds new enum values to
|
80
|
+
prevent it from breaking. [boolean][default: false]
|
81
|
+
- `customScalars` Mappings from custom scalars in your schema to built-in
|
82
|
+
GraphQL types, for type emission purposes. [object]
|
83
|
+
- `eagerEsModules` This option enables emitting ES modules artifacts.
|
84
|
+
[boolean][default: false]
|
85
|
+
- `persistConfig`
|
86
|
+
- `url` String, URL to send a POST request to to persist.
|
87
|
+
[string]
|
88
|
+
- `params` The document will be in a `POST`
|
89
|
+
parameter `text`. This map can contain additional
|
90
|
+
parameters to send. [object]
|
91
|
+
|
92
|
+
### CLI configuration
|
93
|
+
|
94
|
+
We also support a limited set of CLI arguments that should cover the most cases
|
95
|
+
when you need to run the compiler.
|
96
|
+
|
97
|
+
- `--src` Relative path to the source code.
|
98
|
+
- `--schema` Relative path to schema file.
|
99
|
+
- `--artifactDirectory` Compiler output directory.
|
100
|
+
- `--watch` Run compiler in `watch` mode
|
101
|
+
(requires [`watchman`](https://facebook.github.io/watchman/) to be installed).
|
package/linux-x64/relay
CHANGED
Binary file
|
package/macos-arm64/relay
CHANGED
Binary file
|
package/macos-x64/relay
CHANGED
Binary file
|
package/package.json
CHANGED
package/win-x64/relay.exe
CHANGED
Binary file
|