-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(resolver): ignore non-component XML files in project #1452
Conversation
if (!suffixType) return false; | ||
|
||
const matchesSuffixType = fsPath.split(sep).includes(suffixType.directoryName); | ||
if (matchesSuffixType) return matchesSuffixType; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for an XML file, suffixType
would return the emailservicesfunction
entry:
"xml": "emailservicesfunction", |
// it might be a type that requires strict parent folder name. | ||
const strictFolderSuffixType = registry | ||
.getStrictFolderTypes() | ||
.find((l) => l.suffix === suffixType.suffix && l.directoryName && l.name !== suffixType.name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if registry.getTypeBySuffix
entry didn't match, check for strictFolderTypes.
snapshot tests caught an issue with CustomSite
where getTypeBySuffix
would return sitedotcom
(no match with the directoryName
), this will return the strict folder types -> find if one with directoryName and suffix matches (and isn't suffixType
).
"site": "sitedotcom", |
Manual tests with the changes passed. I added a UT that fails without the changes so if CI is green we can merge. |
What does this PR do?
Updates the metadata resolver to ignore XML files in a project that aren't part of a source component.
A customer had datapacks with an XML file that isn't part of the metadata inside
force_app
, when SDR built the component to deploy a specific metadata it would try to resolve the XML file asemailservicesfunction
because the helpers to detect if a filepath was a metadata type were checking if the file suffix matched one in the registry (emailservicesfunction.suffix === 'xml'
).This PR updates
isMetadata
to first try to find the type based on the suffix, if it there's not then it will check forstrictDirectoryNames
type ones and theirdirectoryName
.Repro:
sf project list ignored
sf project deploy start -m ApexClass
emailservicesfunction
xml
, then step 4 works b/c it doesn't try to resolve it as a component.What issues does this PR fix or reference?
@W-17113942@