Skip to content

Commit 5b6ee07

Browse files
authored
Merge pull request #3 from smooth-code/support-graphql-12
feat: add support for graphql v0.12
2 parents 8b6fa1a + 285e59d commit 5b6ee07

File tree

4 files changed

+555
-323
lines changed

4 files changed

+555
-323
lines changed

package.json

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@
1313
],
1414
"license": "MIT",
1515
"scripts": {
16-
"build": "rm -rf lib/ && NODE_ENV=production babel src -d lib",
17-
"ci": "yarn lint && yarn build && yarn test",
16+
"build":
17+
"rm -rf lib/ && NODE_ENV=production babel src -d lib --ignore \"*.test.js\"",
18+
"ci": "./scripts/ci.sh",
1819
"format": "prettier --write \"src/**/*.js\"",
1920
"lint": "eslint .",
2021
"prepublishOnly": "yarn build",
21-
"release": "yarn build && standard-version && conventional-github-releaser -p angular",
22-
"test": "jest --runInBand --coverage && codecov"
22+
"release":
23+
"yarn build && standard-version && conventional-github-releaser -p angular",
24+
"test": "jest"
2325
},
2426
"jest": {
2527
"collectCoverageFrom": [
@@ -31,29 +33,29 @@
3133
]
3234
},
3335
"peerDependencies": {
34-
"graphql": "^0.11.0"
36+
"graphql": "^0.11.0 || ^0.12.0"
3537
},
3638
"dependencies": {
37-
"graphql-tools": "^2.12.0"
39+
"graphql-tools": "^2.17.0"
3840
},
3941
"devDependencies": {
4042
"babel-cli": "^6.26.0",
4143
"babel-core": "^6.26.0",
42-
"babel-eslint": "^8.0.3",
43-
"babel-jest": "^21.2.0",
44+
"babel-eslint": "^8.2.1",
45+
"babel-jest": "^22.0.4",
4446
"babel-plugin-transform-class-properties": "^6.24.1",
4547
"babel-plugin-transform-object-rest-spread": "^6.26.0",
4648
"babel-preset-env": "^1.6.1",
4749
"codecov": "^3.0.0",
4850
"conventional-github-releaser": "^2.0.0",
4951
"date-fns": "^1.29.0",
50-
"eslint": "^4.12.1",
52+
"eslint": "^4.15.0",
5153
"eslint-config-airbnb-base": "^12.1.0",
5254
"eslint-config-prettier": "^2.9.0",
5355
"eslint-plugin-import": "^2.8.0",
54-
"graphql": "^0.11.7",
55-
"jest": "^21.2.1",
56-
"prettier": "^1.9.1",
57-
"standard-version": "^4.2.0"
56+
"graphql": "^0.12",
57+
"jest": "^22.0.4",
58+
"prettier": "^1.9.2",
59+
"standard-version": "^4.3.0"
5860
}
5961
}

scripts/ci.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
echo "Building"
2+
yarn build
3+
4+
echo "Linting"
5+
yarn lint
6+
7+
echo "Installing graphql@^0.12"
8+
yarn add graphql@^0.12
9+
10+
echo "Running tests on graphql@^0.12"
11+
yarn test
12+
13+
echo "Installing graphql ^0.11"
14+
yarn add graphql@^0.11
15+
16+
echo "Running tests on graphql@^0.11"
17+
yarn test --coverage && codecov

src/addDirectiveResolveFunctionsToSchema.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import { forEachField } from 'graphql-tools'
22
import { defaultFieldResolver } from 'graphql'
3-
import { DirectiveLocation } from 'graphql/type'
4-
import { getArgumentValues } from 'graphql/execution/values'
3+
import * as graphqlLanguage from 'graphql/language'
4+
import * as graphqlType from 'graphql/type'
5+
import { getDirectiveValues } from 'graphql/execution'
6+
7+
const DirectiveLocation =
8+
graphqlLanguage.DirectiveLocation || graphqlType.DirectiveLocation
59

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

@@ -42,7 +46,7 @@ function getDirectiveInfo(directive, resolverMap, schema, location) {
4246
)
4347
}
4448

45-
const args = getArgumentValues(Directive, directive)
49+
const args = getDirectiveValues(Directive, { directives: [directive] })
4650
return { args, resolver }
4751
}
4852

0 commit comments

Comments
 (0)