From f6bbad024226c8f7ab79b4b585eb78fd28537c54 Mon Sep 17 00:00:00 2001 From: raj pandey Date: Mon, 10 Jun 2024 16:22:19 +0530 Subject: [PATCH] Removed mapper directory --- .../src/commands/cm/stacks/import.ts | 3 --- .../src/types/import-config.ts | 1 - .../src/utils/backup-handler.ts | 22 ------------------- .../src/utils/import-config-handler.ts | 6 ----- 4 files changed, 32 deletions(-) diff --git a/packages/contentstack-import/src/commands/cm/stacks/import.ts b/packages/contentstack-import/src/commands/cm/stacks/import.ts index e68f5adb4e..ceed92767b 100644 --- a/packages/contentstack-import/src/commands/cm/stacks/import.ts +++ b/packages/contentstack-import/src/commands/cm/stacks/import.ts @@ -113,9 +113,6 @@ export default class ImportCommand extends Command { description: 'Excluded the Module that are branch independent from the import', default: false }), - 'mapper-dir': flags.string({ - description: 'path of backup directory for base branch import', - }), }; static aliases: string[] = ['cm:import']; diff --git a/packages/contentstack-import/src/types/import-config.ts b/packages/contentstack-import/src/types/import-config.ts index 249a3579ef..ba78c9f392 100644 --- a/packages/contentstack-import/src/types/import-config.ts +++ b/packages/contentstack-import/src/types/import-config.ts @@ -51,7 +51,6 @@ export default interface ImportConfig extends DefaultConfig, ExternalConfig { skipExisting?: boolean; skipAudit?: boolean; stackName?: string; - 'mapper-dir'?: string; 'exclude-global-modules': false; } diff --git a/packages/contentstack-import/src/utils/backup-handler.ts b/packages/contentstack-import/src/utils/backup-handler.ts index 2af4e68ff0..8253ad7858 100755 --- a/packages/contentstack-import/src/utils/backup-handler.ts +++ b/packages/contentstack-import/src/utils/backup-handler.ts @@ -41,7 +41,6 @@ export default async function backupHandler(importConfig: ImportConfig): Promise if (backupDirPath) { cliux.print('Copying content to the backup directory...'); - await copyMapperFolder(importConfig, backupDirPath); return new Promise((resolve, reject) => { return copy(importConfig.contentDir, backupDirPath, (error: any) => { if (error) { @@ -71,24 +70,3 @@ function isSubDirectory(importConfig: ImportConfig) { // true if both parent and child have same path return true; } - -/** - * - */ - -async function copyMapperFolder(importConfig: ImportConfig, backupDirPath: string) { - try { - const mapperDir = importConfig['mapper-dir']; - if (!mapperDir) { - return; - } - const copyPromises = importConfig.globalModules.map((globalModule: string) => - copy(`${mapperDir}/mapper/${globalModule}`, `${backupDirPath}/mapper/${globalModule}`), - ); - await Promise.all(copyPromises); - return backupDirPath; - } catch (error) { - trace(error, 'error', true); - throw error; - } -} diff --git a/packages/contentstack-import/src/utils/import-config-handler.ts b/packages/contentstack-import/src/utils/import-config-handler.ts index 1084ab7730..4a53240a0f 100644 --- a/packages/contentstack-import/src/utils/import-config-handler.ts +++ b/packages/contentstack-import/src/utils/import-config-handler.ts @@ -99,12 +99,6 @@ const setupConfig = async (importCmdFlags: any): Promise => { config['exclude-global-modules'] = importCmdFlags['exclude-global-modules']; } - if (importCmdFlags['mapper-dir'] && importCmdFlags['exclude-global-modules']) { - config['mapper-dir'] = importCmdFlags['mapper-dir']; - } else if (importCmdFlags['exclude-global-modules']) { - config['mapper-dir'] = await askMapperDir(); - } - return config; };