Skip to content

Commit

Permalink
Merge pull request backstage#27804 from backstage/no-express-5-types
Browse files Browse the repository at this point in the history
Fix issues with type incompatibility between major versions of @types/express
  • Loading branch information
mtlewis authored Nov 25, 2024
2 parents 9dbdb60 + 7dcff85 commit 207e217
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 15 deletions.
6 changes: 6 additions & 0 deletions .changeset/cold-icons-worry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@backstage/cli': patch
---

Remove special-casing for `@types` packages when generating dependency entries
during templating
8 changes: 8 additions & 0 deletions .changeset/odd-apples-explain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@backstage/plugin-auth-node': patch
'@backstage/plugin-permission-backend': patch
'@backstage/plugin-devtools-backend': patch
'@backstage/plugin-signals-backend': patch
---

Restrict `@types/express` version range from `*` to `^4.17.6`.
5 changes: 4 additions & 1 deletion packages/cli/src/lib/version.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ describe('createPackageVersionProvider', () => {
expect(provider('c', '0.3.0-rc1')).toBe('0.3.0-rc1');
expect(provider('c', '0.3.0')).toBe('^0.3.0');
expect(provider('c', '0.3.6')).toBe('^0.3.4');

// No special handling for @types packages.
expect(provider('@types/t', '1.4.2')).toBe('^1.2.3');

const cliVersion = packageVersions['@backstage/cli'];
expect(provider('@backstage/cli')).toBe(
// If we're currently in pre-release we expect that to be picked instead
Expand All @@ -74,6 +78,5 @@ describe('createPackageVersionProvider', () => {
expect(provider('@backstage/core-plugin-api')).toBe(
`^${corePluginApiPkg.version}`,
);
expect(provider('@types/t', '1.4.2')).toBe('*');
});
});
6 changes: 0 additions & 6 deletions packages/cli/src/lib/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,6 @@ export function createPackageVersionProvider(lockfile?: Lockfile) {
}

const lockfileEntries = lockfile?.get(name);
if (
name.startsWith('@types/') &&
lockfileEntries?.some(entry => entry.range === '*')
) {
return '*';
}

for (const specifier of ['^', '~', '*']) {
const range = `workspace:${specifier}`;
Expand Down
2 changes: 1 addition & 1 deletion plugins/auth-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"@backstage/config": "workspace:^",
"@backstage/errors": "workspace:^",
"@backstage/types": "workspace:^",
"@types/express": "*",
"@types/express": "^4.17.6",
"@types/passport": "^1.0.3",
"express": "^4.17.1",
"jose": "^5.0.0",
Expand Down
2 changes: 1 addition & 1 deletion plugins/devtools-backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"@backstage/plugin-permission-node": "workspace:^",
"@backstage/types": "workspace:^",
"@manypkg/get-packages": "^1.1.3",
"@types/express": "*",
"@types/express": "^4.17.6",
"@yarnpkg/lockfile": "^1.1.0",
"@yarnpkg/parsers": "^3.0.0",
"express": "^4.18.1",
Expand Down
2 changes: 1 addition & 1 deletion plugins/permission-backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"@backstage/plugin-auth-node": "workspace:^",
"@backstage/plugin-permission-common": "workspace:^",
"@backstage/plugin-permission-node": "workspace:^",
"@types/express": "*",
"@types/express": "^4.17.6",
"dataloader": "^2.0.0",
"express": "^4.17.1",
"express-promise-router": "^4.1.0",
Expand Down
2 changes: 1 addition & 1 deletion plugins/signals-backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"@backstage/plugin-events-node": "workspace:^",
"@backstage/plugin-signals-node": "workspace:^",
"@backstage/types": "workspace:^",
"@types/express": "*",
"@types/express": "^4.17.6",
"express": "^4.17.1",
"express-promise-router": "^4.1.0",
"http-proxy-middleware": "^2.0.0",
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5323,7 +5323,7 @@ __metadata:
"@backstage/config": "workspace:^"
"@backstage/errors": "workspace:^"
"@backstage/types": "workspace:^"
"@types/express": "*"
"@types/express": ^4.17.6
"@types/passport": ^1.0.3
cookie-parser: ^1.4.6
express: ^4.17.1
Expand Down Expand Up @@ -6164,7 +6164,7 @@ __metadata:
"@backstage/plugin-permission-node": "workspace:^"
"@backstage/types": "workspace:^"
"@manypkg/get-packages": ^1.1.3
"@types/express": "*"
"@types/express": ^4.17.6
"@types/ping": ^0.4.1
"@types/supertest": ^2.0.8
"@types/yarnpkg__lockfile": ^1.1.4
Expand Down Expand Up @@ -6902,7 +6902,7 @@ __metadata:
"@backstage/plugin-auth-node": "workspace:^"
"@backstage/plugin-permission-common": "workspace:^"
"@backstage/plugin-permission-node": "workspace:^"
"@types/express": "*"
"@types/express": ^4.17.6
"@types/lodash": ^4.14.151
"@types/supertest": ^2.0.8
dataloader: ^2.0.0
Expand Down Expand Up @@ -7868,7 +7868,7 @@ __metadata:
"@backstage/plugin-events-node": "workspace:^"
"@backstage/plugin-signals-node": "workspace:^"
"@backstage/types": "workspace:^"
"@types/express": "*"
"@types/express": ^4.17.6
"@types/supertest": ^2.0.8
"@types/ws": ^8.5.10
express: ^4.17.1
Expand Down

0 comments on commit 207e217

Please sign in to comment.