From dec07e86401ee0c3697b0da97d97545c279d2d07 Mon Sep 17 00:00:00 2001 From: raj pandey Date: Wed, 21 Feb 2024 12:12:07 +0530 Subject: [PATCH] added two messages depending whether management token is used or not --- .../src/commands/cm/stacks/import.ts | 10 ++++++++-- .../contentstack-import/src/import/module-importer.ts | 6 ++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/contentstack-import/src/commands/cm/stacks/import.ts b/packages/contentstack-import/src/commands/cm/stacks/import.ts index 55a955fcb8..ab78459982 100644 --- a/packages/contentstack-import/src/commands/cm/stacks/import.ts +++ b/packages/contentstack-import/src/commands/cm/stacks/import.ts @@ -134,7 +134,9 @@ export default class ImportCommand extends Command { if (!result?.noSuccessMsg) { log( importConfig, - `Successfully imported the content to the stack named ${importConfig.stackName} with the API key ${importConfig.apiKey} .`, + 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', ); } @@ -145,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 0f5c27a1b7..476d0949e8 100755 --- a/packages/contentstack-import/src/import/module-importer.ts +++ b/packages/contentstack-import/src/import/module-importer.ts @@ -23,8 +23,10 @@ class ModuleImporter { } async start(): Promise { - const stackName: Record = await this.stackAPIClient.fetch(); - this.importConfig.stackName = stackName.name as string; + 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); }