Skip to content

Commit

Permalink
Merge pull request #2 from graphql/master
Browse files Browse the repository at this point in the history
Merge latest changes from HEAD: 0.4.18 -> 0.5.0
  • Loading branch information
sogko committed Apr 15, 2016
2 parents 307511d + dd02973 commit d29694c
Show file tree
Hide file tree
Showing 98 changed files with 2,821 additions and 802 deletions.
12 changes: 6 additions & 6 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,11 @@

"rules": {
"babel/arrow-parens": [2, "as-needed"],
"babel/array-bracket-spacing": [2, "always"],
"babel/generator-star-spacing": [2, {"before": true, "after": false}],
"array-bracket-spacing": 0,
"generator-star-spacing": 0,

"array-bracket-spacing": [2, "always"],
"arrow-spacing": 2,
"block-scoped-var": 0,
"brace-style": [2, "1tbs", {"allowSingleLine": true}],
Expand All @@ -61,14 +64,14 @@
"eqeqeq": 2,
"func-names": 0,
"func-style": 0,
"generator-star-spacing": [0, {"before": true, "after": false}],
"guard-for-in": 2,
"handle-callback-err": [2, "error"],
"id-length": 0,
"id-match": [2, "^(?:_?[a-zA-Z0-9]*)|[_A-Z0-9]+$"],
"indent": [2, 2, {"SwitchCase": 1}],
"init-declarations": 0,
"key-spacing": [2, {"beforeColon": false, "afterColon": true}],
"keyword-spacing": 2,
"linebreak-style": 2,
"lines-around-comment": 0,
"max-depth": 0,
Expand Down Expand Up @@ -100,7 +103,6 @@
"no-else-return": 2,
"no-empty": 2,
"no-empty-character-class": 2,
"no-empty-label": 2,
"no-eq-null": 0,
"no-eval": 2,
"no-ex-assign": 2,
Expand All @@ -121,7 +123,7 @@
"no-irregular-whitespace": 2,
"no-iterator": 2,
"no-label-var": 2,
"no-labels": 0,
"no-labels": [2, {"allowLoop": true}],
"no-lone-blocks": 2,
"no-lonely-if": 2,
"no-loop-func": 0,
Expand Down Expand Up @@ -194,12 +196,10 @@
"semi": [2, "always"],
"semi-spacing": [2, {"before": false, "after": true}],
"sort-vars": 0,
"space-after-keywords": [2, "always"],
"space-before-blocks": [2, "always"],
"space-before-function-paren": [2, {"anonymous": "always", "named": "never"}],
"space-in-parens": 0,
"space-infix-ops": [2, {"int32Hint": false}],
"space-return-throw-case": 2,
"space-unary-ops": [2, {"words": true, "nonwords": false}],
"spaced-comment": [2, "always"],
"strict": 0,
Expand Down
26 changes: 18 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,21 @@ after_success:
- if [[ "$TRAVIS_JOB_NUMBER" == *.1 ]]; then cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js; fi

deploy:
provider: npm
email: "[email protected]"
api_key:
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=
on:
tags: true
branch: master
condition: "$BUILD_LEADER$BUILD_AGGREGATE_STATUS = YESothers_succeeded"
- provider: script
skip_cleanup: true
script: ./resources/npm-git.sh
on:
branch: master
condition: "$BUILD_LEADER$BUILD_AGGREGATE_STATUS = YESothers_succeeded"
- provider: npm
email: "[email protected]"
api_key:
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=
on:
tags: true
branch: master
condition: "$BUILD_LEADER$BUILD_AGGREGATE_STATUS = YESothers_succeeded"

env:
global:
secure: vs/YDHDlVY3apcWOWOyi01s2457uc19gfnZMWAc9RsTwaNrealbM7y2TTuakWj1eQQRU3hXvR4TFoqdJOKMk42avv4IxmCf0Gynf/4w8BFycfyLJwWfEvmBDYr4oMjjrX6t5ycTzACBXPGyi9Bpa1RJM2QIfujNtjtgaBTdrAQs5XZ+7l3giFhPLebWPnC0/CEhzZMKqiAID3z52SrR6RpxYDpQZcVuenXknIuG0WucbWd/XlHh6+upJxlc88pJsdNoDavDpQGcJZ5AUMD1ek8wsCo761lbPybryfeCN8qmMlTFkzRIpnGU28Q0RhqHuNq7tQJBPNIuc3MjTy5rR+7snvb1dXq9M3ut6D9UmsFvx3H2mNC4Ue8H2f2nS0Oy3HWY08v58gOvGpcKItndBsHmq9hPE3gK7Ea/UFH8GAtbXABhChO6dd7AY+CM7TOwfKyEx7y1kzBQ9snRpX9uEwGmRAXwRsvWeobtls/BevUfBGrBhgicd1BPhJzxeK447NHdELikgaCwldP3gdrrh1U7xmgaKO3MeM4Tpp+gMYUKoc/j6Pvcuq4/kNaiahnhW1SPUZJQmxIAnZjKOKmhm0WzmGC1RAvqvIVyqQa55CGuBr+fhWxWE2WB2tDcX5JSmwRASz9IOMd4mCxHM/maVlNaLfVYDQ2Fl1VHJ5MIES4s=
19 changes: 16 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ GraphQL, a query language created by Facebook for describing data requirements
on complex application data models.

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

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

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

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

Expand Down Expand Up @@ -129,6 +130,18 @@ graphql(schema, query).then(result => {
});
```

### Want to ride the bleeding edge?

The `npm` branch in this repository is automatically maintained to be the last
commit to `master` to pass all tests, in the same form found on npm. It is
recommend to use builds deployed npm for many reasons, but if you want to use
the latest not-yet-released version of graphql-js, you can do so by depending
directly on this branch:

```
npm install graphql@git://github.com/graphql/graphql-js.git#npm
```

### Contributing

We actively welcome pull requests, learn how to
Expand Down
62 changes: 41 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "graphql",
"version": "0.4.18",
"version": "0.5.0",
"description": "A Query Language and Runtime which can target any service.",
"contributors": [
"Lee Byron <[email protected]> (http://leebyron.com/)",
Expand All @@ -18,36 +18,56 @@
"url": "http://github.com/graphql/graphql-js.git"
},
"options": {
"mocha": "--require resources/mocha-bootload src/**/__tests__/**/*.js"
"mocha": "--require ./resources/mocha-bootload --check-leaks --full-trace src/**/__tests__/**/*-test.js"
},
"babel": {
"presets": [
"es2015"
],
"plugins": [
"syntax-async-functions",
"transform-class-properties",
"transform-flow-strip-types",
"transform-object-rest-spread",
"transform-regenerator",
"transform-runtime"
]
},
"scripts": {
"test": "npm run lint && npm run check && npm run testonly",
"testonly": "mocha $npm_package_options_mocha",
"t": "mocha --require resources/mocha-bootload",
"testonly": "babel-node ./node_modules/.bin/_mocha $npm_package_options_mocha",
"t": "babel-node ./node_modules/.bin/_mocha --require ./resources/mocha-bootload",
"lint": "eslint src",
"check": "flow check",
"build": "babel src --optional runtime --ignore __tests__ --out-dir dist/ && cp package.json dist/",
"watch": "babel --optional runtime resources/watch.js | node",
"cover": "babel-node node_modules/.bin/isparta cover --root src --report html node_modules/.bin/_mocha -- $npm_package_options_mocha",
"cover:lcov": "babel-node node_modules/.bin/isparta cover --root src --report lcovonly node_modules/.bin/_mocha -- $npm_package_options_mocha",
"check-cover": "for file in {src/*.js,src/**/*.js}; do echo $file; flow coverage $file; done",
"build": "babel src --ignore __tests__ --out-dir dist/ && cp package.json dist/",
"watch": "babel-node ./resources/watch.js",
"cover": "babel-node ./node_modules/.bin/isparta cover --root src --report html _mocha -- $npm_package_options_mocha",
"cover:lcov": "babel-node ./node_modules/.bin/isparta cover --root src --report lcovonly _mocha -- $npm_package_options_mocha",
"preversion": ". ./resources/checkgit.sh && npm test",
"prepublish": ". ./resources/prepublish.sh"
},
"dependencies": {
"babel-runtime": "^5.8.x"
"babel-runtime": ">=6.0.0"
},
"devDependencies": {
"babel": "5.8.21",
"babel-core": "5.8.22",
"babel-eslint": "4.1.7",
"chai": "3.4.1",
"chai-subset": "1.1.0",
"coveralls": "2.11.4",
"eslint": "1.10.1",
"eslint-plugin-babel": "^2.1.1",
"flow-bin": "0.20.1",
"isparta": "3.0.3",
"mocha": "2.3.4",
"sane": "1.3.0"
"babel-cli": "6.6.5",
"babel-eslint": "6.0.2",
"babel-plugin-syntax-async-functions": "6.5.0",
"babel-plugin-transform-class-properties": "6.6.0",
"babel-plugin-transform-flow-strip-types": "6.7.0",
"babel-plugin-transform-object-rest-spread": "6.6.5",
"babel-plugin-transform-regenerator": "6.6.5",
"babel-plugin-transform-runtime": "6.6.0",
"babel-preset-es2015": "6.6.0",
"chai": "3.5.0",
"chai-subset": "1.2.2",
"coveralls": "2.11.9",
"eslint": "2.7.0",
"eslint-plugin-babel": "3.2.0",
"flow-bin": "0.22.1",
"isparta": "4.0.0",
"mocha": "2.4.5",
"sane": "1.3.4"
}
}
4 changes: 0 additions & 4 deletions resources/mocha-bootload.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

require('babel/register')({
optional: ['runtime', 'es7.asyncFunctions']
});

var chai = require('chai');

var chaiSubset = require('chai-subset');
Expand Down
27 changes: 27 additions & 0 deletions resources/npm-git.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/sh -e

# This script maintains a git branch which mirrors master but in a form that
# what will eventually be deployed to npm, allowing npm dependencies to use:
#
# "graphql": "git://github.com/graphql/graphql-js.git#npm"
#

./node_modules/.bin/babel src --ignore __tests__ --out-dir npm

# Ensure a vanilla package.json before deploying so other tools do not interpret
# The built output as requiring any further transformation.
node -e "var package = require('./package.json'); \
delete package.babel; delete package.scripts; delete package.options; \
require('fs').writeFileSync('./npm/package.json', JSON.stringify(package, null, 2));"

cp README.md npm/
cp LICENSE npm/
cp PATENTS npm/

cd npm
git init
git config user.name "Travis CI"
git config user.email "[email protected]"
git add .
git commit -m "Deploy master to NPM branch"
git push --force --quiet "https://${GH_TOKEN}@github.com/graphql/graphql-js.git" master:npm
8 changes: 7 additions & 1 deletion resources/prepublish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,10 @@ fi;
#
# var language = require('graphql/language');
#
babel --optional runtime src --ignore __tests__ --out-dir ./;
babel src --ignore __tests__ --out-dir ./

# Ensure a vanilla package.json before deploying so other tools do not interpret
# The built output as requiring any further transformation.
node -e "var package = require('./package.json'); \
delete package.babel; delete package.scripts; delete package.options; \
require('fs').writeFileSync('package.json', JSON.stringify(package));"
17 changes: 11 additions & 6 deletions resources/watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import flowBinPath from 'flow-bin';
process.env.PATH += ':./node_modules/.bin';

var cmd = resolvePath(__dirname);
var srcDir = resolvePath(cmd, './src');
var srcDir = resolvePath(cmd, '../src');

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

process.on('SIGINT', () => {
console.log(CLEARLINE + yellow(invert('stopped watching')));
watcher.close();
flowServer.kill();
console.log(CLEARLINE + yellow(invert('stopped watching')));
process.exit();
});

Expand Down Expand Up @@ -130,11 +130,14 @@ function parseFiles(filepaths) {
function runTests(filepaths) {
console.log('\nRunning Tests');

return exec('mocha', [
return exec('babel-node', [
'./node_modules/.bin/_mocha',
'--reporter', 'progress',
'--require', 'resources/mocha-bootload'
'--require', './resources/mocha-bootload',
].concat(
allTests(filepaths) ? filepaths.map(srcPath) : ['src/**/__tests__/**/*.js']
allTests(filepaths) ?
filepaths.map(srcPath) :
['src/**/__tests__/**/*-test.js']
)).catch(() => false);
}

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

var TEST_PATH_RX = /^(?:.*?\/)?__tests__\/.+?-test\.js$/;

function isTest(filepath) {
return isJS(filepath) && ~filepath.indexOf('__tests__/');
return TEST_PATH_RX.test(filepath);
}

// Print helpers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ describe('Star Wars Introspection Tests', () => {
name: 'Character'
},
{
name: 'Human'
name: 'String'
},
{
name: 'String'
name: 'Human'
},
{
name: 'Droid'
Expand Down Expand Up @@ -71,6 +71,9 @@ describe('Star Wars Introspection Tests', () => {
},
{
name: '__Directive'
},
{
name: '__DirectiveLocation'
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ describe('Star Wars Query Tests', () => {
name: 'Luke Skywalker'
}
};
const result = await graphql(StarWarsSchema, query, null, params);
const result = await graphql(StarWarsSchema, query, null, null, params);
expect(result).to.deep.equal({ data: expected });
});

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

Expand All @@ -219,7 +219,7 @@ describe('Star Wars Query Tests', () => {
const expected = {
human: null
};
const result = await graphql(StarWarsSchema, query, null, params);
const result = await graphql(StarWarsSchema, query, null, null, params);
expect(result).to.deep.equal({ data: expected });
});
});
Expand Down
3 changes: 2 additions & 1 deletion src/__tests__/starWarsSchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,5 +270,6 @@ const queryType = new GraphQLObjectType({
* type we defined above) and export it.
*/
export const StarWarsSchema = new GraphQLSchema({
query: queryType
query: queryType,
types: [ humanType, droidType ]
});
File renamed without changes.
Loading

0 comments on commit d29694c

Please sign in to comment.