Skip to content

Commit b0d20fa

Browse files
Merge pull request #2320 from contentstack/revert-2314-fix/DX-3610
Revert "fix: inconsistent log messages in case of failures"
2 parents a78a840 + f44f7b7 commit b0d20fa

File tree

3 files changed

+12
-24
lines changed

3 files changed

+12
-24
lines changed

packages/contentstack-import/src/commands/cm/stacks/import.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,14 @@ export default class ImportCommand extends Command {
148148
const moduleImporter = new ModuleImporter(managementAPIClient, importConfig);
149149
const result = await moduleImporter.start();
150150
backupDir = importConfig.backupDir;
151-
//Note: Final summary is now handled by summary manager
151+
152+
if (!result?.noSuccessMsg) {
153+
const successMessage = importConfig.stackName
154+
? `Successfully imported the content to the stack named ${importConfig.stackName} with the API key ${importConfig.apiKey} .`
155+
: `The content has been imported to the stack ${importConfig.apiKey} successfully!`;
156+
log.success(successMessage, importConfig.context);
157+
}
158+
152159
CLIProgressManager.printGlobalSummary();
153160
this.logSuccessAndBackupMessages(backupDir, importConfig);
154161
// Clear progress module setting now that import is complete

packages/contentstack-utilities/src/progress-summary/cli-progress-manager.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,6 @@ export default class CLIProgressManager {
108108
CLIProgressManager.globalSummary.printFinalSummary();
109109
}
110110

111-
/**
112-
* Check if there are any failures in the global summary
113-
*/
114-
static hasFailures(): boolean {
115-
if (!CLIProgressManager.globalSummary) {
116-
return false;
117-
}
118-
return CLIProgressManager.globalSummary.hasFailures();
119-
}
120-
121111
/**
122112
* Apply strategy-based corrections to module data
123113
*/

packages/contentstack-utilities/src/progress-summary/summary-manager.ts

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,10 @@ export default class SummaryManager {
131131

132132
// Final Status
133133
console.log('\n' + chalk.bold('Final Status:'));
134-
if (!this.hasFailures() && failedModules === 0) {
135-
console.log(chalk.bold.green(`✅ ${this.operationName} completed successfully!`));
136-
} else if (this.hasFailures() || failedModules > 0) {
137-
console.log(
138-
chalk.bold.yellow(`⚠️ ${this.operationName} completed with failures, see the logs for more details.`),
139-
);
134+
if (failedModules === 0) {
135+
console.log(chalk.bold.green(`🎉 ${this.operationName} completed successfully!`));
136+
} else if (completedModules > 0) {
137+
console.log(chalk.bold.yellow(`⚠️ ${this.operationName} completed with ${failedModules} failed modules`));
140138
} else {
141139
console.log(chalk.bold.red(`❌ ${this.operationName} failed`));
142140
}
@@ -148,13 +146,6 @@ export default class SummaryManager {
148146
this.printFailureSummaryWithLogReference();
149147
}
150148

151-
/**
152-
* Check if there are any failures across all modules
153-
*/
154-
hasFailures(): boolean {
155-
return Array.from(this.modules.values()).some((m) => m.failures.length > 0 || m.failureCount > 0);
156-
}
157-
158149
private printFailureSummaryWithLogReference(): void {
159150
const modulesWithFailures = Array.from(this.modules.values()).filter((m) => m.failures.length > 0);
160151

0 commit comments

Comments
 (0)