Skip to content

Commit d29694c

Browse files
committed
Merge pull request #2 from graphql/master
Merge latest changes from HEAD: 0.4.18 -> 0.5.0
2 parents 307511d + dd02973 commit d29694c

File tree

98 files changed

+2821
-802
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+2821
-802
lines changed

.eslintrc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,11 @@
3939

4040
"rules": {
4141
"babel/arrow-parens": [2, "as-needed"],
42+
"babel/array-bracket-spacing": [2, "always"],
43+
"babel/generator-star-spacing": [2, {"before": true, "after": false}],
44+
"array-bracket-spacing": 0,
45+
"generator-star-spacing": 0,
4246

43-
"array-bracket-spacing": [2, "always"],
4447
"arrow-spacing": 2,
4548
"block-scoped-var": 0,
4649
"brace-style": [2, "1tbs", {"allowSingleLine": true}],
@@ -61,14 +64,14 @@
6164
"eqeqeq": 2,
6265
"func-names": 0,
6366
"func-style": 0,
64-
"generator-star-spacing": [0, {"before": true, "after": false}],
6567
"guard-for-in": 2,
6668
"handle-callback-err": [2, "error"],
6769
"id-length": 0,
6870
"id-match": [2, "^(?:_?[a-zA-Z0-9]*)|[_A-Z0-9]+$"],
6971
"indent": [2, 2, {"SwitchCase": 1}],
7072
"init-declarations": 0,
7173
"key-spacing": [2, {"beforeColon": false, "afterColon": true}],
74+
"keyword-spacing": 2,
7275
"linebreak-style": 2,
7376
"lines-around-comment": 0,
7477
"max-depth": 0,
@@ -100,7 +103,6 @@
100103
"no-else-return": 2,
101104
"no-empty": 2,
102105
"no-empty-character-class": 2,
103-
"no-empty-label": 2,
104106
"no-eq-null": 0,
105107
"no-eval": 2,
106108
"no-ex-assign": 2,
@@ -121,7 +123,7 @@
121123
"no-irregular-whitespace": 2,
122124
"no-iterator": 2,
123125
"no-label-var": 2,
124-
"no-labels": 0,
126+
"no-labels": [2, {"allowLoop": true}],
125127
"no-lone-blocks": 2,
126128
"no-lonely-if": 2,
127129
"no-loop-func": 0,
@@ -194,12 +196,10 @@
194196
"semi": [2, "always"],
195197
"semi-spacing": [2, {"before": false, "after": true}],
196198
"sort-vars": 0,
197-
"space-after-keywords": [2, "always"],
198199
"space-before-blocks": [2, "always"],
199200
"space-before-function-paren": [2, {"anonymous": "always", "named": "never"}],
200201
"space-in-parens": 0,
201202
"space-infix-ops": [2, {"int32Hint": false}],
202-
"space-return-throw-case": 2,
203203
"space-unary-ops": [2, {"words": true, "nonwords": false}],
204204
"spaced-comment": [2, "always"],
205205
"strict": 0,

.travis.yml

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,21 @@ after_success:
3232
- if [[ "$TRAVIS_JOB_NUMBER" == *.1 ]]; then cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js; fi
3333

3434
deploy:
35-
provider: npm
36-
37-
api_key:
38-
secure: tCIGE/3CLOQlC49i/9ug42ILQjZnMOrSjyjdHkqmTVN5q9p9bljjziXQbNxYfVPYa9icICnVnI4c5psjktW+vwaz2WJAJhpWD6P3YGcpmKjjgPKKHKWOcXvq3HdIzH7DIbXyVtE0QLpV5zgbyxglD96vYScO9dvGeAhTGY/9qJaDvVkLOZ+6YpKiTwZlZcyPHlD1tbxzd4NytJgIsi7CedFdfATAmOyVsot1NRZr5q3oV0aXFjJRnhBQ3RtykGgGHtXEWYTNhAmYxcIwezYRYXLxtlkbrlwxixpKAdJr/UXHg6amplkaHtCopi+QChPQRmdndcDC6F+e2nFHut6BCi14Jnbvf7seaqWrmh0uqdopqMJFRP3OBc9lXZf3hljVKV9+iVbWNjxoUB7ezurOOEpgkXleJ5AO2o3u8oYh3OFfLYu7E1a4uSjfe4nP/zi+th+wvS4Wy2UWqErYFUMotMyStS/vllXUpK7pl+Qt59MUVHB8YzREyCVKxakQ/uvNvY+bzKf4sM8UJ/Dqnl3MaAjLG3rWZbFyzXdaJnRGdTeFK2lpz8nrfJEDzLIQX5ZC88yR30WahrRjAhLnnq0V1fYp0wLbLxs4SdN+tuMRlkzQhQEYYDYa5osgEo2C+O4D/H9F7GWHHJp9zPE+hMi5+ZwTPKHkln4/AqrABUKOk78=
39-
on:
40-
tags: true
41-
branch: master
42-
condition: "$BUILD_LEADER$BUILD_AGGREGATE_STATUS = YESothers_succeeded"
35+
- provider: script
36+
skip_cleanup: true
37+
script: ./resources/npm-git.sh
38+
on:
39+
branch: master
40+
condition: "$BUILD_LEADER$BUILD_AGGREGATE_STATUS = YESothers_succeeded"
41+
- provider: npm
42+
43+
api_key:
44+
secure: tCIGE/3CLOQlC49i/9ug42ILQjZnMOrSjyjdHkqmTVN5q9p9bljjziXQbNxYfVPYa9icICnVnI4c5psjktW+vwaz2WJAJhpWD6P3YGcpmKjjgPKKHKWOcXvq3HdIzH7DIbXyVtE0QLpV5zgbyxglD96vYScO9dvGeAhTGY/9qJaDvVkLOZ+6YpKiTwZlZcyPHlD1tbxzd4NytJgIsi7CedFdfATAmOyVsot1NRZr5q3oV0aXFjJRnhBQ3RtykGgGHtXEWYTNhAmYxcIwezYRYXLxtlkbrlwxixpKAdJr/UXHg6amplkaHtCopi+QChPQRmdndcDC6F+e2nFHut6BCi14Jnbvf7seaqWrmh0uqdopqMJFRP3OBc9lXZf3hljVKV9+iVbWNjxoUB7ezurOOEpgkXleJ5AO2o3u8oYh3OFfLYu7E1a4uSjfe4nP/zi+th+wvS4Wy2UWqErYFUMotMyStS/vllXUpK7pl+Qt59MUVHB8YzREyCVKxakQ/uvNvY+bzKf4sM8UJ/Dqnl3MaAjLG3rWZbFyzXdaJnRGdTeFK2lpz8nrfJEDzLIQX5ZC88yR30WahrRjAhLnnq0V1fYp0wLbLxs4SdN+tuMRlkzQhQEYYDYa5osgEo2C+O4D/H9F7GWHHJp9zPE+hMi5+ZwTPKHkln4/AqrABUKOk78=
45+
on:
46+
tags: true
47+
branch: master
48+
condition: "$BUILD_LEADER$BUILD_AGGREGATE_STATUS = YESothers_succeeded"
49+
50+
env:
51+
global:
52+
secure: vs/YDHDlVY3apcWOWOyi01s2457uc19gfnZMWAc9RsTwaNrealbM7y2TTuakWj1eQQRU3hXvR4TFoqdJOKMk42avv4IxmCf0Gynf/4w8BFycfyLJwWfEvmBDYr4oMjjrX6t5ycTzACBXPGyi9Bpa1RJM2QIfujNtjtgaBTdrAQs5XZ+7l3giFhPLebWPnC0/CEhzZMKqiAID3z52SrR6RpxYDpQZcVuenXknIuG0WucbWd/XlHh6+upJxlc88pJsdNoDavDpQGcJZ5AUMD1ek8wsCo761lbPybryfeCN8qmMlTFkzRIpnGU28Q0RhqHuNq7tQJBPNIuc3MjTy5rR+7snvb1dXq9M3ut6D9UmsFvx3H2mNC4Ue8H2f2nS0Oy3HWY08v58gOvGpcKItndBsHmq9hPE3gK7Ea/UFH8GAtbXABhChO6dd7AY+CM7TOwfKyEx7y1kzBQ9snRpX9uEwGmRAXwRsvWeobtls/BevUfBGrBhgicd1BPhJzxeK447NHdELikgaCwldP3gdrrh1U7xmgaKO3MeM4Tpp+gMYUKoc/j6Pvcuq4/kNaiahnhW1SPUZJQmxIAnZjKOKmhm0WzmGC1RAvqvIVyqQa55CGuBr+fhWxWE2WB2tDcX5JSmwRASz9IOMd4mCxHM/maVlNaLfVYDQ2Fl1VHJ5MIES4s=

README.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ GraphQL, a query language created by Facebook for describing data requirements
55
on complex application data models.
66

77
[![npm version](https://badge.fury.io/js/graphql.svg)](http://badge.fury.io/js/graphql)
8-
[![Build Status](https://travis-ci.org/graphql/graphql-js.svg)](https://travis-ci.org/graphql/graphql-js)
8+
[![Build Status](https://travis-ci.org/graphql/graphql-js.svg?branch=master)](https://travis-ci.org/graphql/graphql-js?branch=master)
99
[![Coverage Status](https://coveralls.io/repos/graphql/graphql-js/badge.svg?branch=master)](https://coveralls.io/r/graphql/graphql-js?branch=master)
1010

1111
See more complete documentation at http://graphql.org/ and
@@ -89,8 +89,9 @@ var schema = new GraphQLSchema({
8989
```
9090

9191
This defines a simple schema with one type and one field, that resolves
92-
to a fixed value. A more complex example is included in the top level
93-
[tests](src/__tests__) directory.
92+
to a fixed value. The `resolve` function can return a value, a promise,
93+
or an array of promises. A more complex example is included in the top
94+
level [tests](src/__tests__) directory.
9495

9596
Then, serve the result of a query against that type schema.
9697

@@ -129,6 +130,18 @@ graphql(schema, query).then(result => {
129130
});
130131
```
131132

133+
### Want to ride the bleeding edge?
134+
135+
The `npm` branch in this repository is automatically maintained to be the last
136+
commit to `master` to pass all tests, in the same form found on npm. It is
137+
recommend to use builds deployed npm for many reasons, but if you want to use
138+
the latest not-yet-released version of graphql-js, you can do so by depending
139+
directly on this branch:
140+
141+
```
142+
npm install graphql@git://github.com/graphql/graphql-js.git#npm
143+
```
144+
132145
### Contributing
133146

134147
We actively welcome pull requests, learn how to

package.json

Lines changed: 41 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "graphql",
3-
"version": "0.4.18",
3+
"version": "0.5.0",
44
"description": "A Query Language and Runtime which can target any service.",
55
"contributors": [
66
"Lee Byron <[email protected]> (http://leebyron.com/)",
@@ -18,36 +18,56 @@
1818
"url": "http://github.com/graphql/graphql-js.git"
1919
},
2020
"options": {
21-
"mocha": "--require resources/mocha-bootload src/**/__tests__/**/*.js"
21+
"mocha": "--require ./resources/mocha-bootload --check-leaks --full-trace src/**/__tests__/**/*-test.js"
22+
},
23+
"babel": {
24+
"presets": [
25+
"es2015"
26+
],
27+
"plugins": [
28+
"syntax-async-functions",
29+
"transform-class-properties",
30+
"transform-flow-strip-types",
31+
"transform-object-rest-spread",
32+
"transform-regenerator",
33+
"transform-runtime"
34+
]
2235
},
2336
"scripts": {
2437
"test": "npm run lint && npm run check && npm run testonly",
25-
"testonly": "mocha $npm_package_options_mocha",
26-
"t": "mocha --require resources/mocha-bootload",
38+
"testonly": "babel-node ./node_modules/.bin/_mocha $npm_package_options_mocha",
39+
"t": "babel-node ./node_modules/.bin/_mocha --require ./resources/mocha-bootload",
2740
"lint": "eslint src",
2841
"check": "flow check",
29-
"build": "babel src --optional runtime --ignore __tests__ --out-dir dist/ && cp package.json dist/",
30-
"watch": "babel --optional runtime resources/watch.js | node",
31-
"cover": "babel-node node_modules/.bin/isparta cover --root src --report html node_modules/.bin/_mocha -- $npm_package_options_mocha",
32-
"cover:lcov": "babel-node node_modules/.bin/isparta cover --root src --report lcovonly node_modules/.bin/_mocha -- $npm_package_options_mocha",
42+
"check-cover": "for file in {src/*.js,src/**/*.js}; do echo $file; flow coverage $file; done",
43+
"build": "babel src --ignore __tests__ --out-dir dist/ && cp package.json dist/",
44+
"watch": "babel-node ./resources/watch.js",
45+
"cover": "babel-node ./node_modules/.bin/isparta cover --root src --report html _mocha -- $npm_package_options_mocha",
46+
"cover:lcov": "babel-node ./node_modules/.bin/isparta cover --root src --report lcovonly _mocha -- $npm_package_options_mocha",
3347
"preversion": ". ./resources/checkgit.sh && npm test",
3448
"prepublish": ". ./resources/prepublish.sh"
3549
},
3650
"dependencies": {
37-
"babel-runtime": "^5.8.x"
51+
"babel-runtime": ">=6.0.0"
3852
},
3953
"devDependencies": {
40-
"babel": "5.8.21",
41-
"babel-core": "5.8.22",
42-
"babel-eslint": "4.1.7",
43-
"chai": "3.4.1",
44-
"chai-subset": "1.1.0",
45-
"coveralls": "2.11.4",
46-
"eslint": "1.10.1",
47-
"eslint-plugin-babel": "^2.1.1",
48-
"flow-bin": "0.20.1",
49-
"isparta": "3.0.3",
50-
"mocha": "2.3.4",
51-
"sane": "1.3.0"
54+
"babel-cli": "6.6.5",
55+
"babel-eslint": "6.0.2",
56+
"babel-plugin-syntax-async-functions": "6.5.0",
57+
"babel-plugin-transform-class-properties": "6.6.0",
58+
"babel-plugin-transform-flow-strip-types": "6.7.0",
59+
"babel-plugin-transform-object-rest-spread": "6.6.5",
60+
"babel-plugin-transform-regenerator": "6.6.5",
61+
"babel-plugin-transform-runtime": "6.6.0",
62+
"babel-preset-es2015": "6.6.0",
63+
"chai": "3.5.0",
64+
"chai-subset": "1.2.2",
65+
"coveralls": "2.11.9",
66+
"eslint": "2.7.0",
67+
"eslint-plugin-babel": "3.2.0",
68+
"flow-bin": "0.22.1",
69+
"isparta": "4.0.0",
70+
"mocha": "2.4.5",
71+
"sane": "1.3.4"
5272
}
5373
}

resources/mocha-bootload.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@
77
* of patent rights can be found in the PATENTS file in the same directory.
88
*/
99

10-
require('babel/register')({
11-
optional: ['runtime', 'es7.asyncFunctions']
12-
});
13-
1410
var chai = require('chai');
1511

1612
var chaiSubset = require('chai-subset');

resources/npm-git.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/sh -e
2+
3+
# This script maintains a git branch which mirrors master but in a form that
4+
# what will eventually be deployed to npm, allowing npm dependencies to use:
5+
#
6+
# "graphql": "git://github.com/graphql/graphql-js.git#npm"
7+
#
8+
9+
./node_modules/.bin/babel src --ignore __tests__ --out-dir npm
10+
11+
# Ensure a vanilla package.json before deploying so other tools do not interpret
12+
# The built output as requiring any further transformation.
13+
node -e "var package = require('./package.json'); \
14+
delete package.babel; delete package.scripts; delete package.options; \
15+
require('fs').writeFileSync('./npm/package.json', JSON.stringify(package, null, 2));"
16+
17+
cp README.md npm/
18+
cp LICENSE npm/
19+
cp PATENTS npm/
20+
21+
cd npm
22+
git init
23+
git config user.name "Travis CI"
24+
git config user.email "[email protected]"
25+
git add .
26+
git commit -m "Deploy master to NPM branch"
27+
git push --force --quiet "https://${GH_TOKEN}@github.com/graphql/graphql-js.git" master:npm

resources/prepublish.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,10 @@ fi;
2121
#
2222
# var language = require('graphql/language');
2323
#
24-
babel --optional runtime src --ignore __tests__ --out-dir ./;
24+
babel src --ignore __tests__ --out-dir ./
25+
26+
# Ensure a vanilla package.json before deploying so other tools do not interpret
27+
# The built output as requiring any further transformation.
28+
node -e "var package = require('./package.json'); \
29+
delete package.babel; delete package.scripts; delete package.options; \
30+
require('fs').writeFileSync('package.json', JSON.stringify(package));"

resources/watch.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import flowBinPath from 'flow-bin';
1616
process.env.PATH += ':./node_modules/.bin';
1717

1818
var cmd = resolvePath(__dirname);
19-
var srcDir = resolvePath(cmd, './src');
19+
var srcDir = resolvePath(cmd, '../src');
2020

2121
function exec(command, options) {
2222
return new Promise((resolve, reject) => {
@@ -47,9 +47,9 @@ var watcher = sane(srcDir, { glob: ['**/*.js', '**/*.graphql'] })
4747
.on('change', changeFile);
4848

4949
process.on('SIGINT', () => {
50+
console.log(CLEARLINE + yellow(invert('stopped watching')));
5051
watcher.close();
5152
flowServer.kill();
52-
console.log(CLEARLINE + yellow(invert('stopped watching')));
5353
process.exit();
5454
});
5555

@@ -130,11 +130,14 @@ function parseFiles(filepaths) {
130130
function runTests(filepaths) {
131131
console.log('\nRunning Tests');
132132

133-
return exec('mocha', [
133+
return exec('babel-node', [
134+
'./node_modules/.bin/_mocha',
134135
'--reporter', 'progress',
135-
'--require', 'resources/mocha-bootload'
136+
'--require', './resources/mocha-bootload',
136137
].concat(
137-
allTests(filepaths) ? filepaths.map(srcPath) : ['src/**/__tests__/**/*.js']
138+
allTests(filepaths) ?
139+
filepaths.map(srcPath) :
140+
['src/**/__tests__/**/*-test.js']
138141
)).catch(() => false);
139142
}
140143

@@ -177,8 +180,10 @@ function allTests(filepaths) {
177180
return filepaths.length > 0 && filepaths.every(isTest);
178181
}
179182

183+
var TEST_PATH_RX = /^(?:.*?\/)?__tests__\/.+?-test\.js$/;
184+
180185
function isTest(filepath) {
181-
return isJS(filepath) && ~filepath.indexOf('__tests__/');
186+
return TEST_PATH_RX.test(filepath);
182187
}
183188

184189
// Print helpers

src/__tests__/starWarsIntrospectionTests.js renamed to src/__tests__/starWarsIntrospection-test.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ describe('Star Wars Introspection Tests', () => {
4040
name: 'Character'
4141
},
4242
{
43-
name: 'Human'
43+
name: 'String'
4444
},
4545
{
46-
name: 'String'
46+
name: 'Human'
4747
},
4848
{
4949
name: 'Droid'
@@ -71,6 +71,9 @@ describe('Star Wars Introspection Tests', () => {
7171
},
7272
{
7373
name: '__Directive'
74+
},
75+
{
76+
name: '__DirectiveLocation'
7477
}
7578
]
7679
}

src/__tests__/starWarsQueryTests.js renamed to src/__tests__/starWarsQuery-test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ describe('Star Wars Query Tests', () => {
181181
name: 'Luke Skywalker'
182182
}
183183
};
184-
const result = await graphql(StarWarsSchema, query, null, params);
184+
const result = await graphql(StarWarsSchema, query, null, null, params);
185185
expect(result).to.deep.equal({ data: expected });
186186
});
187187

@@ -201,7 +201,7 @@ describe('Star Wars Query Tests', () => {
201201
name: 'Han Solo'
202202
}
203203
};
204-
const result = await graphql(StarWarsSchema, query, null, params);
204+
const result = await graphql(StarWarsSchema, query, null, null, params);
205205
expect(result).to.deep.equal({ data: expected });
206206
});
207207

@@ -219,7 +219,7 @@ describe('Star Wars Query Tests', () => {
219219
const expected = {
220220
human: null
221221
};
222-
const result = await graphql(StarWarsSchema, query, null, params);
222+
const result = await graphql(StarWarsSchema, query, null, null, params);
223223
expect(result).to.deep.equal({ data: expected });
224224
});
225225
});

0 commit comments

Comments
 (0)