From 54215b5cdb218e7df608eee37723ca7ca3b4998e Mon Sep 17 00:00:00 2001 From: Peter Muessig Date: Thu, 6 Feb 2025 23:24:27 +0100 Subject: [PATCH] fix(ui5-task-cachebuster): support new resource-roots config option (#1166) Fixes #1165 --- packages/ui5-task-cachebuster/lib/cachebuster.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/ui5-task-cachebuster/lib/cachebuster.js b/packages/ui5-task-cachebuster/lib/cachebuster.js index 00099cfcb..bdc898fb6 100644 --- a/packages/ui5-task-cachebuster/lib/cachebuster.js +++ b/packages/ui5-task-cachebuster/lib/cachebuster.js @@ -33,9 +33,9 @@ module.exports = async function ({ workspace, /* dependencies,*/ taskUtil, optio .getString() .then((content) => { //TODO also for data-sap-ui-theme-roots ?? - const sRegex = /data-sap-ui-resourceroots[\s]*=[\s]*'(.*?)'/is; + const sRegex = /(data-sap-ui-resource-?roots)[\s]*=[\s]*'(.*?)'/is; const mParts = content.match(sRegex); - const sResourceRoots = mParts?.[1]; //captureGroup at index 1 in match result + const sResourceRoots = mParts?.[2]; //captureGroup at index 2 in match result if (sResourceRoots) { var oResouceRoots = JSON.parse(sResourceRoots); const aModuleNames = Object.keys(oResouceRoots); @@ -46,7 +46,7 @@ module.exports = async function ({ workspace, /* dependencies,*/ taskUtil, optio oResouceRoots[sModuleName] = sModulePath; }); - var changed = content.replace(sRegex, `data-sap-ui-resourceroots='${JSON.stringify(oResouceRoots)}'`); + var changed = content.replace(sRegex, `${mParts[1]}='${JSON.stringify(oResouceRoots)}'`); indexResource.setString(changed); return workspace.write(indexResource); } @@ -88,7 +88,7 @@ module.exports = async function ({ workspace, /* dependencies,*/ taskUtil, optio isDebug && console.log(`moved: ${copy.getPath()}`); }); }); - }) + }), ); }) .catch((e) => {