From c2c6b6303bee1627ee1d7a964a1956aac0548cb6 Mon Sep 17 00:00:00 2001 From: harshitha-cstk Date: Fri, 3 Jul 2026 12:58:24 +0530 Subject: [PATCH] fix: show backup folder path on command completion The backup folder path was logged via log.success, which maps to the info level. For progress-supported modules like import-setup, the logger omits the console transport when showConsoleLogs is false, so the path only reached the log file and never appeared in the terminal. Print the success and backup-path messages directly via cliux.print when showConsoleLogs is false, so the path is always visible regardless of the setting. log.success is retained for the log file record, and the direct print is guarded to avoid a duplicate line when showConsoleLogs is true. --- .../messages/index.json | 5 +++- .../src/commands/cm/stacks/import-setup.ts | 23 +++++++++++++------ 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/packages/contentstack-import-setup/messages/index.json b/packages/contentstack-import-setup/messages/index.json index 9e26dfeeb..88354be36 100644 --- a/packages/contentstack-import-setup/messages/index.json +++ b/packages/contentstack-import-setup/messages/index.json @@ -1 +1,4 @@ -{} \ No newline at end of file +{ + "IMPORT_SETUP_SUCCESS": "Backup folder and mapper files have been successfully created for the stack using the API key %s.", + "IMPORT_SETUP_BACKUP_PATH": "The backup folder has been created at '%s'." +} diff --git a/packages/contentstack-import-setup/src/commands/cm/stacks/import-setup.ts b/packages/contentstack-import-setup/src/commands/cm/stacks/import-setup.ts index 8d70de3ad..daeb1ef49 100644 --- a/packages/contentstack-import-setup/src/commands/cm/stacks/import-setup.ts +++ b/packages/contentstack-import-setup/src/commands/cm/stacks/import-setup.ts @@ -98,14 +98,23 @@ export default class ImportSetupCommand extends Command { CLIProgressManager.printGlobalSummary(); - log.success( - `Backup folder and mapper files have been successfully created for the stack using the API key ${importSetupConfig.apiKey}.`, - importSetupConfig.context, - ); - log.success( - `The backup folder has been created at '${pathValidator(path.join(importSetupConfig.backupDir))}'.`, - importSetupConfig.context, + const successMessage = messageHandler.parse('IMPORT_SETUP_SUCCESS', importSetupConfig.apiKey); + const backupPathMessage = messageHandler.parse( + 'IMPORT_SETUP_BACKUP_PATH', + pathValidator(path.join(importSetupConfig.backupDir)), ); + + log.success(successMessage, importSetupConfig.context); + log.success(backupPathMessage, importSetupConfig.context); + + // log.success maps to the info level, which is suppressed on the console for + // progress-supported modules when showConsoleLogs is false. Print the backup + // folder path directly so it is always visible, regardless of that setting. + const showConsoleLogs = configHandler.get('log')?.showConsoleLogs ?? false; + if (!showConsoleLogs) { + cliux.print(successMessage); + cliux.print(backupPathMessage); + } } catch (error) { CLIProgressManager.printGlobalSummary(); handleAndLogError(error);