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: custom label beta 2 #1392

Merged
merged 32 commits into from
Aug 15, 2024
Merged

feat: custom label beta 2 #1392

merged 32 commits into from
Aug 15, 2024

Conversation

mshanemc
Copy link
Contributor

@mshanemc mshanemc commented Aug 9, 2024

What does this PR do?

after beta feedback forcedotcom/cli#2840 and discussion forcedotcom/cli#2948, update the way labels decompose.

Meta

  • CustomLabels and CustomLabel both use the default Adapter (no change) and can stand alone as SourceComponents. There is no relationship between them, except for the output of the Transformers
  • CustomLabel is always used for source format (1 file per label)
  • CustomLabels is always uses for metadata format (1 file with all the labels in it. named CustomLabels)
  • since the mergeSet will be a bunch of customLabel, but the retrieve is CustomLabels, toSourceFormat needs the entire mergeSet (and not a single mergeWith SourceComponent) to find components with the matching fullName (for labels outside the default dir, to avoid creating duplicates).

change the decomposeCustomLabelsBeta to do one file per label (preset update)

  • 2 new transformer classes in file to handle label/labels
  • new finalizer for labels
  • the toSourceFormat method now takes an object (component, mergeComponent, and [new] the entire mergeSet)
  • presets can put an empty string "" for suffix/childTypes/strictDirs to remove an entry from the default registry (this preset removes the parent/child relationship between label/labels)

other

  • TODOs for removing exported Transformers in the next major. These aren't used that I could see and should never have been exported.

QA notes

there are some small changes in STL necessary to make this behave right forcedotcom/source-tracking#651 and you'll need those for testing tracking.

Tested during development

  • local create, preview, deploy
  • deploy via mpd
  • remote update, track, retrieve
  • remote delete, track, retrieve
  • local delete, track, retrieve
  • retrieve into mpd (existing local labels with remote change update, new labels are placed in default dir, can do both)
  • label file outside of the /labels folder in source format (deploy, retrieve using -m CustomLabel:foo)
  • subfolders within the /labels directory for grouping labels (deploy, retrieve changes)
  • retrieve using --metadata CustomLabels ("give me all of them") doesn't match the local CustomLabel and put them in the right places (they'll all end up in the default directory). Workaround --metadata CustomLabel (using --metadata CustomLabels now throws an error when the new Transformer is used).

What issues does this PR fix or reference?

@W-16375268@

src/index.ts Show resolved Hide resolved
src/registry/presets/decomposeCustomLabelsBeta.json Outdated Show resolved Hide resolved
@mshanemc mshanemc marked this pull request as ready for review August 9, 2024 20:59
@mshanemc mshanemc requested a review from a team as a code owner August 9, 2024 20:59
@shetzel shetzel merged commit 51cbe84 into main Aug 15, 2024
9 checks passed
@shetzel shetzel deleted the sm/custom-label-beta-2 branch August 15, 2024 18:49
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