From 381d5e9e006155a19473dbe640d317b4811166b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Emarianfoo=E2=80=9C?= <13335743+marianfoo@users.noreply.github.com> Date: Fri, 17 May 2024 13:41:13 +0200 Subject: [PATCH 1/2] feat: define `modulePaths` in launchpad.html file --- src/index.ts | 9 +++++++-- templates/async/launchpad.html | 3 ++- templates/legacy/launchpad.html | 3 ++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/index.ts b/src/index.ts index 3436699..1758087 100644 --- a/src/index.ts +++ b/src/index.ts @@ -14,7 +14,8 @@ export interface LaunchpadConfig { basePath?: string, appConfigPath?: string, locale?: string, // TODO if it was possible to get sap-ui-language from request which retrieves the app config json, we wouldnt need this option - template?: string + template?: string, + modulePaths?: object } export class cds_launchpad_plugin{ @@ -92,7 +93,11 @@ export class cds_launchpad_plugin{ async prepareTemplate(options: LaunchpadConfig): Promise{ let url = `https://ui5.sap.com`; let template = options.template === 'legacy' || options.template === '' || options.template === undefined ? 'legacy' : options.template; - const htmltemplate = fs.readFileSync(__dirname + `/../templates/${template}/launchpad.html`).toString(); + let htmltemplate = fs.readFileSync(__dirname + `/../templates/${template}/launchpad.html`).toString(); + if(options.modulePaths) { + const modulePathsJson = JSON.stringify(options.modulePaths); + htmltemplate = htmltemplate.replace('/* MODULE_PATHS */', `modulePaths: ${modulePathsJson}`); + } if (options.version && options.version.startsWith('https://')) { url = options.version } else if(options.version !== undefined && options.version !== ''){ diff --git a/templates/async/launchpad.html b/templates/async/launchpad.html index 176e43d..4c54610 100644 --- a/templates/async/launchpad.html +++ b/templates/async/launchpad.html @@ -48,7 +48,8 @@ }, }, }, - applications: {} + applications: {}, + /* MODULE_PATHS */ }; diff --git a/templates/legacy/launchpad.html b/templates/legacy/launchpad.html index 337f1d4..2656ce6 100644 --- a/templates/legacy/launchpad.html +++ b/templates/legacy/launchpad.html @@ -39,7 +39,8 @@ }, }, }, - applications: {} + applications: {}, + /* MODULE_PATHS */ }; From 652eeccaac44a2d108b17d29d00eea4319b8e789 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Emarianfoo=E2=80=9C?= <13335743+marianfoo@users.noreply.github.com> Date: Fri, 17 May 2024 13:44:19 +0200 Subject: [PATCH 2/2] chore: update readme --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4174358..149730f 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,8 @@ Optionally you can configure the cds-launchpad-plugin by adding following config "basePath": "", // Path under which you want the sandbox to be served "appConfigPath": "", // External sandbox appconfig json file to be merged with generated appconfig "locale": "", // Language to be used for the sandbox environment - "template": "" // 'legacy' (non-async launchpad, default) or 'async' (async launchpad) + "template": "" ,// 'legacy' (non-async launchpad, default) or 'async' (async launchpad), + "modulePaths": "" // object with module paths to be used in the launchpad.html file for "sap-ushell-config" } } ``` @@ -70,7 +71,8 @@ Call `setup({...})` method with the following object (configuration object can b basePath: '', // Path under which you want the sandbox to be served appConfigPath: '', // External sandbox appconfig json file to be merged with generated appconfig locale: '', // Language to be used for the sandbox environment - template: '' // 'legacy' (non-async launchpad) or 'async' (async launchpad) + template: '', // 'legacy' (non-async launchpad) or 'async' (async launchpad) + modulePaths: '' // object with module paths to be used in the launchpad.html file for "sap-ushell-config" } ```