From 7dac28daf88e827cc9e7760e845b72ec372b1c7a Mon Sep 17 00:00:00 2001 From: Jason Madigan Date: Fri, 15 Nov 2024 15:48:13 +0000 Subject: [PATCH 1/2] replacements update Signed-off-by: Jason Madigan --- downstream.js | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/downstream.js b/downstream.js index 8f492e2..e301f61 100755 --- a/downstream.js +++ b/downstream.js @@ -5,6 +5,7 @@ const path = require('path'); const constantsPath = path.join('src', 'constants', 'links.ts'); const localesPath = path.join('locales'); +const consoleExtensionsPath = path.join('console-extensions.json'); const localeFile = path.join(localesPath, 'en', 'plugin__kuadrant-console-plugin.json'); const upstreamName = 'Kuadrant'; @@ -72,6 +73,31 @@ function updateFileContent(filePath, replacements) { } } +function updateConsoleExtensions(filePath, searchValue, replaceValue) { + try { + const content = fs.readFileSync(filePath, 'utf-8'); + const jsonContent = JSON.parse(content); + + let updated = false; + + jsonContent.forEach((item) => { + if (item.properties && item.properties.name === searchValue) { + item.properties.name = replaceValue; + updated = true; + } + }); + + if (updated) { + fs.writeFileSync(filePath, JSON.stringify(jsonContent, null, 2)); + console.log(`Updated console extensions in ${filePath}`); + } else { + console.log(`No changes made to ${filePath}`); + } + } catch (error) { + console.error(`Failed to update ${filePath}: ${error}`); + } +} + console.log(`Updating locale files to ${isUpstream ? 'upstream' : 'downstream'}...`); updateJsonValues(localeFile, nameToReplace, nameToInsert); @@ -82,4 +108,11 @@ updateFileContent(constantsPath, [ { searchValue: releaseNotesToReplace, replaceValue: releaseNotesToInsert }, ]); +console.log(`Updating console-extensions.json to ${isUpstream ? 'upstream' : 'downstream'}...`); +updateConsoleExtensions( + consoleExtensionsPath, + `%plugin__kuadrant-console-plugin~${nameToReplace}%`, + nameToInsert, +); + console.log('Update complete!'); From e0148da99d48dc444ff47acceb493f778c8a56c6 Mon Sep 17 00:00:00 2001 From: Jason Madigan Date: Fri, 15 Nov 2024 16:00:04 +0000 Subject: [PATCH 2/2] version bump Signed-off-by: Jason Madigan --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 8fcccb4..8ba6859 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "kuadrant-console-plugin", - "version": "0.0.12", + "version": "0.0.13", "description": "Kuadrant OpenShift Console plugin", "private": true, "license": "Apache-2.0", @@ -72,7 +72,7 @@ }, "consolePlugin": { "name": "kuadrant-console-plugin", - "version": "0.0.12", + "version": "0.0.13", "displayName": "Kuadrant OpenShift Console Plugin", "description": "Kuadrant OpenShift Console Plugin", "exposedModules": {