Ignore Unlocked Package Metadata In Comparisons
Currently, metadata from Unlocked Packages show up when comparing against an org. This leads to duplication of metadata in source control repositories (correct DX package repository and incorrect monolithic, "happy-soup" repository).
Using the Package2Member Object (Tooling API), it is possible to deduce whether or not a metadata item is part of an unlocked package. Therefore, it should be possible to ignore some or all unlocked packages (or any Package2 package), in a similar fashion to the way Gearset filters allow inclusion or exclusion of managed packages.
In comparisons, all metadata from unlocked packages is included by default. However, some users wish to exclude unlocked package metadata from a comparison. This is so that they don't have to see metadata that they don't need to consider for their deployment.
So we’ve added this ability!
Within the packaging sidebar on the right hand side of the large filter, there is now an option to Exclude unlocked packages from a comparison. Shown in brackets is the number of distinct unlocked packages identified across the two environments.
-
Geoff Saxby commented
This would make it much easier to use Gearset for orgs that have lots of unlocked packages (i.e. pretty much everything from UnofficialSF)
As it is now, the Unofficial SF components show up as differences in the comparison. This makes it much harder to find the real changes.
-
susanoo chidori commented
we have installed a lot of unlocked packages like https://unofficialsf.com/
Now the gearset thinks to delete them :( This is not ideal.. gearset should ignore unlocked packages
-
Justin Lyon commented
This should be available today. The lack of support for unlocked packages in Gearset is a serious consideration when deciding whether our team can take on new dependencies. I would like to add the helpful unofficial sf Flow Components utils for example, but it's just not worth the pain of maintaining the exclusions in the comparison filter.
As an example Unofficial SF's List Functions for Flow, which itself has two other dependencies as well.
https://unofficialsf.com/list-actions-for-flow/#installation
-
Sunny Matharu commented
Encountering this very issue now. Surprised to see a suggestion from 2018 that has gone unaddressed. Equally surprised that it hasn't received more than 13 votes!
-
Justin Lyon commented
I posted a related idea for this same issue as it presents during validation (and presumably deployment as well)
https://gearset.uservoice.com/forums/283474-help-us-improve-gearset/suggestions/46137910-local-metadata-ignored-if-name-collides-across-an -
Justin Lyon commented
SFDX CLI default behavior does not retrieve unlocked package components. If I retrieve wildcard on Lightning Web Components, I only get my local Lightning Web Components. Nothing from unlocked packages is retrieved.
Gearset must be doing something additional during comparison to retrieve unlocked package contents in addition to SF's default retrieve behavior. Because Gearset is now changing Salesforce's default retrieve behavior this must be an opt-in feature. Not everyone wants to retrieve the contents of unlocked packages to their repository.
Because this is NOT an opt-in feature, this creates new problems. There is currently a separate, but related, bug in the Gearset comparison behavior. During comparison, components of Namespaced Unlocked Packages are retrieved, and the Namespace is lost or dropped. When a component behind the namespace has the same name as a component outside of the namespace, the comparison combines the two components into a single file or folder. In the case of Lightning Web Components, two colliding components are two folders of various files; and when the bug occurs all the files between the two components are combined into a single LWC folder.
There are identified work arounds using regex and manually maintaining my Comparison Filters. This does not scale and requires too much effort from our team to maintain. Most interestingly, and somewhat frustratingly, the Gearset Comparison Filters' Advanced Settings properly identifies the namespaced unlocked package and lists the components using their namespace. Frustrating because apparently when the Comparison itself is executed that same namespace is forgotten.
Finally, I see this as two separate issues -
1. Gearset should not by default retrieve Namespaced Unlocked Package components. But should be an opt-in feature similar to managed packages.
2. Gearset cannot drop the namespace for Namespaced Unlocked Package components during comparison execution. -
Anonymous commented
Just feels funny that even after 4 years gearset is not trying hard to adopt unlocked packaged.. This is must haves in 2023 and beyond.
-
Shawn W commented
This overlap is creating big headaches for our team as we are transitioning from monolithic deployments to DX packages.
-
Shawn W commented
I've tested this out by querying the Tooling API's Package2Member Object against specific metadata ID's. If the metadata is in a Package2 package, a single result is returned. If the metadata is not in any package, or even in a managed package, the query returns no results.