Skip to content

Commit

Permalink
#1851: add option deploy --ignoreFolders
Browse files Browse the repository at this point in the history
  • Loading branch information
JoernBerkefeld committed Nov 9, 2024
1 parent e70de4b commit a8ca3d2
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
1 change: 1 addition & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ class Mcdev {
'fixShared',
'format',
'fromRetrieve',
'ignoreFolder',
'json',
'keySuffix',
'like',
Expand Down
19 changes: 19 additions & 0 deletions lib/metadataTypes/DataExtension.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit a8ca3d2

Please sign in to comment.