When is it a good idea to update my Sitecore JavaScript SDK (JSS) version in XM Cloud?
Sitecore frequently releases improvements to JSS. An important consideration that teams might ask themselves is when and why should these updates be brought into the codebase?
Sitecore provides official documentation on how to do this but they do not say when or why you would do this.
For the uninitiated, Sitecore XM Cloud is a SaaS CMS that allows you to build up a UI component library and then configure a WYSIWYG page editor to use that component library so that non-developers can build websites. This is a big value-add for many businesses as they don’t need to be paying expensive developers to make day to day content changes and build marketing pages.
At this point in time, to get the best outcome for everyone involved is to choose Next.js to build your component library and use JSS to enable the fancy page editor features. I go into the history of this consideration in my blog post The Sitecore Experience. JSS also somewhat supports Vue and Angular but these are still leagues behind in functionality.
JSS is under constant improvement by Sitecore. The world of web development is a fast moving space, always has been, and always will be. Security issues are found and fixed. Performance issues are found and fixed. Web standards change. Dependencies on other software change or become obsolete. New features are introduced to improve developer experience or reduce the amount of time it takes to implement something. And of course, Sitecore maintains a big backlog of feature requests from customers that it needs to assess.
So, when should you update the version of JSS you’re using? That is a question that you can’t give a one line answer to as it comes down to every individual business, every individual team, and every individual project to assess.
First off, some considerations.
- The JSS SDK does not use strict SemVer due to needing to maintain compatibility with XM and XP versioning as well as XM Cloud.
@sitecore-jss/*
dependencies should use ~ so that anyone running npm upgrade will automatically get the latest Patch version but not the latest Major or Minor version.- DO use
"@sitecore-jss/sitecore-jss-nextjs": "~21.5.0"
- DONT use
"@sitecore-jss/sitecore-jss-nextjs": "^21.5.0"
Each of the following questions is something you’ll need to answer for yourself to make a call.
- [XM/XP only] If you are not yet on XM Cloud you are likely locked to a specific version of JSS. If the Sitecore instance is being upgraded, the JSS SDK will need to also be updated as the underlying content API may have changed.
- [XM/XP only] If the Sitecore instance is being migrated from XM / XP to XM Cloud, the JSS SDK will need to also be updated as the underlying content API may have changed and you may require specific SDK features to maintain compatibility with XM Cloud.
- Security bulletin published for affected dependencies? If a security bulletin is released, analyse the site to confirm it is applicable and update to at least the latest fixed patch version.
- New JSS SDK Major version is available? Updating to a new Major version will require at least some effort depending on how many Major version changes have been missed.
- New JSS SDK Minor version is available? Minor versions do sometimes have minor breaking changes. These are usually easy to resolve by an experienced developer.
- New JSS SDK Patch version is available? Patch versions don’t usually have any breaking changes. They usually are bugfixes only or very small new features.
- Site is under active development AND a new JSS SDK version is released? Create a task to update to this version and aim to resolve it in a short timeframe.
- Site is not under active development and falls under a maintenance support agreement / cadence of the whole Sitecore solution? Create a recurring task on a quarterly cadence to update to the latest Minor / Patch version. If there is a Major version release then analyse and estimate it and upgrade to it if it is within reasonable effort.
Again, these are just some considerations and you will need to adjust the rank / importance of each consideration as it applies to your projects.