Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions METADATA_SUPPORT.md
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ To contribute a new metadata type, please see the [Contributing Metadata Types t
|FlowSettings|||
|FlowTest|||
|FlowValueMap|||
|FragmentBundle|||
|ForecastingFilter|||
|ForecastingFilterCondition|||
|ForecastingGroup|||
Expand Down
15 changes: 14 additions & 1 deletion src/registry/metadataRegistry.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@
"waveTemplates": "wavetemplatebundle",
"appTemplates": "appframeworktemplatebundle",
"lightningTypes": "lightningtypebundle",
"uiBundles": "uibundle"
"uiBundles": "uibundle",
"fragments": "fragmentbundle"
},
"suffixes": {
"Canvas": "canvasmetadata",
Expand Down Expand Up @@ -5371,6 +5372,18 @@
"directoryName": "policyRuleDefinitionSets",
"inFolder": false,
"strictDirectoryName": false
},
"fragmentbundle": {
"id": "fragmentbundle",
"name": "FragmentBundle",
"directoryName": "fragments",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Renaming this to widgets once the discussion concludes in a separate WI right?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

yes

"inFolder": false,
"strictDirectoryName": true,
"strategies": {
"adapter": "bundle"
},
"supportsPartialDelete": true,
"metaFileSuffix": "fragment.json"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

As Venu mentioned there would be other files as well like "-meta.xml". Need to support that.

}
}
}
8 changes: 7 additions & 1 deletion src/resolve/metadataResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,13 @@ const parseAsMetadata =
if (tree.isDirectory(fsPath)) {
return;
}
return ['DigitalExperience', 'ExperiencePropertyTypeBundle', 'LightningTypeBundle', 'ContentTypeBundle']
return [
'DigitalExperience',
'ExperiencePropertyTypeBundle',
'LightningTypeBundle',
'ContentTypeBundle',
'FragmentBundle',

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The prettier formatter in the pre-commit hook is reformatting it back to
multi-line with trailing comma

]
.map((type) => registry.getTypeByName(type))
.find((type) => fsPath.split(sep).includes(type.directoryName))?.name;
};
Expand Down
1 change: 1 addition & 0 deletions src/utils/filePathGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ export const filePathsFromMetadataComponent = (
['ExperiencePropertyTypeBundle', [join(packageDirWithTypeDir, `${fullName}${sep}schema.json`)]],
['LightningTypeBundle', [join(packageDirWithTypeDir, `${fullName}${sep}schema.json`)]],
['ContentTypeBundle', [join(packageDirWithTypeDir, `${fullName}${sep}schema.json`)]],
['FragmentBundle', [join(packageDirWithTypeDir, `${fullName}${sep}fragment.json`)]],
['WaveTemplateBundle', [join(packageDirWithTypeDir, `${fullName}${sep}template-info.json`)]],
// ui-bundle.json is optional, so only the meta XML is a guaranteed file path.
['UIBundle', [join(packageDirWithTypeDir, `${fullName}${sep}${fullName}.uibundle${META_XML_SUFFIX}`)]],
Expand Down
10 changes: 10 additions & 0 deletions test/resolve/metadataResolver.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,16 @@ describe('MetadataResolver', () => {
expect(mdResolver.getComponentsFromPath(path)).to.deep.equal([expectedComponent]);
});

it('Should determine type for FragmentBundle content file', () => {
const fragmentPath = join('unpackaged', 'fragments', 'myFragment', 'fragment.json');
const treeContainer = VirtualTreeContainer.fromFilePaths([fragmentPath]);
const mdResolver = new MetadataResolver(undefined, treeContainer);
const components = mdResolver.getComponentsFromPath(fragmentPath);
expect(components).to.have.lengthOf(1);
expect(components[0].type.name).to.equal('FragmentBundle');
expect(components[0].name).to.equal('myFragment');
});

it('Should determine type for path of mixed content type', () => {
const path = mixedContentDirectory.MIXED_CONTENT_DIRECTORY_SOURCE_PATHS[1];
const access = testUtil.createMetadataResolver([
Expand Down
10 changes: 10 additions & 0 deletions test/utils/filePathGenerator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,16 @@ const testData = {
},
],
},
bundleFragment: {
fullName: 'myFragment',
typeName: 'FragmentBundle',
expectedFilePaths: [getFilePath('fragments/myFragment/fragment.json')],
expectedComponents: [
{
content: getFilePath('fragments/myFragment'),
},
],
},
nonDecomposedExplicit: {
fullName: 'CustomLabels',
typeName: 'CustomLabels',
Expand Down