Migrating from v7 to v8
The following sections go over all necessary changes. They also give recommendations on how to structure your PRs and commits.
Many changes can be handled by upgrade scripts. Use them!
The 🤖 emoji marks changes that can be handled by an upgrade script. You just have to execute the script. Below the command there usually is a details drawer that describes the changes made.
Prerequisites
There are some steps that are necessary for the COMET v8 update but can be done beforehand:
Step 1: Upgrade node to v22 (PR #1)
You can skip this step if your project already uses node v22
Create a branch node-22.
Then make the following changes:
🤖 In development:
npx @comet/upgrade@latest v8/replace-node-with-v22-locally.ts
Details
- 20
+ 22
- "@types/node": "^20.0.0",
+ "@types/node": "^22.0.0",
🤖 In pipeline and deployment:
npx @comet/upgrade@latest v8/replace-node-with-v22-in-gitlab-ci-files.ts
Details
Make sure you use Node 22 in your CI files. When using Gitlab CI, check all files in the .gitlab-ci folders. Make sure to extend the correct jobs and replace all images and base images.
- extends: .lint-npm-node20
+ extends: .lint-npm-node22
- BASE_IMAGE: "ubi/s2i-ubi9-nodejs20-minimal"
+ BASE_IMAGE: "ubi/s2i-ubi9-nodejs22-minimal"
- image: eu.gcr.io/vivid-planet/utils/ubi9-nodejs20-minimal:master
+ image: eu.gcr.io/vivid-planet/utils/ubi9-nodejs22-minimal:master
Now open a PR from node-22 to main
Step 2: Update Typescript to v5 (PR #2)
You can skip this step if your project already uses typescript v5 everywhere
Create a branch typescript-5.
-
Make the following changes:
package.json- "typescript": "^4.2.3",
+ "typescript": "^5.9.3",api/package.json- "typescript": "^4.2.3",
+ "typescript": "^5.9.3",admin/package.json- "typescript": "^4.2.3",
+ "typescript": "^5.9.3",site/package.json- "typescript": "^4.2.3",
+ "typescript": "^5.9.3", -
Execute
npm installin each folder (/api,/admin,/site,/)Check carefully for errors during the install. Errors might occur because of other packages that depend on typescript v4. Update such packages to make the errors disappear.
-
Execute
npm run lintin the root directory.Fix occurring errors.
You might also see a warning like this:
=============
WARNING: You are currently running a version of TypeScript which is not officially supported by @typescript-eslint/typescript-estree.
You may find that it works just fine, or you may not.
SUPPORTED TYPESCRIPT VERSIONS: >=3.3.1 <5.2.0
YOUR TYPESCRIPT VERSION: 5.9.3
Please only submit bug reports when using the officially supported version.
=============Ignore this warning for now.
-
Check if the app still starts
Now open a PR from typescript-5 to main
Step 3: Switch from @comet/cms-site to @comet/site-nextjs (PR #3)
You can skip this step if your project doesn't have a site
This doesn't work if you use other packages that depend on @comet/cms-site.
In that case, skip this step for now and do it later during the v8 update.
The @comet/cms-site package has been reworked and renamed to @comet/site-nextjs. Notable changes are
- Styled components is no longer a required peer dependency
- Instead, SCSS modules are used internally
- The package is now pure ESM
To switch you must
-
Create a branch
switch-to-site-nextjs -
cd site -
npm uninstall @comet/cms-site -
npm install @comet/site-nextjs@7 -
Change all imports from
@comet/cms-siteto@comet/site-nextjs(with search and replace in your IDE) -
Import the css file exported by the package:
site/src/app/layout.tsx+ import "@comet/site-nextjs/css"; -
Switch the package in
optimizePackageImports:site/next.config.mjsconst nextConfig = {
// ...
experimental: {
instrumentationHook: true,
- optimizePackageImports: ["@comet/cms-site"],
+ optimizePackageImports: ["@comet/site-nextjs"],
},
// ...
}
Now open a PR from switch-to-site-nextjs to main
Step 4: Update eslint and prettier (PR #4)
Create a branch update-eslint-to-v9
🤖 Upgrade ESLint from v8 to v9 with ESM
npx @comet/upgrade@latest v8/eslint-dev-dependencies.ts
Handled by @comet/upgrade
Update ESLint to v9
package.json
- "eslint": "^8.0.0",
+ "eslint": "^9.0.0",
An ESM compatible ESLint config is required. Delete the related .eslintrc.json and move the configured rules to the new ESLint flat configuration eslint.config.mjs.
Migration Guide of ESLint 9.0 can be found here: Migration Guide
admin/eslint.config.mjs
import cometConfig from "@comet/eslint-config/react.js";
/** @type {import('eslint')} */
const config = [
{
ignores: ["schema.json", "src/fragmentTypes.json", "dist/**", "src/**/*.generated.ts"],
},
...cometConfig
];
export default config;
api/eslint.config.mjs
import cometConfig from "@comet/eslint-config/react.js";
/** @type {import('eslint')} */
import cometConfig from "@comet/eslint-config/nestjs.js";
/** @type {import('eslint')} */
const config = [
{
ignores: ["src/db/migrations/**", "dist/**", "src/**/*.generated.ts"],
},
...cometConfig,
];
export default config;
site/eslint.config.mjs
import cometConfig from "@comet/eslint-config/react.js";
/** @type {import('eslint')} */
import cometConfig from "@comet/eslint-config/nextjs.js";
/** @type {import('eslint')} */
const config = [
{
ignores: ["**/**/*.generated.ts", "dist/**", "lang/**", "lang-compiled/**", "lang-extracted/**", ".next/**", "public/**"],
},
...cometConfig,
];
export default config;
After executing the script, create a commit with --no-verify.
Migrate custom eslint rules
The upgrade script only creates a simple version of the new eslint.config.mjs.
It adds the old config from .eslintrc.json to the new file as a comment at the top.
You must now manually go through all the eslint configs and migrate your custom rules (if you have any).
- Check
api/eslint.config.mjs,admin/eslint.config.mjsandsite/eslint.config.mjs - Migrate custom rules
- Remove the comment from the file
- Create a commit with
--no-verify
🤖 Upgrade Prettier from v2 to v3
npx @comet/upgrade@latest v8/prettier-dev-dependencies.ts
Handled by @comet/upgrade
- "prettier": "^2.8.1",
+ "prettier": "^3.4.2",
After executing the script, create a commit with --no-verify.
Upgrade @comet/eslint-config to v8
Yes, you can do that before updating everything else to v8.
-
Change the version numbers:
api/package.json- "@comet/eslint-config": "7.24.0",
+ "@comet/eslint-config": "8.0.0", // replace with the newest v8 versionadmin/package.json- "@comet/eslint-config": "7.24.0",
+ "@comet/eslint-config": "8.0.0", // replace with the newest v8 versionsite/package.json- "@comet/eslint-config": "7.24.0",
+ "@comet/eslint-config": "8.0.0", // replace with the newest v8 version -
Execute
npm install(it might be necessary to usenpm install --force) -
Create a commit with
--no-verify
API
- Run
npm run lint:eslint -- --fixto autofix all fixable issues - Commit your changes with
--no-verify - Run
npm run lintand manually fix all open issues - Commit your changes with
--no-verify
Admin
-
Run
npm run lint:eslint -- --fixto autofix all fixable issues -
Commit your changes with
--no-verify -
Add
react-jsxto yourtsconfig.json:- "jsx": "react",
+ "jsx": "react-jsx", -
🤖 Remove React barrel imports
Importing
Reactis no longer necessary due to the new JSX transform, which automatically imports the necessaryreact/jsx-runtimefunctions. Use individual named imports instead, e.g,import { useState } from "react".Execute the following upgrade script:npx @comet/upgrade@latest v8/remove-react-barrel-imports-admin.ts -
Commit your changes with
--no-verify -
🤖 Ignore import restrictions for
@mui/material(this is done temporarily, we'll fix this later during the v8 update)Execute the following upgrade script:npx @comet/upgrade@latest v8/ignore-restricted-imports-admin.ts -
Commit your changes with
--no-verify -
Run
npm run lintand manually fix all open issues -
Commit your changes with
--no-verify
Site
-
Run
npm run lint:eslint -- --fixto autofix all fixable issues -
Commit your changes with
--no-verify -
🤖 Remove React barrel imports
Importing
Reactis no longer necessary due to the new JSX transform, which automatically imports the necessaryreact/jsx-runtimefunctions. Use individual named imports instead, e.g,import { useState } from "react".Execute the following upgrade script:npx @comet/upgrade@latest v8/remove-react-barrel-imports-site.ts -
Commit your changes with
--no-verify -
Run
npm run lintand manually fix all open issues -
Commit your changes without
--no-verify. There should be no remaining errors.
Now open a PR from update-eslint-to-v9 to main
Update process
Once all the above PRs are merged, you can now start the actual v8 update. We recommend doing it service-by-service like this:
- Root
- API
- Update the versions in package.json
- Execute
npm install - Execute all the steps in the migration guide. Commit with
--no-verifyafter each step - Run
npm run lintand fix all remaining errors - Start the API. Fix runtime errors if there are any.
- Repeat for admin
- Repeat for site
Root
-
Create a
update-to-comet-v8branch -
Open the root
package.json -
Change the version for
@comet/cli:- "@comet/cli": "7.25.4",
+ "@comet/cli": "8.0.0", // replace with the newest v8 version -
Execute
npm install -
Execute
npm run create-site-configs-env -
Create a commit
API
Before installing, we must update the following dependency versions:
🤖 Upgrade peer dependencies
The following upgrade script will update peer dependency versions and make some minor changes in the code.
npx @comet/upgrade@latest v8/api/before-install
Updates handled by this batch upgrade script
✅ NestJS
Upgrade all your dependencies to support NestJS v11
Handled by @comet/upgrade
npx @comet/upgrade@latest v8/api/before-install/update-nest-dependencies.ts
{
"dependencies": {
+ "@apollo/server": "^5.1.0",
+ "@as-integrations/express5": "^1.1.2",
- "@nestjs/apollo": "^10.0.0",
- "@nestjs/common": "^9.0.0",
- "@nestjs/config": "^2.0.0",
- "@nestjs/core": "^9.0.0",
- "@nestjs/graphql": "^10.0.0",
- "@nestjs/passport": "^9.0.0",
- "@nestjs/platform-express": "^9.0.0",
+ "@nestjs/apollo": "^13.2.1",
+ "@nestjs/common": "^11.0.0",
+ "@nestjs/core": "^11.0.0",
+ "@nestjs/graphql": "^13.0.0",
+ "@nestjs/passport": "^11.0.0",
+ "@nestjs/platform-express": "^11.0.0",
- "apollo-server-core": "^3.0.0",
- "apollo-server-express": "^3.0.0",
- "express": "^4.0.0",
+ "express": "^5.0.0",
- "graphql": "^15.0.0",
+ "graphql": "^16.10.0",
},
"devDependencies": {
- "@nestjs/cli": "^9.0.0",
- "@nestjs/schematics": "^9.0.0",
- "@nestjs/testing": "^9.0.0",
+ "@nestjs/cli": "^11.0.0",
+ "@nestjs/schematics": "^11.0.0",
+ "@nestjs/testing": "^11.0.0",
- "@types/express": "^4.0.0",
+ "@types/express": "^5.0.0",
}
}
✅ Fix peer dependency conflict and knip problems caused by @apollo/server
Handled by @comet/upgrade
npx @comet/upgrade@latest v8/api/before-install/add-apollo-server-override.ts
+ "overrides": {
+ "@apollo/server-plugin-landing-page-graphql-playground": {
+ "@apollo/server": "^5.0.0"
+ }
+ },
If you are using knip:
"ignoreDependencies": [
"@mikro-orm/cli",
"jest-junit",
+ "@as-integrations/express5"
],
✅ Add NestJS peer dependencies
Peer dependencies defined by NestJS have been added as peer dependencies to @comet/cms-api.
Handled by @comet/upgrade
npx @comet/upgrade@latest v8/api/before-install/nest-peer-dependencies.ts
To upgrade, install the dependencies in your project:
{
"dependencies": {
+ "class-transformer": "^0.5.1",
- "reflect-metadata": "^0.1.13",
+ "reflect-metadata": "^0.2.2",
- "rxjs": "^7.0.0",
+ "rxjs": "^7.8.1",
}
}
✅ MikroORM
Upgrade all MikroORM dependencies to v6.
Handled by @comet/upgrade
npx @comet/upgrade@latest v8/api/before-install/update-mikro-orm-dependencies.ts
{
"dependencies": {
- "@mikro-orm/cli": "^5.9.8",
- "@mikro-orm/core": "^5.9.8",
- "@mikro-orm/migrations": "^5.9.8",
- "@mikro-orm/nestjs": "^5.2.3",
- "@mikro-orm/postgresql": "^5.9.8",
+ "@mikro-orm/cli": "^6.4.0",
+ "@mikro-orm/core": "^6.4.0",
+ "@mikro-orm/migrations": "^6.4.0",
+ "@mikro-orm/nestjs": "^6.0.2",
+ "@mikro-orm/postgresql": "^6.4.0",
},
}
✅ class-validator
The class-validator peer dependency has been bumped to v0.14.0.
Handled by @comet/upgrade
npx @comet/upgrade@latest v8/api/before-install/update-class-validator.ts
{
"dependencies": {
- "class-validator": "0.13.2",
+ "class-validator": "^0.14.0",
}
}
✅ Sentry
The Sentry dependency has been bumped to v9.
Handled by @comet/upgrade
npx @comet/upgrade@latest v8/api/before-install/update-sentry.ts
-
Upgrade the "@sentry/node" dependency in your
package.jsonfile:{
"dependencies": {
- "@sentry/node": "^7.0.0",
+ "@sentry/node": "^9.0.0",
},
} -
Update your
main.tsfile to remove allSentry.Handlersand addSentry.setupExpressErrorHandler(app):- app.use(Sentry.Handlers.requestHandler());
- app.use(Sentry.Handlers.tracingHandler());
- app.use(Sentry.Handlers.errorHandler());
+ Sentry.setupExpressErrorHandler(app);
None of the other breaking changes in @sentry/node should affect us. If you still encounter problems, consult the official migration guides: