Skip to content

Commit

Permalink
Add migration guide
Browse files Browse the repository at this point in the history
  • Loading branch information
fraxachun committed Dec 18, 2024
1 parent 8bd18ee commit 84316fd
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions docs/docs/migration/migration-from-v7-to-v8.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ It automatically installs the new versions of all `@comet` libraries, runs an ES
- Run MUI codemods
- Upgrade MUI X packages to v6
- Upgrade NestJS packages to v10
- Remove passport-dependencies (we don't use passport anymore)
- Add @nestjs/jwt dependencys

</details>

Expand Down Expand Up @@ -126,8 +128,55 @@ The class-validator peer dependency has been bumped to v0.14.0:
npx @comet/upgrade v8/update-class-validator.ts
```

#### Remove passport

Remove all passport-dependencies and add @nestjs/jwt

```diff title=api/package.json
{
"dependencies": {
- "@nestjs/passport": "^9.0.0",
- ...other passport dependencies
+ "@nestjs/jwt": "^10.2.0",
}
}
```

:::note Codemod available

```sh
npx @comet/upgrade v8/remove-passport.ts
```

:::

Wrap the strategies in `...createAuthGuardProviders()`:

```diff title=api/src/auth/auth.module.ts
- createStaticCredentialsBasicStrategy({ ... }),
- createAuthProxyJwtStrategy({ ... }),
+ ...createAuthGuardProviders(
+ createStaticCredentialsBasicStrategy({ ... }),
+ createAuthProxyJwtStrategy({ ... }),
+ ),
```

:::note The configuration of the strategies may have changed slightly. Consulting the code completion should help to adapt.

Replace `createAuthResolver` with the class name:

```diff title=api/src/auth/auth.module.ts
- useClass: createCometAuthGuard([...]),
+ useClass: CometAuthGuard,
```

Import `JwtModule` from `@nestjs/jwt`:

```diff title=api/src/auth/auth.module.ts
exports: [UserService, AccessControlService],
+ imports: [JwtModule],
```

## Admin

### Stay on same page after changing scope
Expand Down

0 comments on commit 84316fd

Please sign in to comment.