Skip to content

Commit 14ffbae

Browse files
authored
chore: patch for backstage repo to fix tsc issues (RHDHBUGS-2166) (#1626)
Signed-off-by: Nick Boldt <[email protected]>
1 parent be5226a commit 14ffbae

File tree

1 file changed

+365
-0
lines changed

1 file changed

+365
-0
lines changed
Lines changed: 365 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,365 @@
1+
diff --git a/dist-types/plugins/techdocs-module-addons-contrib/src/ReportIssue/hooks.d.ts b/dist-types/plugins/techdocs-module-addons-contrib/src/ReportIssue/hooks.d.ts
2+
index 73db2699..f664a7ee 100644
3+
--- a/dist-types/plugins/techdocs-module-addons-contrib/src/ReportIssue/hooks.d.ts
4+
+++ b/dist-types/plugins/techdocs-module-addons-contrib/src/ReportIssue/hooks.d.ts
5+
@@ -4,4 +4,26 @@ export declare const useGitTemplate: (debounceTime?: number) => {
6+
title: string;
7+
body: string;
8+
};
9+
-export declare const useGitRepository: () => any;
10+
+export declare const useGitRepository: () => {
11+
+ type: string;
12+
+ protocols: string[];
13+
+ port: number | null;
14+
+ resource: string;
15+
+ user: string;
16+
+ pathname: string;
17+
+ hash: string;
18+
+ search: string;
19+
+ href: string;
20+
+ protocol: string;
21+
+ token: string;
22+
+ source: string;
23+
+ owner: string;
24+
+ name: string;
25+
+ ref: string;
26+
+ filepath: string;
27+
+ filepathtype: string;
28+
+ full_name: string;
29+
+ organization: string;
30+
+ git_suffix?: boolean | undefined;
31+
+ toString(type?: string): string;
32+
+} | null;
33+
diff --git a/package.json b/package.json
34+
index a985967d..3595c917 100644
35+
--- a/package.json
36+
+++ b/package.json
37+
@@ -131,8 +131,13 @@
38+
"@storybook/react-vite": "^8.6.12",
39+
"@techdocs/cli": "^1.9.7",
40+
"@types/cacheable-request": "^8.3.6",
41+
+ "@types/fs-extra": "^11.0.0",
42+
+ "@types/git-url-parse": "^9.0.0",
43+
"@types/memjs": "^1.3.3",
44+
"@types/node": "^20.16.0",
45+
+ "@types/react": "^18.0.0",
46+
+ "@types/react-dom": "^18.0.0",
47+
+ "@types/react-helmet": "^6.1.0",
48+
"@types/webpack": "^5.28.0",
49+
"array-to-table": "^1.0.1",
50+
"command-exists": "^1.2.9",
51+
diff --git a/plugins/kubernetes/src/alpha/entityContents.tsx b/plugins/kubernetes/src/alpha/entityContents.tsx
52+
index d75893c6..ff4dadf7 100644
53+
--- a/plugins/kubernetes/src/alpha/entityContents.tsx
54+
+++ b/plugins/kubernetes/src/alpha/entityContents.tsx
55+
@@ -18,7 +18,7 @@ import { compatWrapper } from '@backstage/core-compat-api';
56+
import { EntityContentBlueprint } from '@backstage/plugin-catalog-react/alpha';
57+
import { isKubernetesAvailable } from '../Router';
58+
59+
-export const entityKubernetesContent = EntityContentBlueprint.make({
60+
+export const entityKubernetesContent: any = EntityContentBlueprint.make({
61+
name: 'kubernetes',
62+
params: {
63+
path: '/kubernetes',
64+
diff --git a/plugins/kubernetes/src/alpha/plugin.tsx b/plugins/kubernetes/src/alpha/plugin.tsx
65+
index db7b2439..a9fb3732 100644
66+
--- a/plugins/kubernetes/src/alpha/plugin.tsx
67+
+++ b/plugins/kubernetes/src/alpha/plugin.tsx
68+
@@ -26,11 +26,12 @@ import {
69+
kubernetesProxyApi,
70+
} from './apis';
71+
72+
-export default createFrontendPlugin({
73+
+const plugin: any = createFrontendPlugin({
74+
pluginId: 'kubernetes',
75+
info: { packageJson: () => import('../../package.json') },
76+
extensions: [
77+
kubernetesPage,
78+
+ // @ts-ignore - Type incompatibility due to duplicate @backstage/frontend-plugin-api versions
79+
entityKubernetesContent,
80+
kubernetesApi,
81+
kubernetesProxyApi,
82+
@@ -39,3 +40,5 @@ export default createFrontendPlugin({
83+
],
84+
routes: convertLegacyRouteRefs({ kubernetes: rootCatalogKubernetesRouteRef }),
85+
});
86+
+
87+
+export default plugin;
88+
diff --git a/plugins/notifications-backend/src/plugin.ts b/plugins/notifications-backend/src/plugin.ts
89+
index 5f430318..231052ba 100644
90+
--- a/plugins/notifications-backend/src/plugin.ts
91+
+++ b/plugins/notifications-backend/src/plugin.ts
92+
@@ -22,6 +22,7 @@ import { createRouter } from './service/router';
93+
import { signalsServiceRef } from '@backstage/plugin-signals-node';
94+
import {
95+
NotificationProcessor,
96+
+ NotificationRecipientResolver,
97+
notificationsProcessingExtensionPoint,
98+
NotificationsProcessingExtensionPoint,
99+
} from '@backstage/plugin-notifications-node';
100+
@@ -33,6 +34,7 @@ class NotificationsProcessingExtensionPointImpl
101+
implements NotificationsProcessingExtensionPoint
102+
{
103+
#processors = new Array<NotificationProcessor>();
104+
+ #recipientResolver?: NotificationRecipientResolver;
105+
106+
addProcessor(
107+
...processors: Array<NotificationProcessor | Array<NotificationProcessor>>
108+
@@ -40,9 +42,17 @@ class NotificationsProcessingExtensionPointImpl
109+
this.#processors.push(...processors.flat());
110+
}
111+
112+
+ setNotificationRecipientResolver(resolver: NotificationRecipientResolver): void {
113+
+ this.#recipientResolver = resolver;
114+
+ }
115+
+
116+
get processors() {
117+
return this.#processors;
118+
}
119+
+
120+
+ get recipientResolver() {
121+
+ return this.#recipientResolver;
122+
+ }
123+
}
124+
125+
/**
126+
diff --git a/plugins/notifications/src/alpha.tsx b/plugins/notifications/src/alpha.tsx
127+
index 6d32150c..e98ec494 100644
128+
--- a/plugins/notifications/src/alpha.tsx
129+
+++ b/plugins/notifications/src/alpha.tsx
130+
@@ -50,7 +50,7 @@ const api = ApiBlueprint.make({
131+
});
132+
133+
/** @alpha */
134+
-export default createFrontendPlugin({
135+
+const plugin: any = createFrontendPlugin({
136+
pluginId: 'notifications',
137+
info: { packageJson: () => import('../package.json') },
138+
routes: convertLegacyRouteRefs({
139+
@@ -59,3 +59,5 @@ export default createFrontendPlugin({
140+
// TODO(Rugvip): Nav item (i.e. NotificationsSidebarItem) currently needs to be installed manually
141+
extensions: [page, api],
142+
});
143+
+
144+
+export default plugin;
145+
diff --git a/plugins/techdocs-backend/src/DocsBuilder/builder.ts b/plugins/techdocs-backend/src/DocsBuilder/builder.ts
146+
index 446d692b..00257883 100644
147+
--- a/plugins/techdocs-backend/src/DocsBuilder/builder.ts
148+
+++ b/plugins/techdocs-backend/src/DocsBuilder/builder.ts
149+
@@ -183,7 +183,7 @@ export class DocsBuilder {
150+
);
151+
await this.generator.run({
152+
inputDir: preparedDir,
153+
- outputDir,
154+
+ outputDir: outputDir!,
155+
parsedLocationAnnotation,
156+
etag: newEtag,
157+
logger: this.logger,
158+
@@ -205,7 +205,7 @@ export class DocsBuilder {
159+
160+
const published = await this.publisher.publish({
161+
entity: this.entity,
162+
- directory: outputDir,
163+
+ directory: outputDir!,
164+
});
165+
166+
// Invalidate the cache for any published objects.
167+
diff --git a/plugins/techdocs-backend/src/service/router.test.ts b/plugins/techdocs-backend/src/service/router.test.ts
168+
index 233f679f..5bc67768 100644
169+
--- a/plugins/techdocs-backend/src/service/router.test.ts
170+
+++ b/plugins/techdocs-backend/src/service/router.test.ts
171+
@@ -390,7 +390,8 @@ describe('createEventStream', () => {
172+
});
173+
174+
it('should flush after write if defined', async () => {
175+
- res.flush = jest.fn();
176+
+ const resWithFlush = res as typeof res & { flush: jest.Mock };
177+
+ resWithFlush.flush = jest.fn();
178+
179+
handlers.log('A Message');
180+
181+
@@ -399,7 +400,7 @@ describe('createEventStream', () => {
182+
data: "A Message"
183+
184+
`);
185+
- expect(res.flush).toHaveBeenCalledTimes(1);
186+
+ expect(resWithFlush.flush).toHaveBeenCalledTimes(1);
187+
});
188+
189+
it('should write log', async () => {
190+
diff --git a/plugins/techdocs-backend/src/service/router.ts b/plugins/techdocs-backend/src/service/router.ts
191+
index 7ce26232..346240ea 100644
192+
--- a/plugins/techdocs-backend/src/service/router.ts
193+
+++ b/plugins/techdocs-backend/src/service/router.ts
194+
@@ -361,8 +361,9 @@ export function createEventStream(
195+
res.write(`event: ${type}\ndata: ${JSON.stringify(data)}\n\n`);
196+
197+
// res.flush() is only available with the compression middleware
198+
- if (res.flush) {
199+
- res.flush();
200+
+ const resWithFlush = res as typeof res & { flush?: () => void };
201+
+ if (resWithFlush.flush) {
202+
+ resWithFlush.flush();
203+
}
204+
};
205+
206+
diff --git a/plugins/techdocs-module-addons-contrib/src/alpha.ts b/plugins/techdocs-module-addons-contrib/src/alpha.ts
207+
index acbb808a..5ccffe5b 100644
208+
--- a/plugins/techdocs-module-addons-contrib/src/alpha.ts
209+
+++ b/plugins/techdocs-module-addons-contrib/src/alpha.ts
210+
@@ -34,6 +34,7 @@ const techDocsExpandableNavigationAddon = AddonBlueprint.make({
211+
/** @alpha */
212+
export const techDocsExpandableNavigationAddonModule = createFrontendModule({
213+
pluginId: 'techdocs',
214+
+ // @ts-ignore - Type incompatibility due to duplicate @backstage/frontend-plugin-api versions
215+
extensions: [techDocsExpandableNavigationAddon],
216+
});
217+
218+
@@ -50,6 +51,7 @@ const techDocsReportIssueAddon = AddonBlueprint.make({
219+
/** @alpha */
220+
export const techDocsReportIssueAddonModule = createFrontendModule({
221+
pluginId: 'techdocs',
222+
+ // @ts-ignore - Type incompatibility due to duplicate @backstage/frontend-plugin-api versions
223+
extensions: [techDocsReportIssueAddon],
224+
});
225+
226+
@@ -66,6 +68,7 @@ const techDocsTextSizeAddon = AddonBlueprint.make({
227+
/** @alpha */
228+
export const techDocsTextSizeAddonModule = createFrontendModule({
229+
pluginId: 'techdocs',
230+
+ // @ts-ignore - Type incompatibility due to duplicate @backstage/frontend-plugin-api versions
231+
extensions: [techDocsTextSizeAddon],
232+
});
233+
234+
@@ -82,5 +85,6 @@ const techDocsLightBoxAddon = AddonBlueprint.make({
235+
/** @alpha */
236+
export const techDocsLightBoxAddonModule = createFrontendModule({
237+
pluginId: 'techdocs',
238+
+ // @ts-ignore - Type incompatibility due to duplicate @backstage/frontend-plugin-api versions
239+
extensions: [techDocsLightBoxAddon],
240+
});
241+
diff --git a/plugins/techdocs/src/alpha/index.tsx b/plugins/techdocs/src/alpha/index.tsx
242+
index 5b103387..d59aa558 100644
243+
--- a/plugins/techdocs/src/alpha/index.tsx
244+
+++ b/plugins/techdocs/src/alpha/index.tsx
245+
@@ -104,7 +104,7 @@ const techDocsClientApi = ApiBlueprint.make({
246+
});
247+
248+
/** @alpha */
249+
-export const techDocsSearchResultListItemExtension =
250+
+export const techDocsSearchResultListItemExtension: any =
251+
SearchResultListItemBlueprint.makeWithOverrides({
252+
config: {
253+
schema: {
254+
@@ -244,7 +244,7 @@ const techDocsNavItem = NavItemBlueprint.make({
255+
});
256+
257+
/** @alpha */
258+
-export default createFrontendPlugin({
259+
+const plugin: any = createFrontendPlugin({
260+
pluginId: 'techdocs',
261+
info: { packageJson: () => import('../../package.json') },
262+
extensions: [
263+
@@ -253,9 +253,12 @@ export default createFrontendPlugin({
264+
techDocsNavItem,
265+
techDocsPage,
266+
techDocsReaderPage,
267+
+ // @ts-ignore - Type incompatibility due to duplicate @backstage/frontend-plugin-api versions
268+
techdocsEntityIconLink,
269+
+ // @ts-ignore - Type incompatibility due to duplicate @backstage/frontend-plugin-api versions
270+
techDocsEntityContent,
271+
techDocsEntityContentEmptyState,
272+
+ // @ts-ignore - Type incompatibility due to duplicate @backstage/frontend-plugin-api versions
273+
techDocsSearchResultListItemExtension,
274+
],
275+
routes: convertLegacyRouteRefs({
276+
@@ -264,3 +267,5 @@ export default createFrontendPlugin({
277+
entityContent: rootCatalogDocsRouteRef,
278+
}),
279+
});
280+
+
281+
+export default plugin;
282+
diff --git a/yarn.lock b/yarn.lock
283+
index d5c9aa77..5ed4eda6 100644
284+
--- a/yarn.lock
285+
+++ b/yarn.lock
286+
@@ -12914,6 +12914,23 @@ __metadata:
287+
languageName: node
288+
linkType: hard
289+
290+
+"@types/fs-extra@npm:^11.0.0":
291+
+ version: 11.0.4
292+
+ resolution: "@types/fs-extra@npm:11.0.4"
293+
+ dependencies:
294+
+ "@types/jsonfile": "npm:*"
295+
+ "@types/node": "npm:*"
296+
+ checksum: 10/acc4c1eb0cde7b1f23f3fe6eb080a14832d8fa9dc1761aa444c5e2f0f6b6fa657ed46ebae32fb580a6700fc921b6165ce8ac3e3ba030c3dd15f10ad4dd4cae98
297+
+ languageName: node
298+
+ linkType: hard
299+
+
300+
+"@types/git-url-parse@npm:^9.0.0":
301+
+ version: 9.0.3
302+
+ resolution: "@types/git-url-parse@npm:9.0.3"
303+
+ checksum: 10/ae5389bf4339e0e863d84e92cd8af137ea485ea7141a25998300ae38ba471617af004791f4c6f86431eb5fb0c70ad4dda3558ca9b0a020a3897058e95a91515e
304+
+ languageName: node
305+
+ linkType: hard
306+
+
307+
"@types/global-agent@npm:^2.1.3":
308+
version: 2.1.3
309+
resolution: "@types/global-agent@npm:2.1.3"
310+
@@ -13078,6 +13095,15 @@ __metadata:
311+
languageName: node
312+
linkType: hard
313+
314+
+"@types/jsonfile@npm:*":
315+
+ version: 6.1.4
316+
+ resolution: "@types/jsonfile@npm:6.1.4"
317+
+ dependencies:
318+
+ "@types/node": "npm:*"
319+
+ checksum: 10/309fda20eb5f1cf68f2df28931afdf189c5e7e6bec64ac783ce737bb98908d57f6f58757ad5da9be37b815645a6f914e2d4f3ac66c574b8fe1ba6616284d0e97
320+
+ languageName: node
321+
+ linkType: hard
322+
+
323+
"@types/jsonwebtoken@npm:^9.0.0":
324+
version: 9.0.0
325+
resolution: "@types/jsonwebtoken@npm:9.0.0"
326+
@@ -13317,6 +13343,24 @@ __metadata:
327+
languageName: node
328+
linkType: hard
329+
330+
+"@types/react-dom@npm:^18.0.0":
331+
+ version: 18.3.7
332+
+ resolution: "@types/react-dom@npm:18.3.7"
333+
+ peerDependencies:
334+
+ "@types/react": ^18.0.0
335+
+ checksum: 10/317569219366d487a3103ba1e5e47154e95a002915fdcf73a44162c48fe49c3a57fcf7f57fc6979e70d447112681e6b13c6c3c1df289db8b544df4aab2d318f3
336+
+ languageName: node
337+
+ linkType: hard
338+
+
339+
+"@types/react-helmet@npm:^6.1.0":
340+
+ version: 6.1.11
341+
+ resolution: "@types/react-helmet@npm:6.1.11"
342+
+ dependencies:
343+
+ "@types/react": "npm:*"
344+
+ checksum: 10/e329d8ad82c365fec7dd7d91c8b6d167faac30cef0d9f1e27d7e895172a0ebfa65829fb4acabbe79283b01cbbe5840a845caeb50148ceef6f3fad42b3c2c4bdc
345+
+ languageName: node
346+
+ linkType: hard
347+
+
348+
"@types/react-redux@npm:^7.1.16":
349+
version: 7.1.19
350+
resolution: "@types/react-redux@npm:7.1.19"
351+
@@ -31220,9 +31264,14 @@ __metadata:
352+
"@storybook/react-vite": "npm:^8.6.12"
353+
"@techdocs/cli": "npm:^1.9.7"
354+
"@types/cacheable-request": "npm:^8.3.6"
355+
+ "@types/fs-extra": "npm:^11.0.0"
356+
+ "@types/git-url-parse": "npm:^9.0.0"
357+
"@types/global-agent": "npm:^2.1.3"
358+
"@types/memjs": "npm:^1.3.3"
359+
"@types/node": "npm:^20.16.0"
360+
+ "@types/react": "npm:^18.0.0"
361+
+ "@types/react-dom": "npm:^18.0.0"
362+
+ "@types/react-helmet": "npm:^6.1.0"
363+
"@types/webpack": "npm:^5.28.0"
364+
"@useoptic/optic": "npm:^1.0.0"
365+
array-to-table: "npm:^1.0.1"

0 commit comments

Comments
 (0)