Skip to content

Commit

Permalink
Merge pull request #276 from DxCx/remove-babel
Browse files Browse the repository at this point in the history
Remove babel
  • Loading branch information
helfer authored Jan 25, 2017
2 parents 64b87c7 + 571bba5 commit 0389b4a
Show file tree
Hide file tree
Showing 15 changed files with 30 additions and 35 deletions.
3 changes: 0 additions & 3 deletions .babelrc

This file was deleted.

11 changes: 4 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,20 @@
"pretest": "npm run compile",
"test": "npm run testonly --",
"posttest": "npm run lint",
"testonly": "mocha --compilers js:babel-core/register --reporter spec --full-trace --timeout 5000 ./test/tests.js",
"coverage": "istanbul cover -x \"*.test.js\" _mocha -- --timeout 5000 --compilers js:babel-core/register --full-trace --reporter dot ./test/tests.js",
"testonly": "mocha --reporter spec --full-trace --timeout 5000 ./test/tests.js",
"coverage": "istanbul cover -x \"*.test.js\" _mocha -- --timeout 5000 --full-trace --reporter dot ./test/tests.js",
"pretravis": "npm run compile",
"travis": "istanbul cover -x \"*.test.js\" _mocha -- --timeout 5000 --compilers js:babel-core/register --full-trace ./test/tests.js",
"travis": "istanbul cover -x \"*.test.js\" _mocha -- --timeout 5000 --full-trace ./test/tests.js",
"posttravis": "npm run lint",
"postcoverage": "remap-istanbul --input coverage/coverage.raw.json --type lcovonly --output coverage/lcov.info",
"check-updates": "lerna exec ./node_modules/.bin/npm-check-updates -- -u"
},
"devDependencies": {
"@types/chai": "^3.4.34",
"@types/es6-shim": "^0.31.32",
"@types/mocha": "^2.2.38",
"@types/node": "^7.0.3",
"@types/sinon": "^1.16.34",
"babel-cli": "^6.22.2",
"babel-core": "^6.22.1",
"babel-polyfill": "^6.22.0",
"babel-preset-es2015": "^6.22.0",
"chai": "^3.5.0",
"graphql": "^0.9.0",
"istanbul": "1.0.0-alpha.2",
Expand Down
4 changes: 3 additions & 1 deletion packages/graphql-server-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
"url": "https://github.com/apollostack/graphql-server/issues"
},
"homepage": "https://github.com/apollostack/graphql-server#readme",
"dependencies": {},
"dependencies": {
"es6-shim": "^0.35.3"
},
"devDependencies": {
"@types/fibers": "0.0.29",
"@types/graphql": "^0.8.5",
Expand Down
5 changes: 3 additions & 2 deletions packages/graphql-server-core/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "es6",
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
Expand All @@ -15,7 +15,8 @@
"node_modules/@types"
],
"types": [
"@types/node"
"@types/node",
"@types/es6-shim"
]
},
"exclude": [
Expand Down
2 changes: 1 addition & 1 deletion packages/graphql-server-express/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "es6",
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/graphql-server-hapi/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "es6",
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "es6",
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/graphql-server-koa/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "es6",
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/graphql-server-module-graphiql/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "es6",
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
Expand Down
4 changes: 3 additions & 1 deletion packages/graphql-server-module-operation-store/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
"url": "https://github.com/apollostack/graphql-server/issues"
},
"homepage": "https://github.com/apollostack/graphql-server#readme",
"dependencies": {},
"dependencies": {
"es6-shim": "^0.35.3"
},
"peerDependencies": {
"graphql": "^0.6.1 || ^0.7.0 || ^0.8.0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ describe('operationStore', () => {
`;

const store = new OperationStore(schema);
return expect(() => store.put(query)).to.throw(/operationDefinition must contain only one definition/);
return expect(() => store.put(query)).to.throw(/OperationDefinitionNode must contain only one definition/);
});

it('throws an error if there is no operationDefinition found', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ import {
validate,
DocumentNode,
GraphQLSchema,
OperationDefinition,
OperationDefinitionNode,
Kind,
} from 'graphql';

const OPERATION_DEFINITION: string = 'OperationDefinition';

export class OperationStore {
private storedOperations: Map<string, DocumentNode>;
private schema: GraphQLSchema;
Expand All @@ -18,8 +17,8 @@ export class OperationStore {
}

public put(operation: string | DocumentNode): void {
function isOperationDefinition(definition): definition is OperationDefinition {
return definition.kind === OPERATION_DEFINITION;
function isOperationDefinition(definition): definition is OperationDefinitionNode {
return definition.kind === Kind.OPERATION_DEFINITION;
}

function isString(definition): definition is string {
Expand All @@ -28,12 +27,12 @@ export class OperationStore {

const ast = isString(operation) ? parse(operation as string) : operation as DocumentNode;

const definitions = ast.definitions.filter(isOperationDefinition) as OperationDefinition[];
const definitions = ast.definitions.filter(isOperationDefinition) as OperationDefinitionNode[];
if (definitions.length === 0) {
throw new Error('operationDefinition must contain at least one definition');
throw new Error('OperationDefinitionNode must contain at least one definition');
}
if (definitions.length > 1) {
throw new Error('operationDefinition must contain only one definition');
throw new Error('OperationDefinitionNode must contain only one definition');
}

const validationErrors = validate(this.schema, ast);
Expand Down
5 changes: 3 additions & 2 deletions packages/graphql-server-module-operation-store/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "es6",
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
Expand All @@ -15,7 +15,8 @@
"node_modules/@types"
],
"types": [
"@types/node"
"@types/node",
"@types/es6-shim"
]
},
"exclude": [
Expand Down
2 changes: 1 addition & 1 deletion packages/graphql-server-restify/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "es6",
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
Expand Down
4 changes: 0 additions & 4 deletions test/tests.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
/* tslint:disable */
require('babel-polyfill');

process.env.NODE_ENV = 'test';

require('source-map-support').install();
require('../packages/graphql-server-core/dist/runQuery.test.js');
require('../packages/graphql-server-module-operation-store/dist/operationStore.test');
require('../packages/graphql-server-express/dist/expressApollo.test');
Expand Down

0 comments on commit 0389b4a

Please sign in to comment.