Skip to content

Commit

Permalink
refactor: simplify implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
scolladon committed May 5, 2024
1 parent c6d0edc commit 988b051
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions src/service/inFileHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default class InFileHandler extends StandardHandler {
this._storeComparison(this.diffs.destructiveChanges, deleted)
this._storeComparison(this.diffs.package, added)
const { xmlContent, isEmpty } = this.metadataDiff.prune()
if (this._shouldTreatContainerType(added, isEmpty)) {
if (this._shouldTreatContainerType(isEmpty)) {
// Call from super.handleAddition to add the Root Type
// QUESTION: Why InFile element are not deployable when root component is not listed in package.xml ?
await super.handleAddition()
Expand Down Expand Up @@ -95,17 +95,7 @@ export default class InFileHandler extends StandardHandler {
return this.metadataDef.pruneOnly
}

protected _shouldTreatContainerType(added: Manifest, fileIsEmpty: boolean) {
if (!fileIsEmpty) {
return true
}

for (const [type] of added) {
if (isPackable(type)) {
return true
}
}

return false
protected _shouldTreatContainerType(fileIsEmpty: boolean) {
return !fileIsEmpty
}
}

0 comments on commit 988b051

Please sign in to comment.