diff --git a/package-lock.json b/package-lock.json index f74410e0e60..7295e988acb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2995,6 +2995,15 @@ "resolve": "1.1.7" } }, + "bs-logger": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/bs-logger/-/bs-logger-0.2.5.tgz", + "integrity": "sha512-uFLE0LFMxrH8Z5Hd9QgivvRbrl/NFkOTHzGhlqQxsnmx5JBLrp4bc249afLL+GccyY/8hkcGi2LpVaOzaEY0nQ==", + "dev": true, + "requires": { + "fast-json-stable-stringify": "^2.0.0" + } + }, "bser": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/bser/-/bser-2.0.0.tgz", @@ -3348,12 +3357,6 @@ "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=", "dev": true }, - "closest-file-data": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/closest-file-data/-/closest-file-data-0.1.4.tgz", - "integrity": "sha1-l1+HwTLymdJKA3W59jyj+4j3Kzo=", - "dev": true - }, "cmd-shim": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/cmd-shim/-/cmd-shim-2.0.2.tgz", @@ -5328,17 +5331,6 @@ } } }, - "fs-extra": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-6.0.1.tgz", - "integrity": "sha512-GnyIkKhhzXZUWFCaJzvyDLEEgDkPfb4/TPvJCJVuS8MWZgoSsErf++QpiAlDnKFcqhRlm+tIOcencCjyJE6ZCA==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, "fs-minipass": { "version": "1.2.5", "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.5.tgz", @@ -8918,6 +8910,12 @@ "pify": "^3.0.0" } }, + "make-error": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.5.tgz", + "integrity": "sha512-c3sIjNUow0+8swNwVpqoH4YCShKNFkMaw6oH1mNS2haDZQqkeZFlHS3dhoeEbKKmJB4vXpJucU6oH75aDYeE9g==", + "dev": true + }, "make-fetch-happen": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-4.0.1.tgz", @@ -12372,15 +12370,51 @@ "dev": true }, "ts-jest": { - "version": "23.1.4", - "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-23.1.4.tgz", - "integrity": "sha512-9rCSxbWfoZxxeXnSoEIzRNr9hDIQ8iEJAWmSRsWhDHDT8OeuGfURhJQUE8jtJlkyEygs6rngH8RYtHz9cfjmEA==", + "version": "23.10.3", + "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-23.10.3.tgz", + "integrity": "sha512-Lgyfw1MYPfqAs1qrFBmqXu8LRrde8ItH70pmp1iQuRbkVXaap7QcaEpN+yiSxuppfvO8rqezVv8wOYZkKhR5wA==", "dev": true, "requires": { - "closest-file-data": "^0.1.4", - "fs-extra": "6.0.1", - "json5": "^0.5.0", - "lodash": "^4.17.10" + "bs-logger": "0.x", + "buffer-from": "1.x", + "fast-json-stable-stringify": "2.x", + "json5": "2.x", + "make-error": "1.x", + "mkdirp": "0.x", + "semver": "^5.5", + "yargs-parser": "10.x" + }, + "dependencies": { + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "dev": true + }, + "json5": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.0.tgz", + "integrity": "sha512-8Mh9h6xViijj36g7Dxi+Y4S6hNGV96vcJZr/SrlHh1LR/pEn/8j/+qIBbs44YKl69Lrfctp4QD+AdWLTMqEZAQ==", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + }, + "minimist": { + "version": "1.2.0", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + }, + "yargs-parser": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-10.1.0.tgz", + "integrity": "sha512-VCIyR1wJoEBZUqk5PA+oOBF6ypbwh5aNB3I50guxAL/quggdfs4TtNHQrSazFA3fYZ+tEqfs0zIGlv0c/rgjbQ==", + "dev": true, + "requires": { + "camelcase": "^4.1.0" + } + } } }, "tslib": { @@ -12470,9 +12504,9 @@ "dev": true }, "typescript": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.0.3.tgz", - "integrity": "sha512-kk80vLW9iGtjMnIv11qyxLqZm20UklzuR2tL0QAnDIygIUIemcZMxlMWudl9OOt76H3ntVzcTiddQ1/pAAJMYg==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.1.1.tgz", + "integrity": "sha512-Veu0w4dTc/9wlWNf2jeRInNodKlcdLgemvPsrNpfu5Pq39sgfFjvIIgTsvUHCoLBnMhPoUA+tFxsXjU6VexVRQ==", "dev": true }, "uglify-js": { diff --git a/package.json b/package.json index 9f5d46baf29..2525d256c74 100644 --- a/package.json +++ b/package.json @@ -5,10 +5,10 @@ "repository": "github:apollographql/apollo-server", "scripts": { "clean": "git clean -dfqX -- ./node_modules **/{dist,node_modules}/", - "compile": "lerna run compile", + "compile": "tsc --build", "release": "npm run clean && npm ci && lerna publish --exact", "precommit": "lint-staged", - "postinstall": "lerna run prepare", + "postinstall": "lerna run prepare && npm run compile", "lint": "prettier-check '**/*.{js,ts}'", "lint-fix": "prettier '**/*.{js,ts}' --write", "test": "jest --verbose", @@ -111,9 +111,9 @@ "subscriptions-transport-ws": "0.9.15", "supertest": "3.3.0", "test-listen": "1.1.0", - "ts-jest": "23.1.4", + "ts-jest": "23.10.3", "tslint": "5.11.0", - "typescript": "3.0.3", + "typescript": "3.1.1", "ws": "6.0.0", "yup": "0.26.5" }, @@ -122,9 +122,8 @@ "setupFiles": [ "/packages/apollo-server-env/dist/index.js" ], - "transform": { - "^.+\\.ts$": "ts-jest" - }, + "preset": "ts-jest", + "testMatch": null, "testRegex": "/__tests__/.*\\.test\\.(js|ts)$", "moduleFileExtensions": [ "ts", @@ -134,6 +133,12 @@ "/node_modules/", "/dist/" ], - "clearMocks": true + "clearMocks": true, + "globals": { + "ts-jest": { + "tsConfig": "tsconfig.test.json", + "diagnostics": false + } + } } } diff --git a/packages/apollo-cache-control/package.json b/packages/apollo-cache-control/package.json index a0230633869..78a84392b18 100644 --- a/packages/apollo-cache-control/package.json +++ b/packages/apollo-cache-control/package.json @@ -4,11 +4,6 @@ "description": "A GraphQL extension for cache control", "main": "./dist/index.js", "types": "./dist/index.d.ts", - "scripts": { - "clean": "rm -rf dist", - "compile": "tsc", - "prepare": "npm run clean && npm run compile" - }, "license": "MIT", "repository": "apollographql/apollo-cache-control-js", "author": "Martijn Walraven ", diff --git a/packages/apollo-cache-control/tsconfig.json b/packages/apollo-cache-control/tsconfig.json index b8b81721105..2f8668da1ac 100644 --- a/packages/apollo-cache-control/tsconfig.json +++ b/packages/apollo-cache-control/tsconfig.json @@ -1,9 +1,12 @@ { - "extends": "../../tsconfig", + "extends": "../../tsconfig.base", "compilerOptions": { "rootDir": "./src", "outDir": "./dist" }, "include": ["src/**/*"], - "exclude": ["**/__tests__", "**/__mocks__"] + "exclude": ["**/__tests__", "**/__mocks__"], + "references": [ + { "path": "../graphql-extensions" } + ] } diff --git a/packages/apollo-datasource-rest/package.json b/packages/apollo-datasource-rest/package.json index 61aca07ce9c..fa8ae64de02 100644 --- a/packages/apollo-datasource-rest/package.json +++ b/packages/apollo-datasource-rest/package.json @@ -11,11 +11,6 @@ "bugs": { "url": "https://github.com/apollographql/apollo-server/issues" }, - "scripts": { - "clean": "rm -rf dist", - "compile": "tsc", - "prepare": "npm run clean && npm run compile" - }, "main": "dist/index.js", "types": "dist/index.d.ts", "engines": { diff --git a/packages/apollo-datasource-rest/tsconfig.json b/packages/apollo-datasource-rest/tsconfig.json index b8b81721105..5037876fe14 100644 --- a/packages/apollo-datasource-rest/tsconfig.json +++ b/packages/apollo-datasource-rest/tsconfig.json @@ -1,9 +1,14 @@ { - "extends": "../../tsconfig", + "extends": "../../tsconfig.base", "compilerOptions": { "rootDir": "./src", "outDir": "./dist" }, "include": ["src/**/*"], - "exclude": ["**/__tests__", "**/__mocks__"] + "exclude": ["**/__tests__", "**/__mocks__"], + "references": [ + { "path": "../apollo-datasource" }, + { "path": "../apollo-server-caching" }, + { "path": "../apollo-server-errors" } + ] } diff --git a/packages/apollo-datasource/package.json b/packages/apollo-datasource/package.json index 5b958e86d1a..23ee4bcb10c 100644 --- a/packages/apollo-datasource/package.json +++ b/packages/apollo-datasource/package.json @@ -11,11 +11,6 @@ "bugs": { "url": "https://github.com/apollographql/apollo-server/issues" }, - "scripts": { - "clean": "rm -rf dist", - "compile": "tsc", - "prepare": "npm run clean && npm run compile" - }, "main": "dist/index.js", "types": "dist/index.d.ts", "engines": { diff --git a/packages/apollo-datasource/tsconfig.json b/packages/apollo-datasource/tsconfig.json index b8b81721105..3fa721a4cdc 100644 --- a/packages/apollo-datasource/tsconfig.json +++ b/packages/apollo-datasource/tsconfig.json @@ -1,9 +1,12 @@ { - "extends": "../../tsconfig", + "extends": "../../tsconfig.base", "compilerOptions": { "rootDir": "./src", "outDir": "./dist" }, "include": ["src/**/*"], - "exclude": ["**/__tests__", "**/__mocks__"] + "exclude": ["**/__tests__", "**/__mocks__"], + "references": [ + { "path": "../apollo-server-caching" }, + ] } diff --git a/packages/apollo-engine-reporting-protobuf/tsconfig.json b/packages/apollo-engine-reporting-protobuf/tsconfig.json deleted file mode 100644 index b8b81721105..00000000000 --- a/packages/apollo-engine-reporting-protobuf/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "../../tsconfig", - "compilerOptions": { - "rootDir": "./src", - "outDir": "./dist" - }, - "include": ["src/**/*"], - "exclude": ["**/__tests__", "**/__mocks__"] -} diff --git a/packages/apollo-engine-reporting/package.json b/packages/apollo-engine-reporting/package.json index 6f44d5919e1..b08b4030964 100644 --- a/packages/apollo-engine-reporting/package.json +++ b/packages/apollo-engine-reporting/package.json @@ -4,13 +4,6 @@ "description": "Send reports about your GraphQL services to Apollo Engine", "main": "./dist/index.js", "types": "./dist/index.d.ts", - "scripts": { - "clean": "rm -rf dist", - "compile": "tsc", - "prepare": "npm run clean && npm run compile", - "lint": "prettier -l 'src/**/*.{ts,js}' && tslint -p tsconfig.json 'src/**/*.ts'", - "lint-fix": "prettier --write 'src/**/*.{ts,js}' && tslint --fix -p tsconfig.json 'src/**/*.ts'" - }, "license": "MIT", "repository": "https://github.com/apollographql/apollo-engine-reporting", "author": "Apollo ", diff --git a/packages/apollo-engine-reporting/tsconfig.json b/packages/apollo-engine-reporting/tsconfig.json index b8b81721105..2f8668da1ac 100644 --- a/packages/apollo-engine-reporting/tsconfig.json +++ b/packages/apollo-engine-reporting/tsconfig.json @@ -1,9 +1,12 @@ { - "extends": "../../tsconfig", + "extends": "../../tsconfig.base", "compilerOptions": { "rootDir": "./src", "outDir": "./dist" }, "include": ["src/**/*"], - "exclude": ["**/__tests__", "**/__mocks__"] + "exclude": ["**/__tests__", "**/__mocks__"], + "references": [ + { "path": "../graphql-extensions" } + ] } diff --git a/packages/apollo-server-cache-memcached/package.json b/packages/apollo-server-cache-memcached/package.json index eb7cf22e62e..bd09f1b7b7b 100644 --- a/packages/apollo-server-cache-memcached/package.json +++ b/packages/apollo-server-cache-memcached/package.json @@ -11,11 +11,6 @@ "bugs": { "url": "https://github.com/apollographql/apollo-server/issues" }, - "scripts": { - "clean": "rm -rf dist", - "compile": "tsc", - "prepare": "npm run clean && npm run compile" - }, "main": "dist/index.js", "types": "dist/index.d.ts", "engines": { diff --git a/packages/apollo-server-cache-memcached/tsconfig.json b/packages/apollo-server-cache-memcached/tsconfig.json index b8b81721105..3fa721a4cdc 100644 --- a/packages/apollo-server-cache-memcached/tsconfig.json +++ b/packages/apollo-server-cache-memcached/tsconfig.json @@ -1,9 +1,12 @@ { - "extends": "../../tsconfig", + "extends": "../../tsconfig.base", "compilerOptions": { "rootDir": "./src", "outDir": "./dist" }, "include": ["src/**/*"], - "exclude": ["**/__tests__", "**/__mocks__"] + "exclude": ["**/__tests__", "**/__mocks__"], + "references": [ + { "path": "../apollo-server-caching" }, + ] } diff --git a/packages/apollo-server-cache-redis/package.json b/packages/apollo-server-cache-redis/package.json index 84bb9979e95..8b2179fc91a 100644 --- a/packages/apollo-server-cache-redis/package.json +++ b/packages/apollo-server-cache-redis/package.json @@ -11,11 +11,6 @@ "bugs": { "url": "https://github.com/apollographql/apollo-server/issues" }, - "scripts": { - "clean": "rm -rf dist", - "compile": "tsc", - "prepare": "npm run clean && npm run compile" - }, "main": "dist/index.js", "types": "dist/index.d.ts", "engines": { diff --git a/packages/apollo-server-cache-redis/tsconfig.json b/packages/apollo-server-cache-redis/tsconfig.json index b8b81721105..3fa721a4cdc 100644 --- a/packages/apollo-server-cache-redis/tsconfig.json +++ b/packages/apollo-server-cache-redis/tsconfig.json @@ -1,9 +1,12 @@ { - "extends": "../../tsconfig", + "extends": "../../tsconfig.base", "compilerOptions": { "rootDir": "./src", "outDir": "./dist" }, "include": ["src/**/*"], - "exclude": ["**/__tests__", "**/__mocks__"] + "exclude": ["**/__tests__", "**/__mocks__"], + "references": [ + { "path": "../apollo-server-caching" }, + ] } diff --git a/packages/apollo-server-caching/package.json b/packages/apollo-server-caching/package.json index ff497f93f31..15b06a53128 100644 --- a/packages/apollo-server-caching/package.json +++ b/packages/apollo-server-caching/package.json @@ -11,11 +11,6 @@ "bugs": { "url": "https://github.com/apollographql/apollo-server/issues" }, - "scripts": { - "clean": "rm -rf dist", - "compile": "tsc", - "prepare": "npm run clean && npm run compile" - }, "main": "dist/index.js", "types": "dist/index.d.ts", "engines": { diff --git a/packages/apollo-server-caching/tsconfig.json b/packages/apollo-server-caching/tsconfig.json index b8b81721105..15916a62101 100644 --- a/packages/apollo-server-caching/tsconfig.json +++ b/packages/apollo-server-caching/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../tsconfig", + "extends": "../../tsconfig.base", "compilerOptions": { "rootDir": "./src", "outDir": "./dist" diff --git a/packages/apollo-server-cloud-function/package.json b/packages/apollo-server-cloud-function/package.json index 35c9a98f0ca..114222b8930 100644 --- a/packages/apollo-server-cloud-function/package.json +++ b/packages/apollo-server-cloud-function/package.json @@ -24,11 +24,6 @@ "engines": { "node": ">=6" }, - "scripts": { - "clean": "rm -rf dist", - "compile": "tsc", - "prepublish": "npm run clean && npm run compile" - }, "dependencies": { "@apollographql/graphql-playground-html": "^1.6.0", "apollo-server-core": "file:../apollo-server-core", diff --git a/packages/apollo-server-cloud-function/tsconfig.json b/packages/apollo-server-cloud-function/tsconfig.json index b8b81721105..f72903a76b1 100644 --- a/packages/apollo-server-cloud-function/tsconfig.json +++ b/packages/apollo-server-cloud-function/tsconfig.json @@ -1,9 +1,13 @@ { - "extends": "../../tsconfig", + "extends": "../../tsconfig.base", "compilerOptions": { "rootDir": "./src", "outDir": "./dist" }, "include": ["src/**/*"], - "exclude": ["**/__tests__", "**/__mocks__"] + "exclude": ["**/__tests__", "**/__mocks__"], + "references": [ + { "path": "../apollo-server-core" }, + { "path": "../apollo-server-integration-testsuite" } + ] } diff --git a/packages/apollo-server-cloudflare/package.json b/packages/apollo-server-cloudflare/package.json index be338c6552d..c8c9a5c2f0c 100644 --- a/packages/apollo-server-cloudflare/package.json +++ b/packages/apollo-server-cloudflare/package.json @@ -4,11 +4,6 @@ "description": "Production-ready Node.js GraphQL server for Cloudflare workers", "main": "dist/index.js", "types": "dist/index.d.ts", - "scripts": { - "clean": "rm -rf dist", - "compile": "tsc", - "prepare": "npm run clean && npm run compile" - }, "repository": { "type": "git", "url": "https://github.com/apollographql/apollo-server/tree/master/packages/apollo-server-cloudflare-workers" diff --git a/packages/apollo-server-cloudflare/tsconfig.json b/packages/apollo-server-cloudflare/tsconfig.json index b8b81721105..f72903a76b1 100644 --- a/packages/apollo-server-cloudflare/tsconfig.json +++ b/packages/apollo-server-cloudflare/tsconfig.json @@ -1,9 +1,13 @@ { - "extends": "../../tsconfig", + "extends": "../../tsconfig.base", "compilerOptions": { "rootDir": "./src", "outDir": "./dist" }, "include": ["src/**/*"], - "exclude": ["**/__tests__", "**/__mocks__"] + "exclude": ["**/__tests__", "**/__mocks__"], + "references": [ + { "path": "../apollo-server-core" }, + { "path": "../apollo-server-integration-testsuite" } + ] } diff --git a/packages/apollo-server-core/package.json b/packages/apollo-server-core/package.json index fa62eb7302d..348cf043d7a 100644 --- a/packages/apollo-server-core/package.json +++ b/packages/apollo-server-core/package.json @@ -4,11 +4,6 @@ "description": "Core engine for Apollo GraphQL server", "main": "dist/index.js", "types": "dist/index.d.ts", - "scripts": { - "clean": "rm -rf dist", - "compile": "tsc", - "prepare": "npm run clean && npm run compile" - }, "repository": { "type": "git", "url": "https://github.com/apollographql/apollo-server/tree/master/packages/apollo-server-core" diff --git a/packages/apollo-server-core/src/runHttpQuery.ts b/packages/apollo-server-core/src/runHttpQuery.ts index e49d1a7b7ad..158f5d43046 100644 --- a/packages/apollo-server-core/src/runHttpQuery.ts +++ b/packages/apollo-server-core/src/runHttpQuery.ts @@ -313,7 +313,7 @@ export async function runHttpQuery( context = {} as Record; } else if (typeof context === 'function') { try { - context = await context(); + context = await (context as Function)(); } catch (e) { e.message = `Context creation failed: ${e.message}`; // For errors that are not internal, such as authentication, we @@ -342,11 +342,14 @@ export async function runHttpQuery( for (const dataSource of Object.values(dataSources)) { if (dataSource.initialize) { - dataSource.initialize({ context, cache: optionsObject.cache! }); + dataSource.initialize({ + context: context!, + cache: optionsObject.cache!, + }); } } - if ('dataSources' in context) { + if ('dataSources' in context!) { throw new Error( 'Please use the dataSources config option instead of putting dataSources on the context yourself.', ); diff --git a/packages/apollo-server-core/tsconfig.json b/packages/apollo-server-core/tsconfig.json index b8b81721105..9b89580de76 100644 --- a/packages/apollo-server-core/tsconfig.json +++ b/packages/apollo-server-core/tsconfig.json @@ -1,9 +1,18 @@ { - "extends": "../../tsconfig", + "extends": "../../tsconfig.base", "compilerOptions": { "rootDir": "./src", "outDir": "./dist" }, "include": ["src/**/*"], - "exclude": ["**/__tests__", "**/__mocks__"] + "exclude": ["**/__tests__", "**/__mocks__"], + "references": [ + { "path": "../apollo-cache-control" }, + { "path": "../apollo-datasource" }, + { "path": "../apollo-engine-reporting" }, + { "path": "../apollo-server-caching" }, + { "path": "../apollo-server-errors" }, + { "path": "../apollo-tracing" }, + { "path": "../graphql-extensions" } + ] } diff --git a/packages/apollo-server-env/package.json b/packages/apollo-server-env/package.json index d4201aa56a1..6957c45b76c 100644 --- a/packages/apollo-server-env/package.json +++ b/packages/apollo-server-env/package.json @@ -11,14 +11,14 @@ "bugs": { "url": "https://github.com/apollographql/apollo-server/issues" }, + "main": "dist/index.js", + "browser": "dist/index.browser.js", + "types": "dist/index.d.ts", "scripts": { "clean": "rm -rf dist", "compile": "tsc && cp src/*.d.ts dist", "prepare": "npm run clean && npm run compile" }, - "main": "dist/index.js", - "browser": "dist/index.browser.js", - "types": "dist/index.d.ts", "engines": { "node": ">=6" }, diff --git a/packages/apollo-server-env/tsconfig.json b/packages/apollo-server-env/tsconfig.json index a279d2621cd..f4d7c2e2456 100644 --- a/packages/apollo-server-env/tsconfig.json +++ b/packages/apollo-server-env/tsconfig.json @@ -1,6 +1,7 @@ { - "extends": "../../tsconfig", + "extends": "../../tsconfig.base", "compilerOptions": { + "composite": false, "rootDir": "./src", "outDir": "./dist", "allowJs": true, diff --git a/packages/apollo-server-errors/package.json b/packages/apollo-server-errors/package.json index 486a802a5ae..26a767d038c 100644 --- a/packages/apollo-server-errors/package.json +++ b/packages/apollo-server-errors/package.json @@ -11,11 +11,6 @@ "bugs": { "url": "https://github.com/apollographql/apollo-server/issues" }, - "scripts": { - "clean": "rm -rf dist", - "compile": "tsc", - "prepare": "npm run clean && npm run compile" - }, "main": "dist/index.js", "types": "dist/index.d.ts", "engines": { diff --git a/packages/apollo-server-errors/tsconfig.json b/packages/apollo-server-errors/tsconfig.json index fbed8c00866..0d67d38983d 100644 --- a/packages/apollo-server-errors/tsconfig.json +++ b/packages/apollo-server-errors/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../tsconfig", + "extends": "../../tsconfig.base", "compilerOptions": { "rootDir": "./src", "outDir": "./dist", diff --git a/packages/apollo-server-express/package.json b/packages/apollo-server-express/package.json index 34369e03f24..23a3c5139cc 100644 --- a/packages/apollo-server-express/package.json +++ b/packages/apollo-server-express/package.json @@ -4,11 +4,6 @@ "description": "Production-ready Node.js GraphQL server for Express and Connect", "main": "dist/index.js", "types": "dist/index.d.ts", - "scripts": { - "clean": "rm -rf dist", - "compile": "tsc", - "prepare": "npm run clean && npm run compile" - }, "repository": { "type": "git", "url": "https://github.com/apollographql/apollo-server/tree/master/packages/apollo-server-express" diff --git a/packages/apollo-server-express/tsconfig.json b/packages/apollo-server-express/tsconfig.json index 1fb1071218e..92d9dcee2b7 100644 --- a/packages/apollo-server-express/tsconfig.json +++ b/packages/apollo-server-express/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../tsconfig", + "extends": "../../tsconfig.base", "compilerOptions": { "rootDir": "./src", "outDir": "./dist", @@ -7,5 +7,9 @@ "strictNullChecks": false }, "include": ["src/**/*"], - "exclude": ["**/__tests__", "**/__mocks__"] + "exclude": ["**/__tests__", "**/__mocks__"], + "references": [ + { "path": "../apollo-server-core" }, + { "path": "../apollo-server-integration-testsuite" } + ] } diff --git a/packages/apollo-server-hapi/package.json b/packages/apollo-server-hapi/package.json index cf5a3a22326..75e71e71e16 100644 --- a/packages/apollo-server-hapi/package.json +++ b/packages/apollo-server-hapi/package.json @@ -4,11 +4,6 @@ "description": "Production-ready Node.js GraphQL server for Hapi", "main": "dist/index.js", "types": "dist/index.d.ts", - "scripts": { - "clean": "rm -rf dist", - "compile": "tsc", - "prepare": "npm run clean && npm run compile" - }, "repository": { "type": "git", "url": "https://github.com/apollographql/apollo-server/tree/master/packages/apollo-server-hapi" diff --git a/packages/apollo-server-hapi/tsconfig.json b/packages/apollo-server-hapi/tsconfig.json index 4f9532c3555..88907f56d2c 100644 --- a/packages/apollo-server-hapi/tsconfig.json +++ b/packages/apollo-server-hapi/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../tsconfig", + "extends": "../../tsconfig.base", "compilerOptions": { "rootDir": "./src", "outDir": "./dist", @@ -8,5 +8,9 @@ "strictNullChecks": false }, "include": ["src/**/*"], - "exclude": ["**/__tests__", "**/__mocks__"] + "exclude": ["**/__tests__", "**/__mocks__"], + "references": [ + { "path": "../apollo-server-core" }, + { "path": "../apollo-server-integration-testsuite" } + ] } diff --git a/packages/apollo-server-integration-testsuite/package.json b/packages/apollo-server-integration-testsuite/package.json index db13059225f..7101f33855c 100644 --- a/packages/apollo-server-integration-testsuite/package.json +++ b/packages/apollo-server-integration-testsuite/package.json @@ -5,11 +5,6 @@ "description": "Apollo Server Integrations testsuite", "main": "dist/index.js", "types": "dist/index.d.ts", - "scripts": { - "clean": "rm -rf dist", - "compile": "tsc", - "prepare": "npm run clean && npm run compile" - }, "repository": { "type": "git", "url": "https://github.com/apollographql/apollo-server/tree/master/packages/apollo-server-integration-testsuite" diff --git a/packages/apollo-server-integration-testsuite/tsconfig.json b/packages/apollo-server-integration-testsuite/tsconfig.json index 1fc001ddcc5..869ca3af562 100644 --- a/packages/apollo-server-integration-testsuite/tsconfig.json +++ b/packages/apollo-server-integration-testsuite/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../tsconfig", + "extends": "../../tsconfig.base", "compilerOptions": { "rootDir": "./src", "outDir": "./dist", @@ -8,5 +8,8 @@ "lib": ["es2017", "esnext.asynciterable", "dom"] }, "include": ["src/**/*"], - "exclude": ["**/__tests__", "**/__mocks__"] + "exclude": ["**/__tests__", "**/__mocks__"], + "references": [ + { "path": "../apollo-server-core" } + ] } diff --git a/packages/apollo-server-koa/package.json b/packages/apollo-server-koa/package.json index 5122aaba39c..de2004e6374 100644 --- a/packages/apollo-server-koa/package.json +++ b/packages/apollo-server-koa/package.json @@ -4,11 +4,6 @@ "description": "Production-ready Node.js GraphQL server for Koa", "main": "dist/index.js", "types": "dist/index.d.ts", - "scripts": { - "clean": "rm -rf dist", - "compile": "tsc", - "prepare": "npm run clean && npm run compile" - }, "repository": { "type": "git", "url": "https://github.com/apollographql/apollo-server/tree/master/packages/apollo-server-koa" diff --git a/packages/apollo-server-koa/tsconfig.json b/packages/apollo-server-koa/tsconfig.json index 967b4d28b36..2be22df56de 100644 --- a/packages/apollo-server-koa/tsconfig.json +++ b/packages/apollo-server-koa/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../tsconfig", + "extends": "../../tsconfig.base", "compilerOptions": { "rootDir": "./src", "outDir": "./dist", @@ -8,5 +8,9 @@ "noImplicitReturns": false }, "include": ["src/**/*"], - "exclude": ["**/__tests__", "**/__mocks__"] + "exclude": ["**/__tests__", "**/__mocks__"], + "references": [ + { "path": "../apollo-server-core" }, + { "path": "../apollo-server-integration-testsuite" } + ] } diff --git a/packages/apollo-server-lambda/package.json b/packages/apollo-server-lambda/package.json index fac2a4b6151..46c32070104 100644 --- a/packages/apollo-server-lambda/package.json +++ b/packages/apollo-server-lambda/package.json @@ -24,11 +24,6 @@ "engines": { "node": ">=6" }, - "scripts": { - "clean": "rm -rf dist", - "compile": "tsc", - "prepare": "npm run clean && npm run compile" - }, "dependencies": { "@apollographql/graphql-playground-html": "^1.6.0", "apollo-server-core": "file:../apollo-server-core", diff --git a/packages/apollo-server-lambda/tsconfig.json b/packages/apollo-server-lambda/tsconfig.json index b8b81721105..f72903a76b1 100644 --- a/packages/apollo-server-lambda/tsconfig.json +++ b/packages/apollo-server-lambda/tsconfig.json @@ -1,9 +1,13 @@ { - "extends": "../../tsconfig", + "extends": "../../tsconfig.base", "compilerOptions": { "rootDir": "./src", "outDir": "./dist" }, "include": ["src/**/*"], - "exclude": ["**/__tests__", "**/__mocks__"] + "exclude": ["**/__tests__", "**/__mocks__"], + "references": [ + { "path": "../apollo-server-core" }, + { "path": "../apollo-server-integration-testsuite" } + ] } diff --git a/packages/apollo-server-micro/package.json b/packages/apollo-server-micro/package.json index 43f1889eb27..c4ad4ff3323 100644 --- a/packages/apollo-server-micro/package.json +++ b/packages/apollo-server-micro/package.json @@ -4,11 +4,6 @@ "description": "Production-ready Node.js GraphQL server for Micro", "main": "dist/index.js", "types": "dist/index.d.ts", - "scripts": { - "clean": "rm -rf dist", - "compile": "tsc", - "prepare": "npm run clean && npm run compile" - }, "repository": { "type": "git", "url": "https://github.com/apollographql/apollo-server/tree/master/packages/apollo-server-micro" diff --git a/packages/apollo-server-micro/tsconfig.json b/packages/apollo-server-micro/tsconfig.json index 1fb1071218e..92d9dcee2b7 100644 --- a/packages/apollo-server-micro/tsconfig.json +++ b/packages/apollo-server-micro/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../tsconfig", + "extends": "../../tsconfig.base", "compilerOptions": { "rootDir": "./src", "outDir": "./dist", @@ -7,5 +7,9 @@ "strictNullChecks": false }, "include": ["src/**/*"], - "exclude": ["**/__tests__", "**/__mocks__"] + "exclude": ["**/__tests__", "**/__mocks__"], + "references": [ + { "path": "../apollo-server-core" }, + { "path": "../apollo-server-integration-testsuite" } + ] } diff --git a/packages/apollo-server/package.json b/packages/apollo-server/package.json index c24f00c3cc3..88fc200a5fe 100644 --- a/packages/apollo-server/package.json +++ b/packages/apollo-server/package.json @@ -5,11 +5,6 @@ "author": "opensource@apollographql.com", "main": "dist/index.js", "types": "dist/index.d.ts", - "scripts": { - "clean": "rm -rf dist", - "compile": "tsc", - "prepare": "npm run clean && npm run compile" - }, "repository": { "type": "git", "url": "https://github.com/apollographql/apollo-server/tree/master/packages/apollo-server" diff --git a/packages/apollo-server/tsconfig.json b/packages/apollo-server/tsconfig.json index b8b81721105..dd82131e9a8 100644 --- a/packages/apollo-server/tsconfig.json +++ b/packages/apollo-server/tsconfig.json @@ -1,9 +1,13 @@ { - "extends": "../../tsconfig", + "extends": "../../tsconfig.base", "compilerOptions": { "rootDir": "./src", "outDir": "./dist" }, "include": ["src/**/*"], - "exclude": ["**/__tests__", "**/__mocks__"] + "exclude": ["**/__tests__", "**/__mocks__"], + "references": [ + { "path": "../apollo-server-core" }, + { "path": "../apollo-server-express" } + ] } diff --git a/packages/apollo-tracing/package.json b/packages/apollo-tracing/package.json index 58be80f79b1..e2d4dd76594 100644 --- a/packages/apollo-tracing/package.json +++ b/packages/apollo-tracing/package.json @@ -4,11 +4,6 @@ "description": "Collect and expose trace data for GraphQL requests", "main": "./dist/index.js", "types": "./dist/index.d.ts", - "scripts": { - "clean": "rm -rf dist", - "compile": "tsc", - "prepare": "npm run clean && npm run compile" - }, "license": "MIT", "repository": "apollographql/apollo-tracing-js", "author": "Martijn Walraven ", diff --git a/packages/apollo-tracing/tsconfig.json b/packages/apollo-tracing/tsconfig.json index b8b81721105..2f8668da1ac 100644 --- a/packages/apollo-tracing/tsconfig.json +++ b/packages/apollo-tracing/tsconfig.json @@ -1,9 +1,12 @@ { - "extends": "../../tsconfig", + "extends": "../../tsconfig.base", "compilerOptions": { "rootDir": "./src", "outDir": "./dist" }, "include": ["src/**/*"], - "exclude": ["**/__tests__", "**/__mocks__"] + "exclude": ["**/__tests__", "**/__mocks__"], + "references": [ + { "path": "../graphql-extensions" } + ] } diff --git a/packages/graphql-extensions/package.json b/packages/graphql-extensions/package.json index 7583db64e6a..62d38b77506 100644 --- a/packages/graphql-extensions/package.json +++ b/packages/graphql-extensions/package.json @@ -4,13 +4,6 @@ "description": "Add extensions to GraphQL servers", "main": "./dist/index.js", "types": "./dist/index.d.ts", - "scripts": { - "clean": "rm -rf dist", - "compile": "tsc", - "prepare": "npm run clean && npm run compile", - "lint": "prettier -l 'src/**/*.ts' && tslint -p tsconfig.json 'src/**/*.ts'", - "lint-fix": "prettier --write 'src/**/*.ts' && tslint --fix -p tsconfig.json 'src/**/*.ts'" - }, "repository": { "type": "git", "url": "apollographql/graphql-extensions" diff --git a/packages/graphql-extensions/src/index.ts b/packages/graphql-extensions/src/index.ts index b4455109da6..1c4ed0157ea 100644 --- a/packages/graphql-extensions/src/index.ts +++ b/packages/graphql-extensions/src/index.ts @@ -20,7 +20,7 @@ export type EndHandler = (...errors: Array) => void; // arguments. type StartHandlerInvoker = ( ext: GraphQLExtension, -) => void; +) => EndHandler | void; // Copied from runQuery in apollo-server-core. // XXX Will this work properly if it's an identical interface of the diff --git a/packages/graphql-extensions/tsconfig.json b/packages/graphql-extensions/tsconfig.json index b8b81721105..24895f8f083 100644 --- a/packages/graphql-extensions/tsconfig.json +++ b/packages/graphql-extensions/tsconfig.json @@ -1,9 +1,11 @@ { - "extends": "../../tsconfig", + "extends": "../../tsconfig.base", "compilerOptions": { "rootDir": "./src", "outDir": "./dist" }, "include": ["src/**/*"], - "exclude": ["**/__tests__", "**/__mocks__"] + "exclude": ["**/__tests__", "**/__mocks__"], + "references": [ + ] } diff --git a/tsconfig.base.json b/tsconfig.base.json new file mode 100644 index 00000000000..d70e94eb552 --- /dev/null +++ b/tsconfig.base.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "composite": true, + "target": "es2016", + "module": "commonjs", + "moduleResolution": "node", + "esModuleInterop": true, + "sourceMap": true, + "declaration": true, + "declarationMap": true, + "removeComments": true, + "strict": true, + "noImplicitAny": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "noUnusedParameters": true, + "noUnusedLocals": true, + "lib": ["es2017", "esnext.asynciterable"], + "types": ["node", "jest"] + } +} diff --git a/tsconfig.json b/tsconfig.json index c1cac892fae..e4bf7160934 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,20 +1,24 @@ { - "compilerOptions": { - "target": "es2016", - "module": "commonjs", - "moduleResolution": "node", - "esModuleInterop": true, - "sourceMap": true, - "declaration": true, - "declarationMap": true, - "removeComments": true, - "strict": true, - "noImplicitAny": true, - "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true, - "noUnusedParameters": true, - "noUnusedLocals": true, - "lib": ["es2017", "esnext.asynciterable"], - "types": ["node", "jest"] - } + "files": [], + "references": [ + { "path": "./packages/apollo-cache-control" }, + { "path": "./packages/apollo-datasource" }, + { "path": "./packages/apollo-datasource-rest" }, + { "path": "./packages/apollo-engine-reporting" }, + { "path": "./packages/apollo-server" }, + { "path": "./packages/apollo-server-cache-memcached" }, + { "path": "./packages/apollo-server-cache-redis" }, + { "path": "./packages/apollo-server-caching" }, + { "path": "./packages/apollo-server-cloudflare" }, + { "path": "./packages/apollo-server-core" }, + { "path": "./packages/apollo-server-errors" }, + { "path": "./packages/apollo-server-express" }, + { "path": "./packages/apollo-server-hapi" }, + { "path": "./packages/apollo-server-integration-testsuite" }, + { "path": "./packages/apollo-server-koa" }, + { "path": "./packages/apollo-server-lambda" }, + { "path": "./packages/apollo-server-micro" }, + { "path": "./packages/apollo-tracing" }, + { "path": "./packages/graphql-extensions" } + ] } diff --git a/tsconfig.test.json b/tsconfig.test.json new file mode 100644 index 00000000000..82e63f27947 --- /dev/null +++ b/tsconfig.test.json @@ -0,0 +1,3 @@ +{ + "extends": "./tsconfig.base" +}