Upgrade SXA Themes Using SXA CLI from Sitecore 101 to Sitecore 103
Hello everyone, In this blog we will learn how we can migrate Sitecore npm packages from myget to nuget and also how we can upgrade the SXA CLI Themes from 10.1 to 10.3 version. Recently, I was working on Sitecore 10.3 SXA upgrade project.This was container based application both for local and higher environments. In this project we were using Sitecore SXA CLI 10.1 to push our themese related changes to our Sitecore Instances and we have to upgrade it to 10.3 for the same. We came across two hurdles in that. First of all we have to migrate Sitecore npm package dependecies from https://sitecore.myget.org/f/sc-npm-packages/npm/ to https://www.npmjs.com/package/. The second hurdle was to update the Themes itself.
I will try to provide the approach that we have followed and it has worked for us.
Step 1: We will removed the old sitecore npm package url. In 10.1 we use to set the old url in internal npm configuration. If you want you can manually remove it by navigating to C:/users/{{your.name}}/.npmrc. If there is only single entry then you can just add the below command to your docker environment setup file.
npm config delete @sxa:registry
Step 2:Uninstall the @sxa/CLI@10.1.0
npm uninstall -g @sxa/CLI@10.1.0
Step 3:Install the sxa cli version 10.3. You can find all Sitecore related npm packages Here.Refer below screenshot.
npm install -g @sitecore/sxa-cli@10.3.0
Step 4: Once installed successfully, We will create a new sxa theme. You can find my blog for creating new theme in SXA 10.3 using SXA CLI Here
Step 5:Once the new theme is created, just we need to compare 4 files listed below with old theme files. This is the place were the changes will be there. If there is no change between this files, then you can just replace it. But if there is any, then update you old theme files with the new one by comparing the changes.Refer the below screenshot.
- config.js : This is present under gulp folder
- .eslintrc.js : This is present in root folder of theme
- gulpfile.js : This is present in root folder of theme
- package.json : This is present in root folder of theme. One important thing while updating this files is to migrate dependent npm third party module used in your website in your updated theme
Step 6: Now once everything is in place, just run npm install as it will add all dependency module for your theme. Once it is finished, you can use SXA watch command where it will watch your changes and push it to Sitecore instance.
Step 7: Test your website.
This will give you some insights about upgrading as well as migrating the themes to Sitecore 10.3 version using SXA CLI. Thanks for ready and Happy learning!!
You can check my other blogs too if interested. Blog Website
Comments
Post a Comment