Serialization using Sitecore CLI Tool

Serialization using Sitecore CLI Tool

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.

  1. Unicorn
  2. TDS
  3. Sitecore CLI

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.

Serialization Type

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:

  1. Install Sitecore Management Services ==> Sitecore Management Services Package
  2. Open Windows PowerShell or Command Prompt in Administrator mode.
  3. To install Sitecore CLI, go to project folder and install Sitecore CLI using below command

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 !!

要查看或添加评论,请登录

Mohamed Sirajudeen的更多文章

社区洞察

其他会员也浏览了