Skip to content

Commit

Permalink
Run npx prettier on README files
Browse files Browse the repository at this point in the history
Summary: Manually fix the formatting in the OSS readme files. But we need to add this to the build step/or something.

Reviewed By: kassens

Differential Revision: D33793614

fbshipit-source-id: bec9f3eeb9f21dad2b27572a90aa6e4326bb4564
  • Loading branch information
alunyov authored and facebook-github-bot committed Jan 26, 2022
1 parent cce915c commit edd3214
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 93 deletions.
37 changes: 15 additions & 22 deletions packages/babel-plugin-relay/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
babel-plugin-relay
---
## babel-plugin-relay

Relay requires a Babel plugin to convert GraphQL tags to runtime artifacts.


A *very* simplified example of what this plugin is doing:
A _very_ simplified example of what this plugin is doing:

```js

// It converts this code
const fragment = graphql`
fragment User_fragment on User {
Expand All @@ -24,24 +21,20 @@ const fragment = require('__generated__/User_fragment.graphql');
`babel-plugin-relay` will discover the config if:

- There is a `relay.config.json`, `relay.config.js` file at the root of the
project (i.e. in the same folder as the `package.json` file).
project (i.e. in the same folder as the `package.json` file).
- The `package.json` file contains a `"relay"` key.

### Supported configuration options for `babel-plugin-relay`

- `artifactDirectory` A specific directory to output all artifacts to. When
enabling this the babel plugin needs `artifactDirectory`
to be set as well. [string]
- `eagerEsModules` This option enables emitting ES modules artifacts.
[boolean][default: false]
- `codegenCommand` The command to run to compile Relay files.
[string]
- `isDevVariableName` Name of the global variable for dev mode
(e.g. `__DEV__`).
[string]
- `jsModuleFormat` Formatting style for generated files. `commonjs`
or `haste`. Default is `commonjs`.
[string]

[Configuration Instructions](
https://relay.dev/docs/getting-started/installation-and-setup/#set-up-babel-plugin-relay)
- `artifactDirectory` A specific directory to output all artifacts to. When
enabling this the babel plugin needs `artifactDirectory` to be set as well.
[string]
- `eagerEsModules` This option enables emitting ES modules artifacts.
[boolean][default: false]
- `codegenCommand` The command to run to compile Relay files. [string]
- `isDevVariableName` Name of the global variable for dev mode (e.g. `__DEV__`).
[string]
- `jsModuleFormat` Formatting style for generated files. `commonjs` or `haste`.
Default is `commonjs`. [string]

[Configuration Instructions](https://relay.dev/docs/getting-started/installation-and-setup/#set-up-babel-plugin-relay)
8 changes: 3 additions & 5 deletions packages/react-relay/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
React APIs for Relay
---
## React APIs for Relay

This package contains a collection of React APIs: Hooks and Components that are integrated with Relay runtime.
This package contains a collection of React APIs: Hooks and Components that are
integrated with Relay runtime.

Example:

```js

// @flow

import type {UserComponent_user$key} from 'UserComponent_user.graphql';
Expand Down Expand Up @@ -41,7 +40,6 @@ function UserComponent(props: Props) {
</>
);
}

```
For complete API reference, visit https://relay.dev/.
109 changes: 51 additions & 58 deletions packages/relay-compiler/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ containing `graphql` literals) and the GraphQL schema for the project.
}
}
```

Relay Compiler will automatically discover the config if:

- There is a `relay.config.json`, `relay.config.js` file at the root of the
project (i.e. in the same folder as the `package.json` file).
project (i.e. in the same folder as the `package.json` file).
- The `package.json` file contains a `"relay"` key.

Additionally, this config file can be specified with the CLI argument `--config`
Expand All @@ -47,77 +48,69 @@ yarn relay --config ./relay.json
```

Please note, that if you pass configuration options via --cli arguments, you'll
need to provide a separate configuration for the [babel plugin](https://www.npmjs.com/package/babel-plugin-relay).
need to provide a separate configuration for the
[babel plugin](https://www.npmjs.com/package/babel-plugin-relay).

## File Finder

Relay compiler uses [`watchman`](https://facebook.github.io/watchman/) to find
file sources, and "listen" to the file changes in the "watch" mode.
If `watchman` is not available, the compiler will
use [glob](https://docs.rs/glob/latest/glob/) to query the filesystem for files.
file sources, and "listen" to the file changes in the "watch" mode. If
`watchman` is not available, the compiler will use
[glob](https://docs.rs/glob/latest/glob/) to query the filesystem for files.

## Configuration

### Supported compiler configuration options

- `src` Root directory of application code. [string] [required]
- `schema` Relative path to the file with GraphQL SDL file.
[string] [required]
- `src` Root directory of application code. [string] [required]
- `schema` Relative path to the file with GraphQL SDL file. [string] [required]
- `schemaConfig`
- `nodeInterfaceIdField` Configure the name of the globally unique ID
field on the Node interface. Useful if you can't use the default `id` field name.
[string][default: "id"]
- `artifactDirectory` A specific directory to output all artifacts to. When
enabling this the babel plugin needs `artifactDirectory`
to be set as well. [string]
- `language` The name of the language used for input files and
generated artifacts.
["flow" | "typescript"] [default: "flow"]
- `excludes` Directories to ignore under `src`. [array] [default:
["**/node_modules/**", "**/__mocks__/**", "**/__generated__/**"]]
- `schemaExtensions` List of directories with schema extensions. [array]
- `noFutureProofEnums` For `flow` only. This option controls whether or not
a catch-all entry is added to enum type definitions
values that may be added in the future. Enabling this
means you will have to update your application whenever
the GraphQL server schema adds new enum values to
prevent it from breaking. [boolean][default: false]
- `customScalars` Mappings from custom scalars in your schema to built-in
GraphQL types, for type emission purposes. [object]
- `eagerEsModules` This option enables emitting ES modules artifacts.
[boolean][default: false]
- `nodeInterfaceIdField` Configure the name of the globally unique ID field on
the Node interface. Useful if you can't use the default `id` field name.
[string][default: "id"]
- `artifactDirectory` A specific directory to output all artifacts to. When
enabling this the babel plugin needs `artifactDirectory` to be set as well.
[string]
- `language` The name of the language used for input files and generated
artifacts. ["flow" | "typescript"] [default: "flow"]
- `excludes` Directories to ignore under `src`. [array] [default:
["**/node_modules/**", "**/__mocks__/**", "**/__generated__/**"]]
- `schemaExtensions` List of directories with schema extensions. [array]
- `noFutureProofEnums` For `flow` only. This option controls whether or not a
catch-all entry is added to enum type definitions values that may be added in
the future. Enabling this means you will have to update your application
whenever the GraphQL server schema adds new enum values to prevent it from
breaking. [boolean][default: false]
- `customScalars` Mappings from custom scalars in your schema to built-in
GraphQL types, for type emission purposes. [object]
- `eagerEsModules` This option enables emitting ES modules artifacts.
[boolean][default: false]
- `persistConfig`
- `url` String, URL to send a POST request to to persist. This
field is required in `persistConfig`
[string]
- `params` The document will be in a `POST` parameter `text`.
This map can contain additional parameters to send.
[object]
- `concurrency` The maximum number concurrent requests that will
be made to `url`. Use a value greater than 0.
[number]
- `codegenCommand` Command name that for relay compiler. [string]

- `isDevVariableName` Name of the global variable for dev mode (`__DEV__`).
[string]
- `jsModuleFormat` Formatting style for generated files. `commonjs`
or `haste`. Default is `commonjs`.
[string]

- `url` String, URL to send a POST request to to persist. This field is
required in `persistConfig` [string]
- `params` The document will be in a `POST` parameter `text`. This map can
contain additional parameters to send. [object]
- `concurrency` The maximum number concurrent requests that will be made to
`url`. Use a value greater than 0. [number]
- `codegenCommand` Command name that for relay compiler. [string]

- `isDevVariableName` Name of the global variable for dev mode (`__DEV__`).
[string]
- `jsModuleFormat` Formatting style for generated files. `commonjs` or `haste`.
Default is `commonjs`. [string]

### CLI configuration

We also support a limited set of CLI arguments that should cover the most cases
when you need to run the compiler.

- `--src` Relative path to the source code.
- `--schema` Relative path to schema file.
- `--src` Relative path to the source code.
- `--schema` Relative path to schema file.
- `--artifactDirectory` Compiler output directory.
- `--repersist` Run the persister even if the query has not changed.
- `--watch` Run compiler in `watch` mode.
Requires
[`watchman`](https://facebook.github.io/watchman/) to be installed.
- `--output` Output format of the compiler. Supported options:
`debug` | `verbose` | `quiet` | `quietWithErrors`.
The default value is `verbose`.
- `--validate` Looks for pending changes and exits with non-zero code
instead of writing to disk.
- `--repersist` Run the persister even if the query has not changed.
- `--watch` Run compiler in `watch` mode. Requires
[`watchman`](https://facebook.github.io/watchman/) to be installed.
- `--output` Output format of the compiler. Supported options: `debug` |
`verbose` | `quiet` | `quietWithErrors`. The default value is `verbose`.
- `--validate` Looks for pending changes and exits with non-zero code instead of
writing to disk.
5 changes: 1 addition & 4 deletions packages/relay-runtime/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
Relay Runtime
---
## Relay Runtime

A set of Relay APIs responsible for data fetching, reading and normalization of
the GraphQL data.

Example:

```js

// @flow strict-local

import type {FetchFunction} from 'relay-runtime';
Expand Down Expand Up @@ -61,7 +59,6 @@ fetchQuery(
console.log(data);
},
});

```

For complete API reference, visit https://relay.dev/.
3 changes: 1 addition & 2 deletions packages/relay-test-utils-internal/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
relay-test-utils-internal
---
## relay-test-utils-internal

A collection of internal helpers used for relay unit-tests.
3 changes: 1 addition & 2 deletions packages/relay-test-utils/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
relay-test-utils
---
## relay-test-utils

More details: https://relay.dev/docs/guides/testing-relay-components/

0 comments on commit edd3214

Please sign in to comment.