Jss Rule Engine 0.3.1

Jack Spektor
2 min readOct 4, 2024

--

Hello friends.

As you know I’m working on Sitecore JS rule engine implementation

https://jackspektor.medium.com/sitecore-rule-engine-for-jss-compatible-with-xmcloud-87cc5052e051

And as of now we have new updates to the repository with the following features implemented:

Almost full coverage of Sitecore rules and conditions

Finally now we can claim that our Sitecore rules engine implementation can cover almost ALL Sitecore rules with few exceptions (such as for example XPath queries on Sitecore DB that can’t be easily translated into Javascript).

With this coverage I hope the package would be more actively used in Sitecore JSS implementations in the future by the community 🤞

Following rules were added:

  • Device user agent rule
  • Device query string rule
  • Field compares to rule
  • Field is empty rule
  • Item ancestor or self rule
  • Item descendant or self rule
  • Item is in site context rule
  • Item level rule
  • Item parent name rule
  • Item parent template rule
  • Item path rule
  • Item base template rule
  • Item ID rule
  • Item name rule
  • Item template rule
  • Website name rule

Moving packages to separate NPM organisation

As we have multiple NPM packages published it made so much sense to publish them together under NPM organisation.

Not only that it allows to add more people to manage the NPM registry in the future if the module would have additional ongoing contributors (you are very welcome to join).

https://www.npmjs.com/settings/jss-rule-engine/packages

Moving to Monorepo repository

As I was working on the packages implementation it took lots of time to test my NPM package in my demo NextJS JSS app.

I had to publish my package to NPM registry every time and then re-install it in NPM in order to make sure its working.

What a waste of time!

Luckily in Javascript it could be solved with Monorepo and Workspaces patterns that allow to test the package changes without publishing it, as well as keeping the solution structure modular and tidy.

As backend developer transitioning to Full Stack NextJS dev I wasn’t aware of many Javascript tricks and best practices and this project gives me lots of learnings on how to do things in Typescript and NextJS the right way.

Highly recommended to read about it here:

https://wanago.io/2024/03/11/yarn-workspaces-monorepo/#:~:text=Monorepos%20with%20Yarn%20Workspaces&text=With%20monorepos%2C%20we%20keep%20the,directory%2C%20scripts%2C%20and%20dependencies.

Next on the backlog

I’m working on improving the demo NextJS app for the repository as well as planning to add additional demo app for chatbot implementation with business logic based on Sitecore rules.

Stay tuned!

--

--

Jack Spektor
Jack Spektor

Written by Jack Spektor

Sitecore MVP 2018–2020, Sitecore Developer in AKQA, traveler and lover of life. jackspektor.com

No responses yet