babel-plugin-react-relay
Advanced tools
Comparing version 0.9.2-1 to 0.9.2-2
{ | ||
"name": "babel-plugin-react-relay", | ||
"version": "0.9.2-1", | ||
"version": "0.9.2-2", | ||
"description": "Babel plugin for Relay (react-relay) with easy schema configuration in .babelrc", | ||
@@ -44,4 +44,4 @@ "main": "lib/index.js", | ||
"deasync": "^0.1.7", | ||
"graphql-config-parser": "^1.0.0" | ||
"graphql-config-parser": "^1.0.1" | ||
} | ||
} |
# babel-plugin-react-relay [![npm version](https://badge.fury.io/js/babel-plugin-react-relay.svg)](https://badge.fury.io/js/babel-plugin-react-relay) | ||
Babel plugin for [Relay](https://github.com/facebook/relay) with support for multiple source types | ||
Babel plugin for [Relay](https://github.com/facebook/relay) which works out of the box with your GraphQL endpoint | ||
@@ -8,2 +8,4 @@ #### How does this relate to [babel-relay-plugin](https://www.npmjs.com/package/babel-relay-plugin)? | ||
(The version is the same as `babel-relay-plugin` by the way.) | ||
## Install | ||
@@ -17,4 +19,6 @@ | ||
### Step 1: Add babel plugin | ||
> Note: We recently switched over to [graphql-config](https://github.com/graphcool/graphql-config), so this might be a breaking change for you. | ||
### Step 1: Add plugin to `.babelrc` | ||
Add the following to your `.babelrc` file or the corresponding babel configuration. | ||
@@ -28,53 +32,14 @@ | ||
### Step 2: Configure schema source | ||
### Step 2: Configure your GraphQL schema | ||
Add one of the following source options to your `package.json` file. | ||
This plugin uses the [graphql-config](https://github.com/graphcool/graphql-config) format and already works out of the box if you're using another GraphQL dev tool such as [this great IntelliJ Plugin](https://github.com/jimkyndemeyer/js-graphql-intellij-plugin). | ||
#### JSON | ||
Add one of the following source options to your `package.json` file. **See [here](https://github.com/graphcool/graphql-config#usage) for more configuration details.** | ||
Imports a static GraphQL schema exported as a JSON file | ||
For your convenience, here is the easiest way to configure your GraphQL endpoint: | ||
```json | ||
{ | ||
"react-relay-schema": "./exported-schema.json" | ||
} | ||
```sh | ||
export GRAPHQL_ENDPOINT="https://your.api/graphql" | ||
``` | ||
#### URL | ||
You can also provide a URL to a schema endpoint. Use this method if you're using [graph.cool](https://graph.cool/). | ||
```json | ||
{ | ||
"react-relay-schema": "http://localhost:3000/schema.json" | ||
} | ||
``` | ||
#### Schema | ||
[graphql-js](https://github.com/graphql/graphql-js) schema definition is also supported. | ||
```json | ||
{ | ||
"react-relay-schema": "./schema-definition.js" | ||
} | ||
``` | ||
### Options | ||
#### Environment Variables | ||
Sometimes you need the flexibility to dynamically configure your GraphQL schema source via environment variables. You can easily do that using the following syntax (works for all source types): | ||
```json | ||
{ | ||
"react-relay-schema": { | ||
"env": "SCHEMA_ENDPOINT" | ||
} | ||
} | ||
``` | ||
This example uses the `$SCHEMA_ENDPOINT` environment variable. | ||
## License | ||
@@ -81,0 +46,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5202
52
Updatedgraphql-config-parser@^1.0.1