amtrack / force-dev-tool

[DEPRECATED] Command line tool supporting the Force.com development lifecycle
MIT License
108 stars 37 forks source link

Feature/non named #128

Closed leboff closed 4 years ago

leboff commented 6 years ago

@amtrack this PR helps resolve an issue when deploying "non-named" children of custom objects (action overrides etc..) in a diffed changeset. Since the custom object gets added to the package.xml, we get an error like Must specify a non-empty label for the CustomObject. This maybe what you're referring to in #13

Additionally I added js-beautify to the run dependencies and use that to format the XML after generating a changeset.

amtrack commented 6 years ago

@leboff Thanks for your PR! I'm really looking forward to getting #13 solved.

However i'm wondering if this is the right approach. If we only consider required attributes, i don't know if this helps or causes confusion.

In order to test this PR i used my scenario i created a while ago at https://github.com/amtrack/sfdx-playground in branch object-properties.

$ git clone https://github.com/amtrack/sfdx-playground
$ cd sfdx-playground
$ git checkout object-properties
$ git log -p -- src
$ # search for commit message "modify CustomObject property (deployment status)"
$ git show --pretty=format: ':/modify' -- src
diff --git a/src/objects/DeploymentStatusMatters__c.object b/src/objects/DeploymentStatusMatters__c.object
index fcc93ae..b22081a 100644
--- a/src/objects/DeploymentStatusMatters__c.object
+++ b/src/objects/DeploymentStatusMatters__c.object
@@ -42,7 +42,7 @@
     </actionOverrides>
     <allowInChatterGroups>false</allowInChatterGroups>
     <compactLayoutAssignment>SYSTEM</compactLayoutAssignment>
-    <deploymentStatus>InDevelopment</deploymentStatus>
+    <deploymentStatus>Deployed</deploymentStatus>
     <enableActivities>false</enableActivities>
     <enableBulkApi>true</enableBulkApi>
     <enableChangeDataCapture>false</enableChangeDataCapture>
$ git show --pretty=format: ':/modify' -- src | force-dev-tool changeset create -f modify-deployment-status
Manifest:
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <version>41.0</version>
</Package>

exported metadata container to config/deployments/modify-deployment-status

However i cannot see the CustomObject with the required attributes being part of the deployment.

Am i doing s.th. wrong?

leboff commented 6 years ago

@amtrack ah yea, I see what you're saying. This was to solve the scenario where you were updating metadata like sharingReasons or some other type that is a child of the object but isn't listed in the package.xml. It still doesn't cover the scenario where you change the properties like you tested. For that case, you'd probably still need to pull in required attributes but also any children that have been modified, and not picked up by parsing in metadata-file-container.

I suppose one way to do that would be in the parse method to iterate over the parsed xml for each child, as opposed to by child type and figure out the type afterward, assuming the parent contains children types. Might be a lot of work involved in that though and possibly a number of edge cases to account for...

froucher commented 6 years ago

Hello,

Today we found an issue with \<enableHistory> from \<CustomObject>, the diff detects the change:

$ git diff --no-renames 1.0.1 HEAD -- src/objects/Contact.object
diff --git a/src/objects/Contact.object b/src/objects/Contact.object
index b8eb36a70..3aa504117 100644
--- a/src/objects/Contact.object
+++ b/src/objects/Contact.object
@@ -106,10 +106,21 @@
     </compactLayouts>
     <enableEnhancedLookup>true</enableEnhancedLookup>
     <enableFeeds>true</enableFeeds>
-    <enableHistory>false</enableHistory>
+    <enableHistory>true</enableHistory>
     <fields>
         <fullName>AccountId</fullName>

But the output with the delta doesn't detect this change

$ git diff --no-renames 1.0.1 HEAD -- src/objects/Contact.object | force-dev-tool changeset create delta --apiVersion 42.0 -d ./publish

Is it the same issue? If yes, are you going to add this code to the main line? Do you need help testing this issue? Or improving the code?

Regards.

amtrack commented 4 years ago

closing in favor of #230