Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade graphql package #367

Merged
merged 5 commits into from
May 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/2-scaffolding/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@types/react-dom": "^16.8.4",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"typescript": "^3.4.5"
"typescript": "^4.6.4"
},
"relativeDependencies": {
"mst-gql": "../../"
Expand Down
4 changes: 3 additions & 1 deletion generator/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const graphql = require("graphql")
const camelcase = require("camelcase")
const pluralize = require("pluralize")
const escapeStringRegexp = require("escape-string-regexp")
const { getIntrospectionQuery } = require("graphql")

const exampleAction = ` .actions(self => ({
// This is an auto-generated example action.
Expand Down Expand Up @@ -1286,8 +1287,9 @@ function scaffold(
fieldOverrides: []
}
) {

const schema = graphql.buildSchema(definition)
const res = graphql.graphqlSync(schema, graphql.introspectionQuery)
const res = graphql.graphqlSync({schema, source: getIntrospectionQuery()})
if (!res.data)
throw new Error("graphql parse error:\n\n" + JSON.stringify(res, null, 2))
return generate(
Expand Down
3 changes: 2 additions & 1 deletion generator/mst-gql-scaffold.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const path = require("path")
const fs = require("fs")
const child_process = require("child_process")
const graphql = require("graphql")
const { getIntrospectionQuery } = require("graphql")

const { getConfig, mergeConfigs } = require("./config")
const { generate, writeFiles, logUnexpectedFiles } = require("./generate")
Expand Down Expand Up @@ -85,7 +86,7 @@ function main() {
// Tnx https://blog.apollographql.com/three-ways-to-represent-your-graphql-schema-a41f4175100d!
const text = fs.readFileSync(input, "utf8")
const schema = graphql.buildSchema(text)
const res = graphql.graphqlSync(schema, graphql.introspectionQuery)
const res = graphql.graphqlSync({schema, source: getIntrospectionQuery()})
if (res.data) json = res.data
else {
console.error("graphql parse error:\n\n" + JSON.stringify(res, null, 2))
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mst-gql",
"version": "0.15.0",
"version": "0.15.0-361-graphql-upgrade",
"description": "Bindings for mobx-state-tree and GraphQL",
"author": "Michel Weststrate",
"keywords": [
Expand Down Expand Up @@ -31,7 +31,7 @@
"generator"
],
"scripts": {
"test": "jest test && cd examples/2-scaffolding && yarn && yarn start && cd ../6-scaffolding-ts-hasura && yarn && yarn start ",
"test": "jest test && cd examples/2-scaffolding && yarn && yarn start && cd ../6-scaffolding-ts-hasura && yarn && yarn start && cd ../../tests && ./test-cra.sh && rm -rf cra-test",
"test:debug": "node --inspect-brk node_modules/.bin/jest --runInBand",
"watch": "jest test --watch",
"build": "microbundle --no-compress --external mobx,mobx-react,mobx-state-tree,graphql-tag,graphql,react,react-dom,graphql-request",
Expand All @@ -48,8 +48,8 @@
"camelcase": "^6.2.0",
"cosmiconfig": "^7.0.0",
"fast-json-stable-stringify": "^2.1.0",
"graphql": "14.6.0",
"graphql-request": "^4.0.0",
"graphql": "^16.3.0",
"graphql-request": "^4.2.0",
"lodash": "^4.17.21",
"pluralize": "^8.0.0",
"throttle-debounce": "^3.0.1"
Expand Down Expand Up @@ -90,6 +90,6 @@
"mobx-state-tree": "^5.0.1"
},
"resolutions": {
"graphql": "14.6.0"
"graphql": "^16.3.0"
}
}
Loading