Skip to content

Commit

Permalink
feat: add support for graphql v0.12
Browse files Browse the repository at this point in the history
Closes #2
  • Loading branch information
gregberge committed Jan 9, 2018
1 parent 8b6fa1a commit 285e59d
Show file tree
Hide file tree
Showing 4 changed files with 555 additions and 323 deletions.
28 changes: 15 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@
],
"license": "MIT",
"scripts": {
"build": "rm -rf lib/ && NODE_ENV=production babel src -d lib",
"ci": "yarn lint && yarn build && yarn test",
"build":
"rm -rf lib/ && NODE_ENV=production babel src -d lib --ignore \"*.test.js\"",
"ci": "./scripts/ci.sh",
"format": "prettier --write \"src/**/*.js\"",
"lint": "eslint .",
"prepublishOnly": "yarn build",
"release": "yarn build && standard-version && conventional-github-releaser -p angular",
"test": "jest --runInBand --coverage && codecov"
"release":
"yarn build && standard-version && conventional-github-releaser -p angular",
"test": "jest"
},
"jest": {
"collectCoverageFrom": [
Expand All @@ -31,29 +33,29 @@
]
},
"peerDependencies": {
"graphql": "^0.11.0"
"graphql": "^0.11.0 || ^0.12.0"
},
"dependencies": {
"graphql-tools": "^2.12.0"
"graphql-tools": "^2.17.0"
},
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-core": "^6.26.0",
"babel-eslint": "^8.0.3",
"babel-jest": "^21.2.0",
"babel-eslint": "^8.2.1",
"babel-jest": "^22.0.4",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-env": "^1.6.1",
"codecov": "^3.0.0",
"conventional-github-releaser": "^2.0.0",
"date-fns": "^1.29.0",
"eslint": "^4.12.1",
"eslint": "^4.15.0",
"eslint-config-airbnb-base": "^12.1.0",
"eslint-config-prettier": "^2.9.0",
"eslint-plugin-import": "^2.8.0",
"graphql": "^0.11.7",
"jest": "^21.2.1",
"prettier": "^1.9.1",
"standard-version": "^4.2.0"
"graphql": "^0.12",
"jest": "^22.0.4",
"prettier": "^1.9.2",
"standard-version": "^4.3.0"
}
}
17 changes: 17 additions & 0 deletions scripts/ci.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
echo "Building"
yarn build

echo "Linting"
yarn lint

echo "Installing graphql@^0.12"
yarn add graphql@^0.12

echo "Running tests on graphql@^0.12"
yarn test

echo "Installing graphql ^0.11"
yarn add graphql@^0.11

echo "Running tests on graphql@^0.11"
yarn test --coverage && codecov
10 changes: 7 additions & 3 deletions src/addDirectiveResolveFunctionsToSchema.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { forEachField } from 'graphql-tools'
import { defaultFieldResolver } from 'graphql'
import { DirectiveLocation } from 'graphql/type'
import { getArgumentValues } from 'graphql/execution/values'
import * as graphqlLanguage from 'graphql/language'
import * as graphqlType from 'graphql/type'
import { getDirectiveValues } from 'graphql/execution'

const DirectiveLocation =
graphqlLanguage.DirectiveLocation || graphqlType.DirectiveLocation

const BUILT_IN_DIRECTIVES = ['deprecated', 'skip', 'include']

Expand Down Expand Up @@ -42,7 +46,7 @@ function getDirectiveInfo(directive, resolverMap, schema, location) {
)
}

const args = getArgumentValues(Directive, directive)
const args = getDirectiveValues(Directive, { directives: [directive] })
return { args, resolver }
}

Expand Down
Loading

0 comments on commit 285e59d

Please sign in to comment.