diff --git a/.npmignore b/.npmignore deleted file mode 100644 index 1bf5f567772..00000000000 --- a/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -src -test -coverage -resources diff --git a/lerna.json b/lerna.json new file mode 100644 index 00000000000..efc97ce2fae --- /dev/null +++ b/lerna.json @@ -0,0 +1,16 @@ +{ + "lerna": "2.0.0-beta.29", + "version": "0.3.2", + "changelog": { + "repo": "apollostack/apollo-server", + "labels": { + "tag: spec compliancy": ":eyeglasses: Spec Compliancy", + "tag: breaking change": ":boom: Breaking Change", + "tag: new feature": ":rocket: New Feature", + "tag: bug fix": ":bug: Bug Fix", + "tag: polish": ":nail_care: Polish", + "tag: documentation": "Documentation", + "tag: internal": ":house: Internal" + } + } +} diff --git a/package.json b/package.json index cbdc30252ef..a5a0f2b890b 100644 --- a/package.json +++ b/package.json @@ -1,98 +1,41 @@ { - "name": "apollo-server", - "version": "0.3.2", - "description": "Production-ready Node.js GraphQL server for Express, Hapi, Koa", - "main": "dist/index.js", - "directories": { - "test": "test" + "private": true, + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/apollostack/apollo-server.git" }, "scripts": { - "compile": "tsc", - "typings": "typings install", + "compile": "lerna exec -- npm run compile", + "lint": "tslint ./packages/**/src/**/*.ts", + "prebootstrap": "npm install", + "bootstrap": "lerna bootstrap", "pretest": "npm run compile", "test": "npm run testonly --", "posttest": "npm run lint", - "lint": "tslint ./src/**/*.ts", - "watch": "tsc -w", - "testonly": "mocha --compilers js:babel-core/register --reporter spec --full-trace ./dist/test/tests.js", - "coverage": "babel-node ./node_modules/istanbul/lib/cli.js cover _mocha -- --full-trace ./dist/test/tests.js", + "testonly": "mocha --compilers js:babel-core/register --reporter spec --full-trace ./test/tests.js", + "coverage": "babel-node ./node_modules/istanbul/lib/cli.js cover _mocha -- --full-trace ./test/tests.js", "postcoverage": "remap-istanbul --input coverage/coverage.raw.json --type lcovonly --output coverage/lcov.info" }, - "repository": { - "type": "git", - "url": "git+https://github.com/apollostack/apollo-server.git" - }, - "keywords": [ - "GraphQL", - "Apollo", - "Hapi", - "Koa", - "Express", - "Javascript" - ], - "author": "Jonas Helfer ", - "license": "MIT", - "bugs": { - "url": "https://github.com/apollostack/apollo-proxy/issues" - }, - "homepage": "https://github.com/apollostack/apollo-proxy#readme", - "dependencies": { - "@types/body-parser": "0.0.33", - "@types/boom": "0.0.32", - "@types/chai": "^3.4.34", - "@types/connect": "^3.4.30", - "@types/cookies": "^0.5.30", - "@types/express": "^4.0.33", - "@types/express-serve-static-core": "^4.0.36", - "@types/fibers": "0.0.29", - "@types/hapi": "^13.0.35", - "@types/http-errors": "^1.3.29", - "@types/koa": "^2.0.33", - "@types/koa-bodyparser": "^3.0.19", - "@types/koa-router": "^7.0.21", - "@types/mime": "0.0.29", - "@types/multer": "0.0.32", - "@types/node": "^6.0.41", - "@types/serve-static": "^1.7.31", - "boom": "^4.0.0", - "http-errors": "^1.5.0", - "source-map-support": "^0.4.2", - "typed-graphql": "^1.0.2" - }, "devDependencies": { + "@types/chai": "^3.4.34", "@types/mocha": "^2.2.32", + "@types/node": "^6.0.42", "@types/sinon": "^1.16.31", "babel-cli": "^6.11.4", "babel-core": "^6.11.4", "babel-polyfill": "^6.9.1", "babel-preset-es2015": "^6.9.0", - "body-parser": "^1.15.2", "chai": "^3.5.0", - "connect": "^3.4.1", - "express": "^4.14.0", - "fibers": "^1.0.13", "graphql": "^0.7.0", - "hapi": "^15.0.3", "istanbul": "1.0.0-alpha.2", - "koa": "^2.0.0-alpha.4", - "koa-bodyparser": "^3.0.0", - "koa-router": "^7.0.1", - "meteor-promise": "^0.7.3", + "lerna": "^2.0.0-beta.29", "mocha": "^3.0.0", - "multer": "^1.1.0", "remap-istanbul": "^0.6.4", - "sinon": "^1.17.5", + "sinon": "^1.17.6", "supertest": "^2.0.0", "supertest-as-promised": "^4.0.0", "tslint": "^3.13.0", - "typescript": "^2.0.3", - "typings": "^1.3.2" - }, - "peerDependencies": { - "graphql": "^0.6.1 || ^0.7.0" - }, - "typings": "dist/index.d.ts", - "typescript": { - "definition": "dist/index.d.ts" + "typescript": "^2.0.3" } } diff --git a/packages/apollo-server-core/.npmignore b/packages/apollo-server-core/.npmignore new file mode 100644 index 00000000000..063364e2b5d --- /dev/null +++ b/packages/apollo-server-core/.npmignore @@ -0,0 +1,5 @@ +* +!dist +!dist/**/* +dist/**/*.test.* +!package.json diff --git a/packages/apollo-server-core/package.json b/packages/apollo-server-core/package.json new file mode 100644 index 00000000000..f10242da39f --- /dev/null +++ b/packages/apollo-server-core/package.json @@ -0,0 +1,41 @@ +{ + "name": "apollo-server-core", + "version": "0.3.2", + "description": "Core engine ffor Apollo GraphQL server", + "main": "dist/index.js", + "scripts": { + "compile": "tsc", + "prepublish": "npm run compile" + }, + "repository": { + "type": "git", + "url": "https://github.com/apollostack/apollo-server/tree/master/packages/apollo-server-core" + }, + "keywords": [ + "GraphQL", + "Apollo", + "Server", + "Javascript" + ], + "author": "Jonas Helfer ", + "license": "MIT", + "bugs": { + "url": "https://github.com/apollostack/apollo-server/issues" + }, + "homepage": "https://github.com/apollostack/apollo-server#readme", + "dependencies": { + "typed-graphql": "^1.0.2" + }, + "devDependencies": { + "@types/fibers": "0.0.29", + "fibers": "^1.0.13", + "meteor-promise": "^0.7.3" + }, + "peerDependencies": { + "graphql": "^0.6.1 || ^0.7.0" + }, + "typings": "dist/index.d.ts", + "typescript": { + "definition": "dist/index.d.ts" + } +} diff --git a/src/integrations/apolloOptions.ts b/packages/apollo-server-core/src/apolloOptions.ts similarity index 95% rename from src/integrations/apolloOptions.ts rename to packages/apollo-server-core/src/apolloOptions.ts index f51643603a2..ab83d1bf24b 100644 --- a/src/integrations/apolloOptions.ts +++ b/packages/apollo-server-core/src/apolloOptions.ts @@ -1,5 +1,5 @@ import { GraphQLSchema, ValidationRule } from 'graphql'; -import { LogFunction } from '../core/runQuery'; +import { LogFunction } from './runQuery'; /* * ExpressApolloOptions diff --git a/packages/apollo-server-core/src/index.ts b/packages/apollo-server-core/src/index.ts new file mode 100644 index 00000000000..2827b717e9b --- /dev/null +++ b/packages/apollo-server-core/src/index.ts @@ -0,0 +1,2 @@ +export { runQuery, LogFunction, LogMessage, LogStep, LogAction } from './runQuery' +export { default as ApolloOptions} from './apolloOptions' diff --git a/src/core/runQuery.test.ts b/packages/apollo-server-core/src/runQuery.test.ts similarity index 99% rename from src/core/runQuery.test.ts rename to packages/apollo-server-core/src/runQuery.test.ts index da1620d949f..d227a0ddbce 100644 --- a/src/core/runQuery.test.ts +++ b/packages/apollo-server-core/src/runQuery.test.ts @@ -1,5 +1,6 @@ import { expect } from 'chai'; import { stub } from 'sinon'; +import 'mocha'; import { GraphQLSchema, diff --git a/src/core/runQuery.ts b/packages/apollo-server-core/src/runQuery.ts similarity index 100% rename from src/core/runQuery.ts rename to packages/apollo-server-core/src/runQuery.ts diff --git a/packages/apollo-server-core/tsconfig.json b/packages/apollo-server-core/tsconfig.json new file mode 100644 index 00000000000..400efae72bf --- /dev/null +++ b/packages/apollo-server-core/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "target": "es6", + "module": "commonjs", + "moduleResolution": "node", + "sourceMap": true, + "declaration": true, + "noImplicitAny": false, + "rootDir": "./src", + "outDir": "./dist", + "allowSyntheticDefaultImports": false, + "pretty": true, + "removeComments": true, + "typeRoots": [ + "node_modules/@types" + ], + "types": [ + "typed-graphql", + "@types/node" + ] + }, + "exclude": [ + "node_modules", + "dist" + ] +} diff --git a/packages/apollo-server-express/.npmignore b/packages/apollo-server-express/.npmignore new file mode 100644 index 00000000000..063364e2b5d --- /dev/null +++ b/packages/apollo-server-express/.npmignore @@ -0,0 +1,5 @@ +* +!dist +!dist/**/* +dist/**/*.test.* +!package.json diff --git a/packages/apollo-server-express/package.json b/packages/apollo-server-express/package.json new file mode 100644 index 00000000000..dee7578db06 --- /dev/null +++ b/packages/apollo-server-express/package.json @@ -0,0 +1,51 @@ +{ + "name": "apollo-server-express", + "version": "0.3.2", + "description": "Production-ready Node.js GraphQL server for Express, Connect", + "main": "dist/index.js", + "scripts": { + "compile": "tsc", + "prepublish": "npm run compile" + }, + "repository": { + "type": "git", + "url": "https://github.com/apollostack/apollo-server/tree/master/packages/apollo-server-express" + }, + "keywords": [ + "GraphQL", + "Apollo", + "Server", + "Express", + "Connect", + "Javascript" + ], + "author": "Jonas Helfer ", + "license": "MIT", + "bugs": { + "url": "https://github.com/apollostack/apollo-server/issues" + }, + "homepage": "https://github.com/apollostack/apollo-server#readme", + "dependencies": { + "@types/express": "^4.0.33", + "apollo-server-core": "^0.3.2", + "apollo-server-graphiql": "^0.3.2" + }, + "devDependencies": { + "@types/body-parser": "0.0.33", + "@types/connect": "^3.4.30", + "@types/multer": "0.0.32", + "apollo-server-integration-testsuite": "^0.3.2", + "body-parser": "^1.15.2", + "connect": "^3.4.1", + "express": "^4.14.0", + "multer": "^1.2.0", + "typed-graphql": "^1.0.2" + }, + "peerDependencies": { + "graphql": "^0.6.1 || ^0.7.0" + }, + "typings": "dist/index.d.ts", + "typescript": { + "definition": "dist/index.d.ts" + } +} diff --git a/src/test/testApolloServerHTTP.ts b/packages/apollo-server-express/src/apolloServerHttp.test.ts similarity index 99% rename from src/test/testApolloServerHTTP.ts rename to packages/apollo-server-express/src/apolloServerHttp.test.ts index 7c2f0f0c9fb..efd4755adaf 100644 --- a/src/test/testApolloServerHTTP.ts +++ b/packages/apollo-server-express/src/apolloServerHttp.test.ts @@ -10,7 +10,7 @@ * sure apolloServer still works if used in the place of express-graphql. */ -import { apolloExpress } from '../integrations/expressApollo'; +import { apolloExpress } from './expressApollo'; /** * Copyright (c) 2015, Facebook, Inc. @@ -108,7 +108,6 @@ function promiseTo(fn) { }); } - describe('test harness', () => { it('expects to catch errors', async () => { diff --git a/src/integrations/connectApollo.test.ts b/packages/apollo-server-express/src/connectApollo.test.ts similarity index 85% rename from src/integrations/connectApollo.test.ts rename to packages/apollo-server-express/src/connectApollo.test.ts index a901ed32f74..b9db82941ec 100644 --- a/src/integrations/connectApollo.test.ts +++ b/packages/apollo-server-express/src/connectApollo.test.ts @@ -1,8 +1,9 @@ import * as connect from 'connect'; import * as bodyParser from 'body-parser'; import { apolloConnect, graphiqlConnect } from './connectApollo'; +import 'mocha'; -import testSuite, { Schema, CreateAppOptions } from './integrations.test'; +import testSuite, { Schema, CreateAppOptions } from 'apollo-server-integration-testsuite'; function createConnectApp(options: CreateAppOptions = {}) { const app = connect(); diff --git a/src/integrations/connectApollo.ts b/packages/apollo-server-express/src/connectApollo.ts similarity index 100% rename from src/integrations/connectApollo.ts rename to packages/apollo-server-express/src/connectApollo.ts diff --git a/src/integrations/expressApollo.test.ts b/packages/apollo-server-express/src/expressApollo.test.ts similarity index 87% rename from src/integrations/expressApollo.test.ts rename to packages/apollo-server-express/src/expressApollo.test.ts index 4d6ed0b0a79..c45afd577cf 100644 --- a/src/integrations/expressApollo.test.ts +++ b/packages/apollo-server-express/src/expressApollo.test.ts @@ -1,9 +1,10 @@ import * as express from 'express'; import * as bodyParser from 'body-parser'; import { apolloExpress, graphiqlExpress } from './expressApollo'; -import testSuite, { Schema, CreateAppOptions } from './integrations.test'; +import testSuite, { Schema, CreateAppOptions } from 'apollo-server-integration-testsuite'; import { expect } from 'chai'; -import ApolloOptions from './apolloOptions'; +import { ApolloOptions } from 'apollo-server-core'; +import 'mocha'; function createApp(options: CreateAppOptions = {}) { const app = express(); diff --git a/src/integrations/expressApollo.ts b/packages/apollo-server-express/src/expressApollo.ts similarity index 97% rename from src/integrations/expressApollo.ts rename to packages/apollo-server-express/src/expressApollo.ts index f172fb3e84b..1acd530cb4c 100644 --- a/src/integrations/expressApollo.ts +++ b/packages/apollo-server-express/src/expressApollo.ts @@ -1,10 +1,8 @@ import * as express from 'express'; import * as graphql from 'graphql'; import * as url from 'url'; -import { runQuery } from '../core/runQuery'; - -import ApolloOptions from './apolloOptions'; -import * as GraphiQL from '../modules/renderGraphiQL'; +import { ApolloOptions, runQuery } from 'apollo-server-core'; +import * as GraphiQL from 'apollo-server-graphiql'; export interface ExpressApolloOptionsFunction { (req?: express.Request, res?: express.Response): ApolloOptions | Promise; @@ -149,7 +147,6 @@ export function graphiqlExpress(options: GraphiQL.GraphiQLData) { const variables = q.variables || '{}'; const operationName = q.operationName || ''; - const graphiQLString = GraphiQL.renderGraphiQL({ endpointURL: options.endpointURL, query: query || options.query, diff --git a/packages/apollo-server-express/src/index.ts b/packages/apollo-server-express/src/index.ts new file mode 100644 index 00000000000..c56ccc6cf99 --- /dev/null +++ b/packages/apollo-server-express/src/index.ts @@ -0,0 +1,2 @@ +export { ExpressApolloOptionsFunction, ExpressHandler, apolloExpress, graphiqlExpress } from './expressApollo'; +export { apolloConnect, graphiqlConnect } from './connectApollo'; diff --git a/packages/apollo-server-express/tsconfig.json b/packages/apollo-server-express/tsconfig.json new file mode 100644 index 00000000000..400efae72bf --- /dev/null +++ b/packages/apollo-server-express/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "target": "es6", + "module": "commonjs", + "moduleResolution": "node", + "sourceMap": true, + "declaration": true, + "noImplicitAny": false, + "rootDir": "./src", + "outDir": "./dist", + "allowSyntheticDefaultImports": false, + "pretty": true, + "removeComments": true, + "typeRoots": [ + "node_modules/@types" + ], + "types": [ + "typed-graphql", + "@types/node" + ] + }, + "exclude": [ + "node_modules", + "dist" + ] +} diff --git a/packages/apollo-server-graphiql/.npmignore b/packages/apollo-server-graphiql/.npmignore new file mode 100644 index 00000000000..063364e2b5d --- /dev/null +++ b/packages/apollo-server-graphiql/.npmignore @@ -0,0 +1,5 @@ +* +!dist +!dist/**/* +dist/**/*.test.* +!package.json diff --git a/packages/apollo-server-graphiql/package.json b/packages/apollo-server-graphiql/package.json new file mode 100644 index 00000000000..7e878fb8efa --- /dev/null +++ b/packages/apollo-server-graphiql/package.json @@ -0,0 +1,32 @@ +{ + "name": "apollo-server-graphiql", + "version": "0.3.2", + "description": "GraphiQL renderer for Apollo GraphQL Server", + "main": "dist/index.js", + "scripts": { + "compile": "tsc", + "prepublish": "npm run compile" + }, + "repository": { + "type": "git", + "url": "https://github.com/apollostack/apollo-server/tree/master/packages/apollo-server-graphiql" + }, + "keywords": [ + "GraphQL", + "GraphiQL", + "Apollo", + "Javascript" + ], + "author": "Jonas Helfer ", + "license": "MIT", + "bugs": { + "url": "https://github.com/apollostack/apollo-server/issues" + }, + "homepage": "https://github.com/apollostack/apollo-server#readme", + "dependencies": {}, + "devDependencies": {}, + "typings": "dist/index.d.ts", + "typescript": { + "definition": "dist/index.d.ts" + } +} diff --git a/packages/apollo-server-graphiql/src/index.ts b/packages/apollo-server-graphiql/src/index.ts new file mode 100644 index 00000000000..2e958191e92 --- /dev/null +++ b/packages/apollo-server-graphiql/src/index.ts @@ -0,0 +1 @@ +export { GraphiQLData, renderGraphiQL } from './renderGraphiQL'; diff --git a/src/modules/renderGraphiQL.ts b/packages/apollo-server-graphiql/src/renderGraphiQL.ts similarity index 100% rename from src/modules/renderGraphiQL.ts rename to packages/apollo-server-graphiql/src/renderGraphiQL.ts diff --git a/tsconfig.json b/packages/apollo-server-graphiql/tsconfig.json similarity index 64% rename from tsconfig.json rename to packages/apollo-server-graphiql/tsconfig.json index 877ec8b8426..1107d54506b 100644 --- a/tsconfig.json +++ b/packages/apollo-server-graphiql/tsconfig.json @@ -8,9 +8,15 @@ "noImplicitAny": false, "rootDir": "./src", "outDir": "./dist", - "allowSyntheticDefaultImports": true, + "allowSyntheticDefaultImports": false, "pretty": true, - "removeComments": true + "removeComments": true, + "typeRoots": [ + "node_modules/@types" + ], + "types": [ + "@types/node" + ] }, "exclude": [ "node_modules", diff --git a/packages/apollo-server-hapi/.npmignore b/packages/apollo-server-hapi/.npmignore new file mode 100644 index 00000000000..063364e2b5d --- /dev/null +++ b/packages/apollo-server-hapi/.npmignore @@ -0,0 +1,5 @@ +* +!dist +!dist/**/* +dist/**/*.test.* +!package.json diff --git a/packages/apollo-server-hapi/package.json b/packages/apollo-server-hapi/package.json new file mode 100644 index 00000000000..f0550491d6d --- /dev/null +++ b/packages/apollo-server-hapi/package.json @@ -0,0 +1,46 @@ +{ + "name": "apollo-server-hapi", + "version": "0.3.2", + "description": "Production-ready Node.js GraphQL server for Hapi", + "main": "dist/index.js", + "scripts": { + "compile": "tsc", + "prepublish": "npm run compile" + }, + "repository": { + "type": "git", + "url": "https://github.com/apollostack/apollo-server/tree/master/packages/apollo-server-hapi" + }, + "keywords": [ + "GraphQL", + "Apollo", + "Hapi", + "Server", + "Javascript" + ], + "author": "Jonas Helfer ", + "license": "MIT", + "bugs": { + "url": "https://github.com/apollostack/apollo-server/issues" + }, + "homepage": "https://github.com/apollostack/apollo-server#readme", + "dependencies": { + "@types/hapi": "^13.0.35", + "apollo-server-core": "^0.3.2", + "apollo-server-graphiql": "^0.3.2", + "boom": "^4.0.0", + "typed-graphql": "^1.0.2" + }, + "devDependencies": { + "@types/boom": "0.0.32", + "apollo-server-integration-testsuite": "^0.3.2", + "hapi": "^15.0.3" + }, + "peerDependencies": { + "graphql": "^0.6.1 || ^0.7.0" + }, + "typings": "dist/index.d.ts", + "typescript": { + "definition": "dist/index.d.ts" + } +} diff --git a/src/integrations/hapiApollo.test.ts b/packages/apollo-server-hapi/src/hapiApollo.test.ts similarity index 89% rename from src/integrations/hapiApollo.test.ts rename to packages/apollo-server-hapi/src/hapiApollo.test.ts index 15ff92058eb..29f99a38ebf 100644 --- a/src/integrations/hapiApollo.test.ts +++ b/packages/apollo-server-hapi/src/hapiApollo.test.ts @@ -1,7 +1,8 @@ import * as hapi from 'hapi'; import { apolloHapi, graphiqlHapi, HapiPluginOptions } from './hapiApollo'; +import 'mocha'; -import testSuite, { Schema } from './integrations.test'; +import testSuite, { Schema } from 'apollo-server-integration-testsuite'; function createApp(createOptions: HapiPluginOptions) { const server = new hapi.Server(); diff --git a/src/integrations/hapiApollo.ts b/packages/apollo-server-hapi/src/hapiApollo.ts similarity index 97% rename from src/integrations/hapiApollo.ts rename to packages/apollo-server-hapi/src/hapiApollo.ts index 353d605910b..c86aec9276f 100644 --- a/src/integrations/hapiApollo.ts +++ b/packages/apollo-server-hapi/src/hapiApollo.ts @@ -1,10 +1,8 @@ import * as Boom from 'boom'; import { Server, Request, IReply } from 'hapi'; import { GraphQLResult, formatError } from 'graphql'; -import * as GraphiQL from '../modules/renderGraphiQL'; -import { runQuery } from '../core/runQuery'; -import ApolloOptions from './apolloOptions'; - +import * as GraphiQL from 'apollo-server-graphiql'; +import { ApolloOptions, runQuery } from 'apollo-server-core'; export interface IRegister { (server: Server, options: any, next: any): void; diff --git a/packages/apollo-server-hapi/src/index.ts b/packages/apollo-server-hapi/src/index.ts new file mode 100644 index 00000000000..10051fa42df --- /dev/null +++ b/packages/apollo-server-hapi/src/index.ts @@ -0,0 +1,5 @@ +export { IRegister, + HapiOptionsFunction, + HapiPluginOptions, + GraphiQLPluginOptions, + apolloHapi, graphiqlHapi } from './hapiApollo'; diff --git a/packages/apollo-server-hapi/tsconfig.json b/packages/apollo-server-hapi/tsconfig.json new file mode 100644 index 00000000000..400efae72bf --- /dev/null +++ b/packages/apollo-server-hapi/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "target": "es6", + "module": "commonjs", + "moduleResolution": "node", + "sourceMap": true, + "declaration": true, + "noImplicitAny": false, + "rootDir": "./src", + "outDir": "./dist", + "allowSyntheticDefaultImports": false, + "pretty": true, + "removeComments": true, + "typeRoots": [ + "node_modules/@types" + ], + "types": [ + "typed-graphql", + "@types/node" + ] + }, + "exclude": [ + "node_modules", + "dist" + ] +} diff --git a/packages/apollo-server-integration-testsuite/.npmignore b/packages/apollo-server-integration-testsuite/.npmignore new file mode 100644 index 00000000000..063364e2b5d --- /dev/null +++ b/packages/apollo-server-integration-testsuite/.npmignore @@ -0,0 +1,5 @@ +* +!dist +!dist/**/* +dist/**/*.test.* +!package.json diff --git a/packages/apollo-server-integration-testsuite/package.json b/packages/apollo-server-integration-testsuite/package.json new file mode 100644 index 00000000000..01868d97312 --- /dev/null +++ b/packages/apollo-server-integration-testsuite/package.json @@ -0,0 +1,38 @@ +{ + "name": "apollo-server-integration-testsuite", + "private": true, + "version": "0.3.2", + "description": "Apollo Server Integrations testsuite", + "main": "dist/index.js", + "scripts": { + "compile": "tsc", + "prepublish": "npm run compile" + }, + "repository": { + "type": "git", + "url": "https://github.com/apollostack/apollo-server/tree/master/packages/apollo-server-integration-testsuite" + }, + "keywords": [], + "author": "Jonas Helfer ", + "license": "MIT", + "bugs": { + "url": "https://github.com/apollostack/apollo-server/issues" + }, + "homepage": "https://github.com/apollostack/apollo-server#readme", + "dependencies": { + "apollo-server-core": "^0.3.2", + "apollo-server-graphiql": "^0.3.2", + "apollo-server-operation-store": "^0.3.2", + "supertest": "^2.0.0", + "supertest-as-promised": "^4.0.0", + "typed-graphql": "^1.0.2" + }, + "devDependencies": {}, + "peerDependencies": { + "graphql": "^0.6.1 || ^0.7.0" + }, + "typings": "dist/index.d.ts", + "typescript": { + "definition": "dist/index.d.ts" + } +} diff --git a/src/integrations/integrations.test.ts b/packages/apollo-server-integration-testsuite/src/index.ts similarity index 99% rename from src/integrations/integrations.test.ts rename to packages/apollo-server-integration-testsuite/src/index.ts index 863a5627d4f..9d9c2643f73 100644 --- a/src/integrations/integrations.test.ts +++ b/packages/apollo-server-integration-testsuite/src/index.ts @@ -1,5 +1,6 @@ import { expect } from 'chai'; import { stub } from 'sinon'; +import 'mocha'; import { GraphQLSchema, @@ -12,10 +13,9 @@ import { // tslint:disable-next-line const request = require('supertest-as-promised'); -import ApolloOptions from './apolloOptions'; - -import * as GraphiQL from '../modules/renderGraphiQL'; -import { OperationStore } from '../modules/operationStore'; +import { ApolloOptions } from 'apollo-server-core'; +import * as GraphiQL from 'apollo-server-graphiql'; +import { OperationStore } from 'apollo-server-operation-store'; const QueryType = new GraphQLObjectType({ name: 'QueryType', @@ -176,7 +176,6 @@ export default (createApp: CreateAppFunc, destroyApp?: DestroyAppFunc) => { }); }); - it('can handle a basic request', () => { app = createApp(); const expected = { @@ -492,7 +491,6 @@ export default (createApp: CreateAppFunc, destroyApp?: DestroyAppFunc) => { }); - describe('renderGraphiQL', () => { it('presents GraphiQL when accepting HTML', () => { app = createApp({graphiqlOptions: { diff --git a/packages/apollo-server-integration-testsuite/tsconfig.json b/packages/apollo-server-integration-testsuite/tsconfig.json new file mode 100644 index 00000000000..400efae72bf --- /dev/null +++ b/packages/apollo-server-integration-testsuite/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "target": "es6", + "module": "commonjs", + "moduleResolution": "node", + "sourceMap": true, + "declaration": true, + "noImplicitAny": false, + "rootDir": "./src", + "outDir": "./dist", + "allowSyntheticDefaultImports": false, + "pretty": true, + "removeComments": true, + "typeRoots": [ + "node_modules/@types" + ], + "types": [ + "typed-graphql", + "@types/node" + ] + }, + "exclude": [ + "node_modules", + "dist" + ] +} diff --git a/packages/apollo-server-koa/.npmignore b/packages/apollo-server-koa/.npmignore new file mode 100644 index 00000000000..063364e2b5d --- /dev/null +++ b/packages/apollo-server-koa/.npmignore @@ -0,0 +1,5 @@ +* +!dist +!dist/**/* +dist/**/*.test.* +!package.json diff --git a/packages/apollo-server-koa/package.json b/packages/apollo-server-koa/package.json new file mode 100644 index 00000000000..d395c5d6e76 --- /dev/null +++ b/packages/apollo-server-koa/package.json @@ -0,0 +1,48 @@ +{ + "name": "apollo-server-koa", + "version": "0.3.2", + "description": "Production-ready Node.js GraphQL server for Koa", + "main": "dist/index.js", + "scripts": { + "compile": "tsc", + "prepublish": "npm run compile" + }, + "repository": { + "type": "git", + "url": "https://github.com/apollostack/apollo-server/tree/master/packages/apollo-server-koa" + }, + "keywords": [ + "GraphQL", + "Apollo", + "Koa", + "Server", + "Javascript" + ], + "author": "Jonas Helfer ", + "license": "MIT", + "bugs": { + "url": "https://github.com/apollostack/apollo-server/issues" + }, + "homepage": "https://github.com/apollostack/apollo-server#readme", + "dependencies": { + "apollo-server-core": "^0.3.2", + "apollo-server-graphiql": "^0.3.2", + "@types/koa": "^2.0.33", + "typed-graphql": "^1.0.2" + }, + "devDependencies": { + "@types/koa-bodyparser": "^3.0.19", + "@types/koa-router": "^7.0.21", + "apollo-server-integration-testsuite": "^0.3.2", + "koa": "^2.0.0-alpha.4", + "koa-bodyparser": "^3.0.0", + "koa-router": "^7.0.1" + }, + "peerDependencies": { + "graphql": "^0.6.1 || ^0.7.0" + }, + "typings": "dist/index.d.ts", + "typescript": { + "definition": "dist/index.d.ts" + } +} diff --git a/packages/apollo-server-koa/src/index.ts b/packages/apollo-server-koa/src/index.ts new file mode 100644 index 00000000000..26196548948 --- /dev/null +++ b/packages/apollo-server-koa/src/index.ts @@ -0,0 +1 @@ +export { KoaApolloOptionsFunction, KoaHandler, apolloKoa, graphiqlKoa } from './koaApollo'; diff --git a/src/integrations/koaApollo.test.ts b/packages/apollo-server-koa/src/koaApollo.test.ts similarity index 89% rename from src/integrations/koaApollo.test.ts rename to packages/apollo-server-koa/src/koaApollo.test.ts index af7953e03a6..16a3e3bca82 100644 --- a/src/integrations/koaApollo.test.ts +++ b/packages/apollo-server-koa/src/koaApollo.test.ts @@ -2,11 +2,11 @@ import * as koa from 'koa'; import * as koaRouter from 'koa-router'; import * as koaBody from 'koa-bodyparser'; import { apolloKoa, graphiqlKoa } from './koaApollo'; -import ApolloOptions from './apolloOptions'; +import { ApolloOptions } from 'apollo-server-core'; import { expect } from 'chai'; import * as http from 'http'; -import testSuite, { Schema, CreateAppOptions } from './integrations.test'; +import testSuite, { Schema, CreateAppOptions } from 'apollo-server-integration-testsuite'; function createApp(options: CreateAppOptions = {}) { const app = new koa(); diff --git a/src/integrations/koaApollo.ts b/packages/apollo-server-koa/src/koaApollo.ts similarity index 96% rename from src/integrations/koaApollo.ts rename to packages/apollo-server-koa/src/koaApollo.ts index e9fb76a3ee7..fbc5c7d6684 100644 --- a/src/integrations/koaApollo.ts +++ b/packages/apollo-server-koa/src/koaApollo.ts @@ -1,8 +1,7 @@ import * as koa from 'koa'; import * as graphql from 'graphql'; -import { runQuery } from '../core/runQuery'; -import ApolloOptions from './apolloOptions'; -import * as GraphiQL from '../modules/renderGraphiQL'; +import { ApolloOptions, runQuery } from 'apollo-server-core'; +import * as GraphiQL from 'apollo-server-graphiql'; export interface KoaApolloOptionsFunction { (ctx: koa.Context): ApolloOptions | Promise; diff --git a/packages/apollo-server-koa/tsconfig.json b/packages/apollo-server-koa/tsconfig.json new file mode 100644 index 00000000000..400efae72bf --- /dev/null +++ b/packages/apollo-server-koa/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "target": "es6", + "module": "commonjs", + "moduleResolution": "node", + "sourceMap": true, + "declaration": true, + "noImplicitAny": false, + "rootDir": "./src", + "outDir": "./dist", + "allowSyntheticDefaultImports": false, + "pretty": true, + "removeComments": true, + "typeRoots": [ + "node_modules/@types" + ], + "types": [ + "typed-graphql", + "@types/node" + ] + }, + "exclude": [ + "node_modules", + "dist" + ] +} diff --git a/packages/apollo-server-operation-store/.npmignore b/packages/apollo-server-operation-store/.npmignore new file mode 100644 index 00000000000..063364e2b5d --- /dev/null +++ b/packages/apollo-server-operation-store/.npmignore @@ -0,0 +1,5 @@ +* +!dist +!dist/**/* +dist/**/*.test.* +!package.json diff --git a/packages/apollo-server-operation-store/package.json b/packages/apollo-server-operation-store/package.json new file mode 100644 index 00000000000..d8593de6f60 --- /dev/null +++ b/packages/apollo-server-operation-store/package.json @@ -0,0 +1,38 @@ +{ + "name": "apollo-server-operation-store", + "version": "0.3.2", + "description": "Operation-Store module of apollo GraphQL Server", + "main": "dist/index.js", + "scripts": { + "compile": "tsc", + "prepublish": "npm run compile" + }, + "repository": { + "type": "git", + "url": "https://github.com/apollostack/apollo-server/tree/master/packages/apollo-server-operation-store" + }, + "keywords": [ + "GraphQL", + "Apollo", + "Operation Store", + "Javascript" + ], + "author": "Jonas Helfer ", + "license": "MIT", + "bugs": { + "url": "https://github.com/apollostack/apollo-server/issues" + }, + "homepage": "https://github.com/apollostack/apollo-server#readme", + "dependencies": { + "typed-graphql": "^1.0.2" + }, + "devDependencies": { + }, + "peerDependencies": { + "graphql": "^0.6.1 || ^0.7.0" + }, + "typings": "dist/index.d.ts", + "typescript": { + "definition": "dist/index.d.ts" + } +} diff --git a/packages/apollo-server-operation-store/src/index.ts b/packages/apollo-server-operation-store/src/index.ts new file mode 100644 index 00000000000..7c10b8aeba0 --- /dev/null +++ b/packages/apollo-server-operation-store/src/index.ts @@ -0,0 +1 @@ +export { OperationStore } from './operationStore'; diff --git a/src/modules/operationStore.test.ts b/packages/apollo-server-operation-store/src/operationStore.test.ts similarity index 99% rename from src/modules/operationStore.test.ts rename to packages/apollo-server-operation-store/src/operationStore.test.ts index 8c27340ee7d..767b57ed772 100644 --- a/src/modules/operationStore.test.ts +++ b/packages/apollo-server-operation-store/src/operationStore.test.ts @@ -1,3 +1,5 @@ +import 'mocha'; + import { expect, } from 'chai'; diff --git a/src/modules/operationStore.ts b/packages/apollo-server-operation-store/src/operationStore.ts similarity index 100% rename from src/modules/operationStore.ts rename to packages/apollo-server-operation-store/src/operationStore.ts diff --git a/packages/apollo-server-operation-store/tsconfig.json b/packages/apollo-server-operation-store/tsconfig.json new file mode 100644 index 00000000000..400efae72bf --- /dev/null +++ b/packages/apollo-server-operation-store/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "target": "es6", + "module": "commonjs", + "moduleResolution": "node", + "sourceMap": true, + "declaration": true, + "noImplicitAny": false, + "rootDir": "./src", + "outDir": "./dist", + "allowSyntheticDefaultImports": false, + "pretty": true, + "removeComments": true, + "typeRoots": [ + "node_modules/@types" + ], + "types": [ + "typed-graphql", + "@types/node" + ] + }, + "exclude": [ + "node_modules", + "dist" + ] +} diff --git a/src/index.ts b/src/index.ts deleted file mode 100644 index 16297c72901..00000000000 --- a/src/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -export { runQuery, LogFunction, LogMessage, LogStep, LogAction } from './core/runQuery' -export { renderGraphiQL} from './modules/renderGraphiQL' -export { OperationStore } from './modules/operationStore' -export { apolloExpress, graphiqlExpress } from './integrations/expressApollo' -export { apolloHapi, graphiqlHapi, HapiPluginOptions, HapiOptionsFunction } from './integrations/hapiApollo' -export { apolloKoa, graphiqlKoa } from './integrations/koaApollo' -export { apolloConnect, graphiqlConnect } from './integrations/connectApollo' -export { default as ApolloOptions} from './integrations/apolloOptions' diff --git a/src/test/tests.ts b/src/test/tests.ts deleted file mode 100644 index 0752fcfb103..00000000000 --- a/src/test/tests.ts +++ /dev/null @@ -1,15 +0,0 @@ -/* tslint:disable */ -import 'babel-polyfill' - -process.env.NODE_ENV = 'test'; - -declare function require(name: string); -require('source-map-support').install(); - -import '../core/runQuery.test'; -import '../modules/operationStore.test'; -import '../integrations/expressApollo.test'; -import '../integrations/connectApollo.test'; -import '../integrations/hapiApollo.test'; -import '../integrations/koaApollo.test'; -import './testApolloServerHTTP'; diff --git a/src/typings.d.ts b/src/typings.d.ts deleted file mode 100644 index f43cdb872c0..00000000000 --- a/src/typings.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/test/tests.js b/test/tests.js new file mode 100644 index 00000000000..1102f1ffb88 --- /dev/null +++ b/test/tests.js @@ -0,0 +1,13 @@ +/* tslint:disable */ +require('babel-polyfill'); + +process.env.NODE_ENV = 'test'; + +require('source-map-support').install(); +require('../packages/apollo-server-core/dist/runQuery.test.js'); +require('../packages/apollo-server-operation-store/dist/operationStore.test'); +require('../packages/apollo-server-express/dist/expressApollo.test'); +require('../packages/apollo-server-express/dist/connectApollo.test'); +require('../packages/apollo-server-hapi/dist/hapiApollo.test'); +require('../packages/apollo-server-koa/dist/koaApollo.test'); +require('../packages/apollo-server-express/dist/apolloServerHttp.test'); diff --git a/typings.json b/typings.json deleted file mode 100644 index 0967ef424bc..00000000000 --- a/typings.json +++ /dev/null @@ -1 +0,0 @@ -{}