Serialization using Sitecore CLI Tool
Mohamed Sirajudeen
Senior Sitecore Consultant at INSCALE |??2x Sitecore Technology MVP |??4x Sitecore? Certified |??AI Enthusiast |???Blogger |???Speaker
As many of you aware of Sitecore Serialization, I am writing this article to understand why this is so important and some prerequisites to check before proceeding with Sitecore Serialization using CLI Tool.
Why Serialization?
Sitecore Serialization facilitates synchronization of database changes among teams of developers collaborating on the same solution, as well as for individual developers working solo on a project.
Serialization involves converting either an entire Sitecore database or specific items within it into text/yml files. These text/yml files are then utilized to migrate the same database or items to another database or Sitecore solution. Typically integrated with a source control system, Sitecore Serialization streamlines developers ability to synchronize database alterations across their local databases used for solution development. Additionally, the source control system records and facilitates comparison of these database modifications.
We have three methods to do the Serialization in Sitecore.
In this article, I am going to explore things about Sitecore CLI as I am getting some experience in my current project.
Access Point :
When you go the following path there is a Sitecore Serialization config file: App_Config\Sitecore\CMS.Core\Sitecore.Serialization.config which has some basic settings like Serialization type, Sitecore Security Password etc. There is a possible variant for Serialization type is YAML file.
Some Prerequisites to taken care before using Sitecore CLI :
If we would like to do the Sitecore Serialization through Sitecore CLI method, Authentication approval will be provided through Sitecore Identity server. For that Sitecore Identity login should be up and running. For some cases, Identity Server will be down due to AspNetCoreModuleV2 is not installed in your system.
The?Sitecore Command Line Interface?(CLI) is a new tool that was created to improve the Developer Experience with Sitecore 10. And specifically, for usage with serializing Sitecore items.
There are many ways to Serialize the items from the Sitecore, but this Sitecore CLI tool provides the flexibility to get the data from the customized folders.
We can have many modules which is present specifically for individual features. For example, we can have the module.json present specifically for each and every component in the Features folder (Helix Architecture).
领英推荐
To install Sitecore CLI as a local project tool:
dotnet new tool-manifest
dotnet NuGet add source -n Sitecore https://sitecore.myget.org/F/sc-packages/api/v3/index.json
dotnet tool install Sitecore.CLI
5. Go to project folder and run the below command.
dotnet sitecore init
6. Above command creates the "sitecore.json" file in the root directory of the project. It contains schema file path, modules json path, some plugins and other basic settings.
There are list of commands can execute in terms of Serialization using Sitecore CLI.
Commands are listed below :
login - Authenticates the CLI to a Sitecore instance
ser - It contains many commands like push, pull etc to serialize the items.
init - It will create the initialization file in the project.
publish - It performs publish operation.
This is just the start of this Serialization method, so lot more to know about each and every commands in the upcoming article.
Thanks for reading this !
Happy Sitecoring !!