Skip to content

Commit

Permalink
#126: exclude auto-created folders from being auto-saved to retrieve dir
Browse files Browse the repository at this point in the history
  • Loading branch information
JoernBerkefeld committed Sep 19, 2024
1 parent 79fa77a commit b9c849e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion @types/lib/Deployer.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion @types/lib/metadataTypes/MetadataType.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion lib/Deployer.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,9 @@ class Deployer {
const result = await MetadataTypeInfo[type].deploy(
this.metadata[type],
this.deployDir,
this.retrieveDir
type === 'folder' && (!typeArr || !typeArr.includes('folder'))
? null
: this.retrieveDir
);
multiMetadataTypeMap[type] = result;
cache.mergeMetadata(type, result);
Expand Down
19 changes: 11 additions & 8 deletions lib/metadataTypes/MetadataType.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,17 @@ class MetadataType {
*/
static async deploy(metadataMap, deployDir, retrieveDir) {
const upsertedMetadataMap = await this.upsert(metadataMap, deployDir);
const savedMetadataMap = await this.saveResults(upsertedMetadataMap, retrieveDir, null);
if (
this.properties.metaDataTypes.documentOnRetrieve.includes(this.definition.type) &&
!this.definition.documentInOneFile
) {
// * do not await here as this might take a while and has no impact on the deploy
// * this should only be run if documentation is on a per metadata record level. Types that document an overview into a single file will need a full retrieve to work instead
this.document(savedMetadataMap, true);
if (retrieveDir) {
// deploy can be run with retrieveDir set to null for deploying auto-created foldes - these should not be saved to the retrieve-folder while everything else should
const savedMetadataMap = await this.saveResults(upsertedMetadataMap, retrieveDir, null);
if (
this.properties.metaDataTypes.documentOnRetrieve.includes(this.definition.type) &&
!this.definition.documentInOneFile
) {
// * do not await here as this might take a while and has no impact on the deploy
// * this should only be run if documentation is on a per metadata record level. Types that document an overview into a single file will need a full retrieve to work instead
this.document(savedMetadataMap, true);
}
}
return upsertedMetadataMap;
}
Expand Down

0 comments on commit b9c849e

Please sign in to comment.