Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade TypeScript and typecheck tests #5165

Merged
merged 2 commits into from
May 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
"editor.wordWrapColumn": 80,
"files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true,
"typescript.tsdk": "./node_modules/typescript/lib"
"typescript.tsdk": "./node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true
}
48 changes: 23 additions & 25 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "TypeScript watch",
"type": "shell",
"command": "./node_modules/.bin/tsc",
"args": [
"--build",
"tsconfig.build.json",
"--watch"
],
"isBackground": true,
"problemMatcher": [
"$tsc-watch"
],
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"reveal": "never",
"panel": "dedicated"
}
}
]
"version": "2.0.0",
"tasks": [
{
"label": "TypeScript watch",
"type": "typescript",
"tsconfig": "tsconfig.json",
"option": "watch",
"problemMatcher": ["$tsc-watch"],
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"reveal": "never",
"revealProblems": "never",
"panel": "shared",
"clear": true
},
"runOptions": {
"runOn": "folderOpen"
}
}
]
}
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ The version headers in this history reflect the versions of Apollo Server itself
- The `graphql-extensions` API (e.g., `GraphQLExtensions`, `extensions`) has been dropped in favor of the new [plugins API](https://www.apollographql.com/docs/apollo-server/integrations/plugins/).
- In order to let the `graphql-upload` package evolve on its own, uploads are no longer integrated directly with Apollo Server. To bring them back in their current form, see [the migration guide section on File Uploads](./docs/source/migration.md#File-uploads)
- Removed deprecated `ApolloServer.schema` field, which never worked with gateways. If you'd like to extract your schema from your server, make a plugin with `serverWillStart`, or register `onSchemaChange` on your gateway.
- `apollo-server-caching`: The test suite helper works differently, and the `TestableKeyValueCache` interface is removed.
- `apollo-datasource-rest`: We no longer officially support overriding the `baseURL` property with a getter, because TypeScript 4 does not allow you to do that.
- Top-level exports have changed. E.g.,

- We no longer re-export the entirety of `graphql-tools` (including `makeExecutableSchema`) from all Apollo Server packages.
Expand Down
32 changes: 0 additions & 32 deletions __mocks__/date.ts

This file was deleted.

14 changes: 1 addition & 13 deletions docs/source/data/data-sources.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -305,19 +305,7 @@ class PersonalizationAPI extends RESTDataSource {

### Resolving URLs dynamically

In some cases, you'll want to set your REST API's base URL based on the environment or other contextual values. You can use a getter for this:

```js
get baseURL() {
if (this.context.env === 'development') {
return 'https://movies-api-dev.example.com/';
} else {
return 'https://movies-api.example.com/';
}
}
```

If you need more customization, including the ability to resolve a URL asynchronously, you can also override `resolveURL`:
In some cases, you'll want to set the URL based on the environment or other contextual values. To do this, you can override `resolveURL`:

```js
async resolveURL(request: RequestOptions) {
Expand Down
10 changes: 0 additions & 10 deletions jest.config.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,6 @@ module.exports = {
"/dist/"
],
moduleFileExtensions: [...defaults.moduleFileExtensions, "ts", "tsx"],
moduleNameMapper: {
'^__mocks__/(.*)$': '<rootDir>/../../__mocks__/$1',
// This regex should match the packages that we want compiled from source
// through `ts-jest`, as opposed to loaded from their output files in
// `dist`.
// We don't want to match `apollo-server-env` and
// `apollo-reporting-protobuf`, because these don't depend on
// compilation but need to be initialized from as parto of `prepare`.
'^(?!apollo-server-env|apollo-reporting-protobuf)(apollo-(?:server|datasource|cache-control|tracing)[^/]*)(?:/dist)?((?:/.*)|$)': '<rootDir>/../../packages/$1/src$2'
},
clearMocks: true,
globals: {
"ts-jest": {
Expand Down
Loading