-
Notifications
You must be signed in to change notification settings - Fork 16
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
custom registry support #552
Conversation
@@ -13,3 +22,23 @@ export const metadataMemberGuard = ( | |||
input: MetadataMember | undefined | Partial<MetadataMember> | |||
): input is MetadataMember => | |||
input !== undefined && typeof input.fullName === 'string' && typeof input.type === 'string'; | |||
|
|||
export const isSdrFailure = (fileResponse: FileResponse): fileResponse is FileResponseFailure => |
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.
a few of these already exist in PDR and probably could ship in SDR if they'd be broadly useful.
@@ -8,20 +8,9 @@ import { ForceIgnore, MetadataComponent, MetadataMember, RegistryAccess } from ' | |||
import { SfError } from '@salesforce/core'; | |||
import { filePathsFromMetadataComponent } from '@salesforce/source-deploy-retrieve/lib/src/utils/filePathGenerator'; | |||
import { ChangeResult } from './types'; | |||
|
|||
export const changeResultToMetadataComponent = ( |
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.
moved to the shared functions module for re-use
@@ -26,15 +27,14 @@ export const findConflictsInComponentSet = (cs: ComponentSet, conflicts: ChangeR | |||
// map do dedupe by name-type-filename | |||
const conflictMap = new Map<string, ConflictResponse>(); | |||
conflicts | |||
.filter((cr) => cr.name && cr.type && cs.has({ fullName: cr.name, type: cr.type })) | |||
.filter(isChangeResultWithNameAndType) |
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.
isChangeResultWithNameAndType
narrows the ConflictResponse
so that other functions can depend on those props existing
@@ -25,29 +33,39 @@ export const getKeyFromObject = (element: RemoteChangeElement | ChangeResult): s | |||
|
|||
export const supportsPartialDelete = (cmp: SourceComponent): boolean => !!cmp.type.supportsPartialDelete; | |||
|
|||
export const isLwcLocalOnlyTest = (filePath: string): boolean => | |||
filePath.includes('__utam__') || filePath.includes('__tests__'); | |||
export const excludeLwcLocalOnlyTest = (filePath: string): boolean => |
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.
I just inverted it for clearer use as a filter. Both uses were negated by the consumer
export const getComponentSets = ({ | ||
groupings, | ||
sourceApiVersion, | ||
registry = new RegistryAccess(), |
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.
feat: accepts a custom registry for passing to the metadataConverter
3 props so now it's an obj
}: { | ||
elements: ChangeResult[]; | ||
packageDirPaths: string[]; | ||
registry: RegistryAccess; |
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.
another place that needed the registry
@@ -61,6 +67,7 @@ export const populateFilePaths = (elements: ChangeResult[], packageDirPaths: str | |||
const matchingLocalSourceComponentsSet = ComponentSet.fromSource({ | |||
fsPaths: packageDirPaths, | |||
include: remoteChangesAsComponentSet, | |||
registry, |
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.
...here
@@ -84,10 +94,9 @@ export const populateFilePaths = (elements: ChangeResult[], packageDirPaths: str | |||
...elementMap.get(key), | |||
modified: true, | |||
origin: 'remote', | |||
filenames: [matchingComponent.xml as string, ...matchingComponent.walkContent()].filter((filename) => filename), | |||
filenames: getAllFiles(matchingComponent), |
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.
several places use [xml, ...walkContent] and then have filter out non-strings, so that's now shared fn
.filter(sourceComponentGuard); | ||
// component set generated from the filenames on all local changes | ||
const resolver = new MetadataResolver( | ||
registry, |
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.
needed custom reg here
What does this PR do?
componentSet and Resolver allow the passing in a registry.
STL will now resolve the registry once when instantiated, from the projectDir, and pass that around to everything that needs it.
What issues does this PR fix or reference?
part of making @W-14608988@ work with tracking