mirror of
https://github.com/vale981/apollo-server
synced 2025-03-06 10:11:40 -05:00
feat: Remove overriding tsc compile command #636
This commit is contained in:
parent
c4a8b58379
commit
2a74353c25
4 changed files with 14 additions and 16 deletions
|
@ -4,11 +4,6 @@
|
||||||
"description": "Production-ready Node.js GraphQL server for fastify",
|
"description": "Production-ready Node.js GraphQL server for fastify",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
"scripts": {
|
|
||||||
"clean": "rm -rf dist",
|
|
||||||
"compile": "tsc",
|
|
||||||
"prepare": "npm run clean && npm run compile"
|
|
||||||
},
|
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/apollographql/apollo-server/tree/master/packages/apollo-server-fastify"
|
"url": "https://github.com/apollographql/apollo-server/tree/master/packages/apollo-server-fastify"
|
||||||
|
@ -38,7 +33,6 @@
|
||||||
"graphql-tools": "^4.0.0"
|
"graphql-tools": "^4.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/graphql": "0.12.7",
|
|
||||||
"apollo-server-integration-testsuite": "file:../apollo-server-integration-testsuite"
|
"apollo-server-integration-testsuite": "file:../apollo-server-integration-testsuite"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
|
|
|
@ -11,15 +11,14 @@ import { graphqlFastify } from './fastifyApollo';
|
||||||
|
|
||||||
export { GraphQLOptions, GraphQLExtension } from 'apollo-server-core';
|
export { GraphQLOptions, GraphQLExtension } from 'apollo-server-core';
|
||||||
import { ApolloServerBase, GraphQLOptions } from 'apollo-server-core';
|
import { ApolloServerBase, GraphQLOptions } from 'apollo-server-core';
|
||||||
import { IncomingMessage, OutgoingMessage, ServerResponse } from 'http';
|
import { IncomingMessage, OutgoingMessage } from 'http';
|
||||||
|
|
||||||
export class ApolloServer extends ApolloServerBase {
|
export class ApolloServer extends ApolloServerBase {
|
||||||
async createGraphQLServerOptions(
|
async createGraphQLServerOptions(
|
||||||
request: fastify.FastifyRequest<IncomingMessage>,
|
request: fastify.FastifyRequest<IncomingMessage>,
|
||||||
reply: fastify.FastifyReply<OutgoingMessage>,
|
reply: fastify.FastifyReply<OutgoingMessage>,
|
||||||
): Promise<GraphQLOptions> {
|
): Promise<GraphQLOptions> {
|
||||||
const options = await super.graphQLServerOptions({ request, reply });
|
return await super.graphQLServerOptions({ request, reply });
|
||||||
return options;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected supportsSubscriptions(): boolean {
|
protected supportsSubscriptions(): boolean {
|
||||||
|
@ -42,10 +41,10 @@ export class ApolloServer extends ApolloServerBase {
|
||||||
|
|
||||||
await app.addHook(
|
await app.addHook(
|
||||||
'preHandler',
|
'preHandler',
|
||||||
async function(
|
function (
|
||||||
this: any,
|
this: any,
|
||||||
request: any,
|
request: any,
|
||||||
response: ServerResponse,
|
reply: FastifyReply<OutgoingMessage>,
|
||||||
next: any,
|
next: any,
|
||||||
) {
|
) {
|
||||||
if (request.path !== path) {
|
if (request.path !== path) {
|
||||||
|
@ -69,10 +68,11 @@ export class ApolloServer extends ApolloServerBase {
|
||||||
...this.playgroundOptions,
|
...this.playgroundOptions,
|
||||||
};
|
};
|
||||||
|
|
||||||
response.setHeader('Content-Type', 'text/html');
|
reply
|
||||||
return response.end(
|
.type('text/html')
|
||||||
renderPlaygroundPage(playgroundRenderPageOptions),
|
.send(
|
||||||
);
|
renderPlaygroundPage(playgroundRenderPageOptions)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return next();
|
return next();
|
||||||
|
@ -89,7 +89,7 @@ export class ApolloServer extends ApolloServerBase {
|
||||||
'PATCH',
|
'PATCH',
|
||||||
] as fastify.HTTPMethod[],
|
] as fastify.HTTPMethod[],
|
||||||
url: '/.well-known/apollo/server-health',
|
url: '/.well-known/apollo/server-health',
|
||||||
handler: async function(
|
handler: async function (
|
||||||
request: any,
|
request: any,
|
||||||
reply: FastifyReply<OutgoingMessage>,
|
reply: FastifyReply<OutgoingMessage>,
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -3,6 +3,9 @@
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"rootDir": "./src",
|
"rootDir": "./src",
|
||||||
"outDir": "./dist",
|
"outDir": "./dist",
|
||||||
|
"noImplicitAny": false,
|
||||||
|
"noImplicitThis": false,
|
||||||
|
"strictNullChecks": false
|
||||||
},
|
},
|
||||||
"include": ["src/**/*"],
|
"include": ["src/**/*"],
|
||||||
"exclude": ["**/__tests__", "**/__mocks__"],
|
"exclude": ["**/__tests__", "**/__mocks__"],
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
{ "path": "./packages/apollo-server-core" },
|
{ "path": "./packages/apollo-server-core" },
|
||||||
{ "path": "./packages/apollo-server-errors" },
|
{ "path": "./packages/apollo-server-errors" },
|
||||||
{ "path": "./packages/apollo-server-express" },
|
{ "path": "./packages/apollo-server-express" },
|
||||||
|
{ "path": "./packages/apollo-server-fastify" },
|
||||||
{ "path": "./packages/apollo-server-hapi" },
|
{ "path": "./packages/apollo-server-hapi" },
|
||||||
{ "path": "./packages/apollo-server-koa" },
|
{ "path": "./packages/apollo-server-koa" },
|
||||||
{ "path": "./packages/apollo-server-lambda" },
|
{ "path": "./packages/apollo-server-lambda" },
|
||||||
|
|
Loading…
Add table
Reference in a new issue