Unicorn Config XML to Sitecore CLI module json: GUI-based converter that can parse rules, multiple configuration elements
I created this Unicorn to CLI config migration Github project about 3 years ago with an idea of building a web page that would be hosted public and can be useful to the community to convert unicorn configs to module json files on-the-fly.
Original Web page Github:I then didn't get a chance to implement this anywhere and it went into cold storage. In these 3 years, a lot of changes have occurred in the community and there is a PowerShell script by Árvai Mihály that converts unicorn configs to module json files. All of a sudden, this february I got a chance to convert an existing XM project to XM Cloud and one of the first activities was to convert Unicorn configs to CLI module json files. I initially wanted to use the PS script but my requirements seemed different since what i had on hand wasn't a PoC anymore but a real-time scenario. In a nutshell, apart from converting includes in predicates, these were my requirements:
- Ability to parse rules: exclude/except
- Multiple configuration elements in the same XML config file: ability to separate and add separate module json file for each configuration
- Identify and add dependencies in the JSON file
- Preview and Bulk mode conversion
As a result, I went back to my old web page, created a windows application from it and implemented the above changes. There is a preview option to not only view one script at a time like my original web page but also opt for a bulk conversion.
Here are the screen shots:
Preview mode:
The module json files are stored in the same location as the xml config files.
Conversion log:
Holds details of the converted files since the browsed directory could have many different config files.
Can find multiple configuration elements in a xml config file and splits into its own module.json file named as per namespace:Identifies commented lines and escapes those during parsing.
Provision to add role predicates.
Comments
Post a Comment