diff --git a/packages/contentstack-import/src/commands/cm/stacks/import.ts b/packages/contentstack-import/src/commands/cm/stacks/import.ts index eba9275aff..ab78459982 100644 --- a/packages/contentstack-import/src/commands/cm/stacks/import.ts +++ b/packages/contentstack-import/src/commands/cm/stacks/import.ts @@ -132,7 +132,13 @@ export default class ImportCommand extends Command { const result = await moduleImporter.start(); if (!result?.noSuccessMsg) { - log(importConfig, `The content has been imported to the stack ${importConfig.apiKey} successfully!`, 'success'); + log( + importConfig, + importConfig.stackName + ? `Successfully imported the content to the stack named ${importConfig.stackName} with the API key ${importConfig.apiKey} .` + : `The content has been imported to the stack ${importConfig.apiKey} successfully!`, + 'success', + ); } log( @@ -141,7 +147,11 @@ export default class ImportCommand extends Command { 'success', ); } catch (error) { - log({ data: backupDir ?? path.join(backupDir || __dirname, 'logs', 'import') } as ImportConfig, `Failed to import stack content - ${formatError(error)}`, 'error'); + log( + { data: backupDir ?? path.join(backupDir || __dirname, 'logs', 'import') } as ImportConfig, + `Failed to import stack content - ${formatError(error)}`, + 'error', + ); log( { data: backupDir } as ImportConfig, `The log has been stored at ${ diff --git a/packages/contentstack-import/src/import/module-importer.ts b/packages/contentstack-import/src/import/module-importer.ts index d111df834c..476d0949e8 100755 --- a/packages/contentstack-import/src/import/module-importer.ts +++ b/packages/contentstack-import/src/import/module-importer.ts @@ -23,6 +23,10 @@ class ModuleImporter { } async start(): Promise { + if(!this.importConfig.management_token){ + const stackName: Record = await this.stackAPIClient.fetch(); + this.importConfig.stackName = stackName.name as string; + } if (this.importConfig.branchName) { await validateBranch(this.stackAPIClient, this.importConfig, this.importConfig.branchName); } @@ -153,7 +157,8 @@ class ModuleImporter { (await cliux.inquire({ type: 'confirm', name: 'confirmation', - message: 'Please review and confirm if we can proceed with implementing the fix mentioned in the provided path.?', + message: + 'Please review and confirm if we can proceed with implementing the fix mentioned in the provided path.?', })) ) { return true; diff --git a/packages/contentstack-import/src/types/import-config.ts b/packages/contentstack-import/src/types/import-config.ts index bdf75c4727..667a53b53f 100644 --- a/packages/contentstack-import/src/types/import-config.ts +++ b/packages/contentstack-import/src/types/import-config.ts @@ -48,6 +48,7 @@ export default interface ImportConfig extends DefaultConfig, ExternalConfig { replaceExisting?: boolean; skipExisting?: boolean; skipAudit?: boolean; + stackName?: string; } type branch = {