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: build ComponentSet using metadata and an org connection #1182

Merged
merged 3 commits into from
Dec 5, 2023

Conversation

shetzel
Copy link
Contributor

@shetzel shetzel commented Nov 30, 2023

What does this PR do?

Enhances ComponentSetBuilder.build() to use both metadata and an org connection when defined in the options. This allows metadata fullName retrieval from an org based on a pattern where the files are not in the local project.

What issues does this PR fix or reference?

@W-14284096@
forcedotcom/cli#2522

QA suggestions:
Use dreamhouse-lwc repo deployed to a scratch org.

  1. deploy should work exactly as before the changes were made. Deploy "ApexClass:Test*", "ApexClass:T*", "ApexClass:Test*,ApexClass:Geo*", "ApexClass:Test*,CustomObject:Prop*"
  2. retrieve with all requested files in the project. Retrieve "ApexClass:Test*", "ApexClass:T*", "ApexClass:Test*,ApexClass:Geo*", "ApexClass:Test*,CustomObject:Prop*"
  3. retrieve with none of the requested files in the project. Retrieve "ApexClass:Test*", "ApexClass:T*", "ApexClass:Test*,ApexClass:Geo*", "ApexClass:Test*,CustomObject:Prop*"
  4. You can even remove one of the Test* apex classes locally and keep the other one, then retrieve "ApexClass:Test*". It should retrieve all of them.

Copy link
Contributor

@mshanemc mshanemc left a comment

Choose a reason for hiding this comment

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

No required changes, just style stuff. Would QA as is if you wanted

src/resolve/connectionResolver.ts Outdated Show resolved Hide resolved
src/collections/componentSetBuilder.ts Outdated Show resolved Hide resolved
src/collections/componentSetBuilder.ts Outdated Show resolved Hide resolved
logger.debug(`Building ComponentSet from targetUsername: ${org.username}`);

let debugMsg = `Building ComponentSet from targetUsername: ${org.username}`;

Copy link
Contributor

Choose a reason for hiding this comment

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

meta: I know we turned off the complexity rule but that just lets this get worse with each change.

could there be a function at the bottom that returns [message: string, filter: [that matches your shape>]] ?

Copy link
Contributor

Choose a reason for hiding this comment

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

and maybe extract the logging stuff (lines 215-230 as a fn)

Copy link
Contributor

Choose a reason for hiding this comment

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

could also the iteration at 122 as a fn (pass in a CS and the metadata object, get back a CS)

src/resolve/connectionResolver.ts Show resolved Hide resolved
src/resolve/connectionResolver.ts Outdated Show resolved Hide resolved
@mshanemc
Copy link
Contributor

mshanemc commented Dec 5, 2023

QA notes:

throwing retrieves at my devHub.

✅ There are 5 object (well, one's a __e PlatformEvent) returned with -m "CustomObject:*" -o hub
✅ Then I did a -m "CustomObject:*Org*" -o hub and it got both the objects containing the word Org

Then I did a -m "Layout:*" -o hub to get all layouts.

-m "Layout:Contact*" -o hub

Retrieved Source
=================================================================================================================================================================
| State   Name                                             Type   Path                                                                                            
| ─────── ──────────────────────────────────────────────── ────── ─────────────────────────────────────────────────────────────────────────────────────────────── 
| Changed Contact-Contact Layout                           Layout force-app/main/default/layouts/Contact-Contact Layout.layout-meta.xml                           
| Changed ContactPointAddress-Contact Point Address Layout Layout force-app/main/default/layouts/ContactPointAddress-Contact Point Address Layout.layout-meta.xml 
| Changed ContactPointEmail-Contact Point Email Layout     Layout force-app/main/default/layouts/ContactPointEmail-Contact Point Email Layout.layout-meta.xml     
| Changed ContactPointPhone-Contact Point Phone Layout     Layout force-app/main/default/layouts/ContactPointPhone-Contact Point Phone Layout.layout-meta.xml 

"Layout:sf_devops__*" -o hub
✅ all the types for that namespace

✅ unsupported types produce a good error.

@mshanemc mshanemc merged commit d4d2b93 into main Dec 5, 2023
68 checks passed
@mshanemc mshanemc deleted the sh/wildcard-retrieval-with-org branch December 5, 2023 19:39
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