Simple configuration of vscode-apollo for Relay projects.
Features:
@argumentDefinitions
and @arguments
directives.# using npm
npm install --save vscode-apollo-relay
# using yarn
yarn add vscode-apollo-relay
In your apollo.config.js
file:
const { config } = require("vscode-apollo-relay").generateConfig()
module.exports = config
Or, if you don’t use relay-config and the default values don’t work for you:
const path = require("path")
const {
config,
directivesFile,
includesGlobPattern
} = require("vscode-apollo-relay").generateConfig()
module.exports = {
client: {
...config.client,
service: {
...config.client.service,
localSchemaFile: "./path/to/schema.graphql",
},
includes: [
directivesFile,
path.join("./path/to/source", includesGlobPattern(["js", "jsx"]))
],
excludes: ["./path/to/exclude"],
}
}
If you are still using the compatibility mode of Relay you can enable additional validation rules that only apply to Relay compat. generateConfig
takes a compat
boolean argument to enable these extra validation rules. Ie:
const { config } = require("vscode-apollo-relay").generateConfig(/* compat: */ true)
module.exports = config
# lint
yarn run lint
# build
yarn run build
# test
yarn run test
MIT © Eloy Durán