From a8e42af9cb271baad714f587165212b7b9afe5b9 Mon Sep 17 00:00:00 2001 From: Jimmy Jia Date: Tue, 30 May 2017 14:09:38 -0400 Subject: [PATCH] Finish upgrade to Relay 1 --- package.json | 2 +- test/.babelrc | 2 +- test/fixtures/.gitignore | 1 - test/fixtures/babelRelayPlugin.js | 5 ----- test/fixtures/schema.graphql | 8 ++++++++ test/fixtures/updateSchema.js | 18 +++++------------- 6 files changed, 15 insertions(+), 21 deletions(-) delete mode 100644 test/fixtures/.gitignore delete mode 100644 test/fixtures/babelRelayPlugin.js create mode 100644 test/fixtures/schema.graphql diff --git a/package.json b/package.json index 864d2d8..319555f 100644 --- a/package.json +++ b/package.json @@ -53,13 +53,13 @@ "babel-loader": "^7.0.0", "babel-plugin-add-module-exports": "^0.2.1", "babel-plugin-dev-expression": "^0.2.1", + "babel-plugin-relay": "^1.0.1", "babel-plugin-transform-runtime": "^6.23.0", "babel-polyfill": "^6.23.0", "babel-preset-latest": "^6.24.1", "babel-preset-react": "^6.24.1", "babel-preset-stage-1": "^6.24.1", "babel-register": "^6.24.1", - "babel-relay-plugin": "^0.10.0", "chai": "^3.5.0", "cross-env": "^5.0.0", "eslint": "^3.19.0", diff --git a/test/.babelrc b/test/.babelrc index f597a04..a61d657 100644 --- a/test/.babelrc +++ b/test/.babelrc @@ -7,6 +7,6 @@ "react" ], "plugins": [ - "./fixtures/babelRelayPlugin" + ["relay", { "schema": "test/fixtures/schema.graphql" }] ] } diff --git a/test/fixtures/.gitignore b/test/fixtures/.gitignore deleted file mode 100644 index 07a200b..0000000 --- a/test/fixtures/.gitignore +++ /dev/null @@ -1 +0,0 @@ -schema.json diff --git a/test/fixtures/babelRelayPlugin.js b/test/fixtures/babelRelayPlugin.js deleted file mode 100644 index e3e69fc..0000000 --- a/test/fixtures/babelRelayPlugin.js +++ /dev/null @@ -1,5 +0,0 @@ -const getBabelRelayPlugin = require('babel-relay-plugin'); - -const schema = require('./schema.json'); - -module.exports = getBabelRelayPlugin(schema.data); diff --git a/test/fixtures/schema.graphql b/test/fixtures/schema.graphql new file mode 100644 index 0000000..4c0c49e --- /dev/null +++ b/test/fixtures/schema.graphql @@ -0,0 +1,8 @@ +type Query { + widget: Widget + widgetByArg(name: String!): Widget +} + +type Widget { + name: String +} diff --git a/test/fixtures/updateSchema.js b/test/fixtures/updateSchema.js index 6addc03..cd38026 100644 --- a/test/fixtures/updateSchema.js +++ b/test/fixtures/updateSchema.js @@ -1,18 +1,10 @@ import fs from 'fs'; -import { graphql } from 'graphql'; -import { introspectionQuery } from 'graphql/utilities'; +import { printSchema } from 'graphql/utilities'; import path from 'path'; import schema from './schema'; -(async () => { - const result = await graphql(schema, introspectionQuery); - if (result.errors) { - throw new Error(result.errors); - } - - fs.writeFileSync( - path.join(__dirname, 'schema.json'), - JSON.stringify(result, null, 2), - ); -})(); +fs.writeFileSync( + path.join(__dirname, 'schema.graphql'), + printSchema(schema), +);