sfpowerkit
sfpowerkit copied to clipboard
Merging project manifest to an empty manifest return error
Describe the bug
When merging manifests with one manifest contain no component, merging process returned error Cannot read properties of undefined (reading 'constructor')
To Reproduce Steps to reproduce the behavior:
- Create 2 package manifest. a. nonEmpty-package.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<name>CustomField</name>
<members>Account.Test__c</members>
</types>
<version>55.0</version>
</Package>
b. empty-package.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<version>55.0</version>
</Package>
- run
sfdx sfpowerkit:project:manifest:merge -p nonEmpty-package.xml,empty-package.xml -d ./out
- Result :
error with message
ERROR running sfpowerkit:project:manifest:merge: Cannot read properties of undefined (reading 'constructor')
Expected behavior
out/package.xml
contains the same component as nonEmpty-package.xml
Screenshots N/A
Desktop (please complete the following information):
- OS: MacOX
- Node Version : v16.14.2
- Version of sfpowerkit : 6.0.0
- Salesforce Org Version - v55.0
Additional context N/A
Suggestion for fix
on src/commands/sfpowerkit/project/manifest/merge.ts
add checking on metadataTypes (metadataTypes !== undefined
) in processMainfest
method.
Can I ask what the use case is for merging with an empty package.xml?
Yes, the use case is as a part of our CI, at the beginning of each sprint, we start with empty package.xml which developer start merging into.