If you want to know more about Sitecore Serialization commands, Refer my previous blog post here.
In this article, I explain the info, and explaincommands in the Sitecore Content Serialization(SCS) module.
To use these commands let’s first set up some example modules in our solution.
So, I alter the sitecore.json in the below manner:
{
"$schema": "./.sitecore/schemas/RootConfigurationFile.schema.json",
"modules": [
"src/Foundation/*/code/*.module.json",
"src/Feature/*/code/*.module.json",
"src/Project/*/code/*.module.json"
],
"plugins": [
"Sitecore.DevEx.Extensibility.Serialization@5.2.113",
"Sitecore.DevEx.Extensibility.Publishing@5.2.113",
"Sitecore.DevEx.Extensibility.Indexing@5.2.113",
"Sitecore.DevEx.Extensibility.ResourcePackage@5.2.113",
"Sitecore.DevEx.Extensibility.Database@5.2.113"
],
"serialization": {
"defaultMaxRelativeItemPathLength": 100,
"defaultModuleRelativeSerializationPath": "serialization",
"removeOrphansForRoles": true,
"removeOrphansForUsers": true,
"continueOnItemFailure": false,
"excludedFields": []
},
"settings": {
"telemetryEnabled": true,
"cacheAuthenticationToken": true,
"versionComparisonEnabled": true,
"apiClientTimeoutInMinutes": 5
}
}
Notice that I have added the Foundation, Feature, & Project layer folders in the modules.
The above configuration will search for module.json file in all the Foundation, Feature, & Project level projects.
Let’s add a few module configuration files.
Foundation.MyFoundation
{
"namespace": "Foundation.MyFoundation",
"items": {
"includes": [
{
"name": "templates",
"path": "/sitecore/templates/Foundation/MyFoundation"
},
{
"name": "renderings",
"path": "/sitecore/layout/Renderings/Foundation/MyFoundation"
}
]
}
}
Feature.MyFeature
{
"namespace": "Feature.MyFeature",
"items": {
"includes": [
{
"name": "templates",
"path": "/sitecore/templates/Feature/MyFeature"
},
{
"name": "renderings",
"path": "/sitecore/layout/Renderings/Feature/MyFeature"
}
]
}
}
The info command displays all the modules included in your configuration.
To display all the modules configured in your solution. Run the below command:
dotnet sitecore ser info
This will display all the modules configured in your solution.
The explain command is used to check which module a particular item belongs to. It can be very useful in cases where, you want to check:
You can then use this information to either perform pull/push on a specific module, or create a new module for the item.
e.g. When the item is included in a module:
e.g. When the item is not part of any configured module:
You can check all my posts related to Sitecore Content Serialization here.