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

fix: properly merge DigitalExperience components W-16646427 #1496

Merged
merged 8 commits into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/convert/metadataConverter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,11 @@ function getMergeConfigOutputs(
const mergeSet = new ComponentSet(undefined, registry);
// since child components are composed in metadata format, we need to merge using the parent
for (const component of output.mergeWith) {
mergeSet.add(component.parent ?? component);
if (component.type.id === 'digitalexperience' && !component.parent?.content) {
Copy link
Member

Choose a reason for hiding this comment

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

does this only happen for DEs? are there other bundle types? you could actually check component.type.strategies.adapter==='digitalExperience' so it would apply to all of the types that use that adapter, which I think is only DEB anyways

Copy link
Member Author

@cristiand391 cristiand391 Feb 7, 2025

Choose a reason for hiding this comment

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

does this only happen for DEs?

technically it should happen with any child type that's addressable without its parent, but yes only DE/DEB use this adapter.
In the investigation the customer mentioned sitedotcom sites were working ok on MPDs, those don't have childs.

you could actually check component.type.strategies.adapter==='digitalExperience'

done ✅

mergeSet.add(component);
} else {
mergeSet.add(component.parent ?? component);
}
}
const writer = new StandardWriter(output.defaultDirectory);

Expand Down
6 changes: 6 additions & 0 deletions src/convert/transformers/defaultMetadataTransformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ const getContentSourceDestination = (
component: SourceComponent,
mergeWith?: SourceComponent
): SourcePath => {
// TODO: remove this and fix how the source dest path is built for DEs being merged.
// bad path:
// `force-app/main/default/digitalExperiences/site/bundle1/sfdc_cms__site/bundle1/sfdc_cms__site`
if (component.type.id === 'digitalexperience') {
return component.getPackageRelativePath(source, targetFormat);
}
if (mergeWith?.content) {
if (component.content && component.tree.isDirectory(component.content)) {
const relative = trimUntil(source, basename(component.content));
Expand Down
Loading