Introducing Helix DNA

In this post - I'm going to be introducing you to something I've been tinkering with for some time now. I like to call it Helix DNA (Dot Net Accelerator) and Double Helix. These two modules are my twist on creating Helix solutions from scratch. My experiments build on and bring together strands of techniques used previously by luminaries such as Akshay Sura and Mark Duiker. So a big thanks to them for the insights - I hope you like my take on it.

Ultimately - I would like to release my experiments to the community but am keen to see what you make of this post and what the demand is for such a tool. Have I come too late to the Helix party? ;)

TL;DR

If you are the impatient type - you can jump to 2:48 for a demo of Helix DNA and 13:48 for Double Helix. You may also wish to use full screen mode when watching - or use a magnifying glass ;)



So what is Helix DNA?

Helix DNA (Dot Net Accelerator) is a Powershell module that uses EnvDTE tools within Visual Studio to provision Helix solution assets such as projects and items. Helix DNA also makes use of another module - Double Helix which I will get to later.

In order to provision solution projects - Helix DNA makes use of Visual Studio templates. These allow you to define the structure of projects and items that can be added via Visual Studio. When you add a project or item within Visual Studio - you are creating them from VS Templates without knowing it.

Commands

Helix DNA tries to keep things simple and convention based. So it asks you as little as possible - usually one or two things and then gets out of your way. For example -  if you add a new Feature, it will prepend the SolutionName.Feature prefix to the project name.

Solution Setup:

Add-EmptyHelixSolution. This command creates a new solution and creates an empty folder structure in Visual Studio and the file system. Inputs: Directory path, solution name (without .sln extension)

Add-HelixToExistingSolution. Adds Configuration, Feature, Foundation and Project solution folders and file system folders to an existing solution. Inputs: Directory path, solution name (without .sln extension)

Add-NewHelixFeature. Adds a new feature project to the solution given the name of the project, there's no need to provide prefixes. Inputs: Feature name (no spaces or invalid characters)

Add-NewHelixFoundation. Adds a new foundation project given a name. Inputs: foundation name (no spaces or invalid characters).

Add-NewHelixProject. Adds a new "website" project (think Habitat or Common) given a name. Inputs: project name (no spaces or invalid characters)

Copy-GulpConfigurations. Copies gulp-config.js, gulp-file.js, publishsettings.targets and substitutes various values to match your solution and instance settings. Inputs: primary "website" project name.

Import-SitecoreHelixSolution. Imports Helix structure and creates a Visual Studio solution! Inputs: none - all values supplied by configuration.

Convenience:

Add-TemplateFolders. Adds Feature, Foundation and Project folders within the Templates folder of your Sitecore instance.

Add-RenderingFolders. Adds Feature, Foundation and Project folders within the Layouts, Renderings and Models folder of your Sitecore instance.

Add-MediaFolders. Adds Feature, Foundation and Project folders within the Media Library of your Sitecore instance.

Add-PlaceholderSettingsFolders. Adds Feature, Foundation and Project folders within the Placeholder Settings folder of your Sitecore instance.

Add-SettingsFolders. Adds Feature, Foundation and Project folders within the System/Settings folder of your Sitecore instance.

Double Helix (Experimental!)

Double Helix is simply a Powershell module used by Helix DNA to provide a turnkey approach to importing Helix structures into Visual Studio to construct a fully fledged .net (albeit a scaffold) solution which you can then start developing with. Under the hood, it uses Sitecore Powershell Extensions to talk to Sitecore. This also enables you to push items to Sitecore for example, to create the Helix folders to contain Project, Feature and Foundation items.

WARNING: Double Helix is an experimental feature and should be used with caution. While it aims to give you convenience when generating a solution from scratch you are discouraged to do this as Helix (and Agile) principles dictate that your modules should avoid the top-down approach.

As of Sitecore 9.1 - Feature, Foundation and Project folders will be part of the content tree as standard - so the above convenience commands won't be of much use - unless you're using Sitecore 8.x ;)

Visual Studio Integration

As mentioned - Helix DNA uses VS Templats to provision projects. This allows you to provision projects with a predefined structure. The most obvious benefit of this approach is that it is the normal mechanism used to create projects within Visual Studio. Instead of creating a project using the New Project menu action - you are simply calling a PowerShell command that does something similar.

Another added benefit of the VS Template approach is that you can tailor your projects to suit your needs. For example, Feature, Foundation, "Project" projects can be structured very differently. Want to reference specific libraries or packages when provisioning a project? No sweat - you can add nuget references in your .csproj file definition within the template project. You can also create skeleton controllers and views that have the correct naming convention when the project is provisioned.  If you want to provision projects using something like Helix Base - you can do that too - it's all a matter of structuring your template project.

In the next post - I will be taking you through how it call comes together in Visual Studio and what you need to get started. For now - thanks for reading!

Comments

Popular posts from this blog

Alexa and Sitecore Integration - Part 3

Getting Up and Running with Sitecore 9