Skip to content

Commit 827b5ae

Browse files
committed
OCPBUGS-78980: Update @graphql-codegen packages for Node.js 25 compatibility
The console build fails on Node.js 25 because @graphql-codegen/cli@1.x transitively depends on buffer-equal-constant-time, which uses the removed SlowBuffer API. Upgrading to codegen v5 eliminates this dependency chain.
1 parent 46a9c16 commit 827b5ae

16 files changed

Lines changed: 1695 additions & 1434 deletions

File tree

frontend/package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@
184184
"fuzzysearch": "1.0.x",
185185
"gherkin-lint": "^4.1.3",
186186
"git-url-parse": "^11.4.0",
187-
"graphql": "^14.0.0",
187+
"graphql": "^15.0.0",
188188
"i18next": "^25.8.18",
189189
"i18next-browser-languagedetector": "^8.2.1",
190190
"i18next-conv": "16.0.0",
@@ -230,10 +230,10 @@
230230
"devDependencies": {
231231
"@babel/core": "^7.28.5",
232232
"@cypress/webpack-preprocessor": "^7.0.2",
233-
"@graphql-codegen/cli": "^1.15.1",
234-
"@graphql-codegen/typescript": "^1.15.1",
235-
"@graphql-codegen/typescript-graphql-files-modules": "^1.15.1",
236-
"@graphql-codegen/typescript-operations": "^1.15.1",
233+
"@graphql-codegen/cli": "^5.0.0",
234+
"@graphql-codegen/typescript": "^4.0.0",
235+
"@graphql-codegen/typescript-graphql-files-modules": "^3.0.0",
236+
"@graphql-codegen/typescript-operations": "^4.0.0",
237237
"@pmmmwh/react-refresh-webpack-plugin": "^0.6.2",
238238
"@swc/core": "^1.15.18",
239239
"@swc/jest": "^0.2.39",
@@ -245,6 +245,7 @@
245245
"@types/glob": "7.x",
246246
"@types/immutable": "3.x",
247247
"@types/jest": "^30.0.0",
248+
"@types/js-yaml": "3.12.10",
248249
"@types/json-schema": "^7.0.7",
249250
"@types/lodash-es": "^4.17.12",
250251
"@types/node": "22.x",
@@ -273,7 +274,7 @@
273274
"find-up": "4.x",
274275
"fork-ts-checker-webpack-plugin": "9.1.0",
275276
"glob": "7.x",
276-
"graphql-tag": "^2.10.3",
277+
"graphql-tag": "^2.12.6",
277278
"html-webpack-plugin": "5.6.5",
278279
"html-webpack-skip-assets-plugin": "^1.0.4",
279280
"husky": "^8.0.3",

frontend/packages/console-shared/src/components/editor/yaml-download-utils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import { saveAs } from 'file-saver';
22
import { safeLoad } from 'js-yaml';
3+
import type { K8sResourceKind } from '@console/dynamic-plugin-sdk/src';
34

45
export const downloadYaml = (data: BlobPart) => {
56
const blob = new Blob([data], { type: 'text/yaml;charset=utf-8' });
67
let filename = 'k8s-object.yaml';
78
try {
8-
const obj = safeLoad(data);
9+
const obj = safeLoad(String(data)) as K8sResourceKind;
910
if (obj.kind) {
1011
filename = `${obj.kind.toLowerCase()}-${obj.metadata.name}.yaml`;
1112
}

frontend/packages/console-shared/src/hooks/useResourceSidebarSamples.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Map as ImmutableMap } from 'immutable';
2-
import YAML from 'js-yaml';
2+
import * as YAML from 'js-yaml';
33
import * as _ from 'lodash';
44
import { useTranslation } from 'react-i18next';
55
import { PodDisruptionBudgetModel } from '@console/app/src/models';

frontend/packages/dev-console/src/components/deployments/EditDeployment.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const EditDeployment: FC<EditDeploymentProps> = ({ heading, resource, namespace,
4646
const resourceType = getResourcesType(resource);
4747
if (values.editorType === EditorType.YAML) {
4848
try {
49-
deploymentRes = safeLoad(values.yamlData);
49+
deploymentRes = safeLoad(values.yamlData) as K8sResourceKind;
5050
if (!deploymentRes?.metadata?.namespace) {
5151
deploymentRes.metadata.namespace = namespace;
5252
}

frontend/packages/helm-plugin/src/catalog/providers/useHelmCharts.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const useHelmCharts: ExtensionHook<CatalogItem[]> = ({
5252
.then(async (res) => {
5353
if (mounted) {
5454
const yaml = await res.text();
55-
const json = safeLoad(yaml);
55+
const json = safeLoad(yaml) as { entries: HelmChartEntries };
5656
setHelmCharts(json.entries);
5757
}
5858
})

frontend/packages/helm-plugin/src/components/forms/HelmChartRepository/CreateHelmChartRepository.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ const CreateHelmChartRepository: FC<CreateHelmChartRepositoryProps> = ({
9191

9292
if (values.editorType === EditorType.YAML) {
9393
try {
94-
HelmChartRepositoryRes = safeLoad(values.yamlData);
94+
HelmChartRepositoryRes = safeLoad(values.yamlData) as HelmChartRepositoryType;
9595
if (
9696
HelmChartRepositoryRes &&
9797
HelmChartRepositoryRes.kind === 'ProjectHelmChartRepository' &&

frontend/packages/helm-plugin/src/components/forms/install-upgrade/HelmChartVersionDropdown.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ const HelmChartVersionDropdown: FC<HelmChartVersionDropdownProps> = ({
125125
try {
126126
const response = await coFetch(`/api/helm/charts/index.yaml?namespace=${namespace}`);
127127
const yaml = await response.text();
128-
json = safeLoad(yaml);
128+
json = safeLoad(yaml) as { entries: HelmChartEntries };
129129
} catch {
130130
if (ignore) return;
131131
}

frontend/packages/helm-plugin/src/components/forms/install-upgrade/HelmInstallUpgradePage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ const HelmInstallUpgradePage: FC = () => {
167167
}
168168
} else if (yamlData) {
169169
try {
170-
valuesObj = safeLoad(yamlData);
170+
valuesObj = safeLoad(yamlData) as any;
171171
} catch (err) {
172172
actions.setStatus({
173173
submitError: t('helm-plugin~Invalid YAML - {{errorText}}', { errorText: err.toString() }),

frontend/packages/helm-plugin/src/components/forms/url-chart/HelmURLChartInstallPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ const HelmURLChartInstallPage: FunctionComponent = () => {
136136
}
137137
} else if (yamlData) {
138138
try {
139-
valuesObj = safeLoad(yamlData);
139+
valuesObj = safeLoad(yamlData) as Record<string, unknown>;
140140
} catch (err) {
141141
actions.setStatus({
142142
submitError: t('helm-plugin~Invalid YAML - {{errorText}}', { errorText: err.toString() }),

frontend/packages/knative-plugin/src/components/add/brokers/AddBroker.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ const AddBroker: FC<AddBrokerProps> = ({ namespace, selectedApplication }) => {
3737
const createResources = (
3838
formValues: AddBrokerFormYamlValues,
3939
actions: FormikHelpers<AddBrokerFormYamlValues>,
40-
): Promise<K8sResourceKind> => {
40+
): Promise<K8sResourceKind | null> => {
4141
let broker: K8sResourceKind;
4242
if (formValues.editorType === EditorType.Form) {
4343
broker = convertFormToBrokerYaml(formValues.formData);
4444
} else {
4545
try {
46-
broker = safeLoad(formValues.yamlData);
46+
broker = safeLoad(formValues.yamlData) as K8sResourceKind;
4747
if (!broker.metadata?.namespace) {
4848
broker.metadata.namespace = formValues.formData.project.name;
4949
}

0 commit comments

Comments
 (0)