From a8ca3d23aadcb0caa8e5d6dffbd24f7460bf085b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Berkefeld?= Date: Sat, 9 Nov 2024 11:26:29 +0100 Subject: [PATCH] #1851: add option deploy --ignoreFolders --- lib/cli.js | 7 +++++++ lib/index.js | 1 + lib/metadataTypes/DataExtension.js | 19 +++++++++++++++++++ 3 files changed, 27 insertions(+) diff --git a/lib/cli.js b/lib/cli.js index 9d87a0b22..29ab2f853 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -193,6 +193,13 @@ yargs(hideBin(process.argv)) group: 'Options for deploy:', describe: 'allows overwriting options.formatOnSave from the config file. Disable formatting via --no-format', + }) + .option('ignoreFolder', { + type: 'boolean', + alias: 'if', + group: 'Options for deploy:', + describe: + 'works with --matchName and allows skipping folder match if there is only 1 name match', }), (argv) => { diff --git a/lib/index.js b/lib/index.js index f5bbb30c4..b35385e02 100644 --- a/lib/index.js +++ b/lib/index.js @@ -96,6 +96,7 @@ class Mcdev { 'fixShared', 'format', 'fromRetrieve', + 'ignoreFolder', 'json', 'keySuffix', 'like', diff --git a/lib/metadataTypes/DataExtension.js b/lib/metadataTypes/DataExtension.js index dcb14e0ac..040503a5d 100644 --- a/lib/metadataTypes/DataExtension.js +++ b/lib/metadataTypes/DataExtension.js @@ -1666,6 +1666,25 @@ class DataExtension extends MetadataType { ` - found ${this.definition.type} ${metadataItem[this.definition.keyField]} in cache by name "${metadataItem[this.definition.nameField]}" and folder "${deployFolderPath}": ${cacheMatchedByName[this.definition.keyField]}` ) ); + } else if ( + Util.OPTIONS.ignoreFolder && + potentials[0][this.definition.folderIdField] !== + metadataItem[this.definition.folderIdField] + ) { + cacheMatchedByName = potentials[0]; + + const cacheFolderPath = cache.searchForField( + 'folder', + potentials[0][this.definition.folderIdField], + 'ID', + 'Path' + ); + + Util.logger.info( + Util.getGrayMsg( + ` - found ${this.definition.type} ${metadataItem[this.definition.keyField]} in cache by name "${metadataItem[this.definition.nameField]}" and but folder is different (--ignoreFolder). New folder: "${deployFolderPath}". Old: "${cacheFolderPath}"` + ) + ); } else { const cacheFolderPath = cache.searchForField( 'folder',