From b95487436fd626902c6f1829a2fa9c73ff1c4590 Mon Sep 17 00:00:00 2001 From: Cian Morrin Date: Thu, 9 Jan 2025 18:46:45 +0000 Subject: [PATCH 1/3] fix(flp-config): tidy up and improve logging configuration --- .../flp-config-sub-generator/src/app/index.ts | 5 +++-- .../flp-config-sub-generator/src/utils/i18n.ts | 6 +++--- .../src/utils/logger.ts | 18 ++++++++++-------- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/packages/flp-config-sub-generator/src/app/index.ts b/packages/flp-config-sub-generator/src/app/index.ts index 5c77881071..7347047de8 100644 --- a/packages/flp-config-sub-generator/src/app/index.ts +++ b/packages/flp-config-sub-generator/src/app/index.ts @@ -62,11 +62,12 @@ export default class extends Generator { this.options = opts; FlpGenLogger.configureLogging( - this.options.logger, this.rootGeneratorName(), this.log, this.options.logWrapper, - this.options.logLevel + this.options.logLevel, + this.options.logger, + this.vscode ); // If launched standalone, set the header, title and description diff --git a/packages/flp-config-sub-generator/src/utils/i18n.ts b/packages/flp-config-sub-generator/src/utils/i18n.ts index a3ed92200d..44fc13df4c 100644 --- a/packages/flp-config-sub-generator/src/utils/i18n.ts +++ b/packages/flp-config-sub-generator/src/utils/i18n.ts @@ -2,14 +2,14 @@ import type { TOptions } from 'i18next'; import i18next from 'i18next'; import translations from '../translations/flp-config-sub-generator.i18n.json'; -const ui5LibGeneratorNs = 'ui5-lib-generator'; +const flpConfigGeneratorNs = 'flp-config-generator'; /** * Initialize i18next with the translations for this module. */ export async function initI18n(): Promise { await i18next.init({ lng: 'en', fallbackLng: 'en' }, () => - i18next.addResourceBundle('en', ui5LibGeneratorNs, translations) + i18next.addResourceBundle('en', flpConfigGeneratorNs, translations) ); } @@ -22,7 +22,7 @@ export async function initI18n(): Promise { */ export function t(key: string, options?: TOptions): string { if (!options?.ns) { - options = Object.assign(options ?? {}, { ns: ui5LibGeneratorNs }); + options = Object.assign(options ?? {}, { ns: flpConfigGeneratorNs }); } return i18next.t(key, options); } diff --git a/packages/flp-config-sub-generator/src/utils/logger.ts b/packages/flp-config-sub-generator/src/utils/logger.ts index 26aaa279eb..c08dcea61c 100644 --- a/packages/flp-config-sub-generator/src/utils/logger.ts +++ b/packages/flp-config-sub-generator/src/utils/logger.ts @@ -27,22 +27,24 @@ export default class FlpGenLogger { } /** - * Configures the vscode logger. + * Configures the logger. * - * @param vscLogger - the vscode logger * @param loggerName - the logger name * @param yoLogger - the yeoman logger - * @param vscode - the vscode instance + * @param logWrapper - log wrapper instance * @param logLevel - the log level + * @param vscLogger - the vscode logger + * @param vscode - the vscode instance */ static configureLogging( - vscLogger: IVSCodeExtLogger, loggerName: string, yoLogger: Logger, - vscode?: unknown, - logLevel?: LogLevel + logWrapper?: LogWrapper, + logLevel?: LogLevel, + vscLogger?: IVSCodeExtLogger, + vscode?: unknown ): void { - const logWrapper = new LogWrapper(loggerName, yoLogger, logLevel, vscLogger, vscode); - FlpGenLogger.logger = logWrapper; + const logger = logWrapper ?? new LogWrapper(loggerName, yoLogger, logLevel, vscLogger, vscode); + FlpGenLogger.logger = logger; } } From 03cb509fce8ea3e31985ea38393f3b23d05cb452 Mon Sep 17 00:00:00 2001 From: Cian Morrin Date: Thu, 9 Jan 2025 18:50:29 +0000 Subject: [PATCH 2/3] fix(flp-config): cset --- .changeset/grumpy-shirts-complain.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/grumpy-shirts-complain.md diff --git a/.changeset/grumpy-shirts-complain.md b/.changeset/grumpy-shirts-complain.md new file mode 100644 index 0000000000..34645a4f16 --- /dev/null +++ b/.changeset/grumpy-shirts-complain.md @@ -0,0 +1,5 @@ +--- +'@sap-ux/flp-config-sub-generator': patch +--- + +tidy up From 95af401fa258b513b0008847f717411557e97fa1 Mon Sep 17 00:00:00 2001 From: Cian Morrin Date: Thu, 9 Jan 2025 19:06:53 +0000 Subject: [PATCH 3/3] fix(flp-config): update adp tooling --- packages/adp-tooling/src/preview/routes-handler.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/adp-tooling/src/preview/routes-handler.ts b/packages/adp-tooling/src/preview/routes-handler.ts index 4798fbf121..f84044358c 100644 --- a/packages/adp-tooling/src/preview/routes-handler.ts +++ b/packages/adp-tooling/src/preview/routes-handler.ts @@ -359,9 +359,7 @@ export default class RoutesHandler { const project = this.util.getProject(); const getPath = (projectPath: string, relativePath: string): string => path.join(projectPath, DirName.Changes, relativePath).split(path.sep).join(path.posix.sep); - const annotations = dataSources[dataSourceId].settings?.annotations - ? [...dataSources[dataSourceId].settings.annotations].reverse() - : []; + const annotations = [...(dataSources[dataSourceId].settings?.annotations ?? [])].reverse(); for (const annotation of annotations) { const annotationSetting = dataSources[annotation]; if (annotationSetting.type === 'ODataAnnotation') {