From f8f0260975175c0b4f1a6988f41aff2922028f97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20My=C5=9Bliwiec?= Date: Wed, 1 Mar 2023 12:20:58 +0100 Subject: [PATCH] docs(graphql): update apollo packages, migration guide --- content/graphql/migration.md | 38 ++++++++++++++++++++++++++++++++-- content/graphql/quick-start.md | 4 ++-- 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/content/graphql/migration.md b/content/graphql/migration.md index e186b0a285..89d57fa83e 100644 --- a/content/graphql/migration.md +++ b/content/graphql/migration.md @@ -1,6 +1,40 @@ -### Migrating to v10 +### Migrating to v11 from v10 -This article provides a set of guidelines for migrating from `@nestjs/graphql` version 9 to version 10. The focus of this major-version release is to provide a lighter, platform-agnostic core library. +This chapter provides a set of guidelines for migrating from `@nestjs/graphql` version 10 to version 11. As part of this major release, we updated the Apollo driver to be compatible with Apollo Server v4 (instead of v3). Note: there are several breaking changes in Apollo Server v4 (especially around plugins and ecosystem packages), so you'll have to update your codebase accordingly. For more information, see the [Apollo Server v4 migration guide](https://www.apollographql.com/docs/apollo-server/migration/). + +#### Apollo packages + +Instead of installing the `apollo-server-express` package, you'll have to install the `@apollo/server` instead: + +```bash +$ npm uninstall apollo-server-express +$ npm install @apollo/server +``` + +If you use the Fastify adapter, you'll have to install the `@as-integrations/fastify` package instead: + +```bash +$ npm uninstall apollo-server-fastify +$ npm install @apollo/server @as-integrations/fastify +``` + +#### Mercurius packages + +Mercurius gateway is no longer a part of the `mercurius` package. Instead, you'll have to install the `@mercuriusjs/gateway` package separately: + +```bash +$ npm install @mercuriusjs/gateway +``` + +Similarly, for creating federated schemas, you'll have to install the `@mercuriusjs/federation` package: + +```bash +$ npm install @mercuriusjs/federation +``` + +### Migrating to v10 from v9 + +This chapter provides a set of guidelines for migrating from `@nestjs/graphql` version 9 to version 10. The focus of this major-version release is to provide a lighter, platform-agnostic core library. #### Introducing "driver" packages diff --git a/content/graphql/quick-start.md b/content/graphql/quick-start.md index eb3fda4be1..40fb789728 100644 --- a/content/graphql/quick-start.md +++ b/content/graphql/quick-start.md @@ -12,10 +12,10 @@ Start by installing the required packages: ```bash # For Express and Apollo (default) -$ npm i @nestjs/graphql @nestjs/apollo graphql apollo-server-express +$ npm i @nestjs/graphql @nestjs/apollo @apollo/server graphql # For Fastify and Apollo -# npm i @nestjs/graphql @nestjs/apollo graphql apollo-server-fastify +# npm i @nestjs/graphql @nestjs/apollo @apollo/server @as-integrations/fastify graphql # For Fastify and Mercurius # npm i @nestjs/graphql @nestjs/mercurius graphql mercurius