Skip to content
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

feat: registryCustomizations #1217

Merged
merged 191 commits into from
Mar 28, 2024
Merged

feat: registryCustomizations #1217

merged 191 commits into from
Mar 28, 2024

Conversation

mshanemc
Copy link
Contributor

@mshanemc mshanemc commented Jan 16, 2024

What does this PR do?

allow entire fragments of registry to be added in sfdx-project.json.
[this is the "low-level" part of the feature]

Add 4 presets (see Presets.md)
lots of refactoring
lots of snapshot test for the preset/fragment behaviors for various types

What issues does this PR fix or reference?

@W-14608972@
@W-14608988@
@W-14609001@
also includes a small fix for @W-15253267@

@mshanemc mshanemc requested a review from a team as a code owner January 16, 2024 16:47
@mshanemc mshanemc marked this pull request as draft January 16, 2024 16:49
.filter(existsOrDoesntMatchIgnored(this.forceIgnoredPaths))
.filter((info) => !this.forceIgnoredPaths.has(info.output))
.map((info) => {
if (info.shouldDelete) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

writeInfo can now delete files. This was an easier approach than the existing partialDelete for bundles and I think I'd like those to eventually move to this approach.

this.deleted accumulates the delete side effects.

output: SourcePath;
source: Readable;
};
export type WriteInfo =
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now writeInfo can delete things

@@ -23,8 +23,8 @@ export class RegistryAccess {
private folderContentTypes?: MetadataType[];
private aliasTypes?: MetadataType[];

public constructor(registry: MetadataRegistry = defaultRegistry) {
this.registry = registry;
public constructor(registry?: MetadataRegistry, projectDir?: string) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

support for passing in a projectDir to avoid the default cwd behavior

@@ -32,7 +34,7 @@ export class MetadataConverter {
public constructor(registry = new RegistryAccess()) {
this.registry = registry;
}
// eslint-disable-next-line complexity
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so refactor out a method

import { MetadataType } from '../registry/types';
/** handle wide-open reading of values from elements inside any metadata xml file...we don't know the type
* Return the value of the matching element if supplied, or defaults `fullName` then `name` */
export const extractUniqueElementValue = (xml: JsonMap, uniqueId?: string): string | undefined =>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when CustomObjects were the only decomposed thing, we relied on some default behaviors (xml names match filenames, directories are the xml elements, there's always a fullName) but that's not true across other types that we will support decomposing

@mshanemc mshanemc marked this pull request as ready for review March 25, 2024 19:32
let parent = component;
if (!parent) {
parent = new SourceComponent(
if (strategy === 'folderPerType' || strategy === 'topLevel' || isResolvingSource) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove the DecompositionStrategy enum?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer union types over string enums. Better dev/compiler experience, keeps types separated from js code (ts enums get compiled into js).

I made notes for some others I'd like to be rid of eventually. Why would you want one?

src/Presets.md Outdated Show resolved Hide resolved
@WillieRuemmele WillieRuemmele merged commit eaa37b2 into main Mar 28, 2024
68 checks passed
@WillieRuemmele WillieRuemmele deleted the sm/raw-registry-variants branch March 28, 2024 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants