Giter VIP home page Giter VIP logo

generator-helix's Introduction

Helix Generator

npm version npm downloads Build Status Dependency Status License

This generator will create a Helix compliant solution and provide the ability to create & add new projects to any layer (i.e. Feature, Foundation & Project). Unicorn is used for serialization, if you don't use serialization and or TDS you have the option not to add serialization to the project.

Prerequisites:

  • VS 2015 or earlier
    If you want to run the generator with only Visual Studio 2017 installed, you need the Microsoft Build Tools 2015 as well. For more information see issue #109 and #107
  • NPM 3.x or newer (see installed version by running npm -v in PowerShell)
  • NODE 6.x or newer (see installed version by running node -v in PowerShell)

Getting started

You need Yeoman (See here) . Yo and the generators used are installed using npm.

First thing is to install Yo using npm.

npm install -g yo

Then you have to install the helix generator.

npm install generator-helix -g

How to create a solution

To create a Helix solution run the following command in an empty root folder where you want the solution to be created, and answer the questions.

yo helix

How to create a new project and add it to a given layer

To add a new project to an existing run the following command in the root directory, that contains the VS solution file. You can call with the Project Name, if you do not you will be prompted to enter it.

yo helix:add [ProjectName] [VendorPrefix]

Modifying the add project generator

Global Template folder

The Template folder contains all the files and folders that are copied to the project folder that is created.

By default, the Template folder for the add generator is at the following path:

C:\Users\[username]\AppData\Roaming\npm\node_modules\generator-helix\generators\add\Templates

You can modify any file in this folder to meet your specific requirements, but it will affect ALL projects.

Solution Specific Temaplte

What if you don't want to change the template for ALL sitecore solutions, but only for a specifc sitecore solution for example you want to do the following

  • Add/Remove files
  • Add/Remove folders
  • Modify file contents

It is possible to define a solution specific Solution Template folder.

To override the default Template folder - add a folder called helix-template to the solution root.

Then all files will be copied from the solution specific helix-template folder instead of the default folder using the copyTpl function in yeoman.

You can inject all the variables that the generator defines into your files using the syntax below for example.

<%= layerprefixedprojectname %>

List of Variables

  • layerprefixedprojectname
  • projectname
  • projectguid
  • layer
  • target
  • vendorprefix

Note

The one special case is that if you have a file called _project.csproj in the folder, it will be copied and then renamed to the correct Project name. This way you can create your own project file that matches your specific needs.

Contributing

We love it if you would contribute! Please read our contributing guide if you're looking to help us out.

Help us! Keep the quality of feature requests and bug reports high

We strive to make it possible for everyone and anybody to contribute to this project. Please help us by making issues easier to resolve by providing sufficient information. Understanding the reasons behind issues can take a lot of time if information is left out. Time that we could rather spend on fixing bugs and adding features. Please adhere to our issues template when creating issues. Creating a new issues will automatically prompt a template that will let you know what the minimum requirements are.

Thank you, and happy contributing!

Versioning

For transparency and insight into our release cycle, and for striving to maintain backward compatibility, the generator-helix project will be maintained under the Semantic Versioning guidelines as much as possible.

Releases will be numbered with the following format:

<major>.<minor>.<patch>

And constructed with the following guidelines:

  • Breaking backward compatibility bumps the major (and resets the minor and patch)
  • New additions without breaking backward compatibility bumps the minor (and resets the patch)
  • Bug fixes and misc changes bumps the patch

For more information on SemVer, please visit http://semver.org/

To create a new version please follow the Release Process.

Troubleshooting

When I execute the yo commands as described I'm met with Execution Policy errors

To get around this issues execute the following command in a command line prompt, such as PowerShell with administrator rights:

Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force

generator-helix's People

Contributors

berendhaan avatar darthlutharus avatar erikandersen avatar fillej avatar hafeok avatar istern avatar jaspervdm80 avatar jimmah avatar jimmierindal avatar kimschioett avatar patelcp avatar saberone avatar saturate avatar takeiteasyalan avatar teltploek avatar tropentia avatar uli-weltersbach avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

generator-helix's Issues

Layername is not used in the serialization.config

User story

As a developer, I want the correct variabel to be used in serialization.config so that the serialized items end up in the correct folder.

Expected behavior

The serialized items should end up in the foundation/feature/project folder.

Actual behavior

The sc-variable thats being used is now hard coded to $(featureFolder). It should depend on the layer that's selected by the user.

Steps to reproduce the behavior

yo helix:add
Select Project as layer.

The following is in the generated serialization.config file :

<targetDataStore
            physicalRootPath="$(featureFolder)\Login\$(configurationFolder)"
            useDataCache="false"
            type="Rainbow.Storage.SerializationFileSystemDataStore, Rainbow"
            singleInstance="true"
          />

Target framework

It should either prompt and or you should specify what the target framework is (be super cool if you could detect what the majority of all the other projects are using and set it to the same value?)

image

The environment project is located directly under the module folder.

User story

As a developer, I want the Environment project to adhere to the habitat structure i.e.

/…
/[Module Name] // Module root folder, named after the module (without prefixes)
/code // Houses the main code for the module, for example the Visual Studio project with the module business logic or views.

Expected behavior

src\Project\Environment\code\Project.Environment.csproj

Actual behavior

src\Project\Environment\Project.Environment.csproj

Steps to reproduce the behavior

Create a clean project with Pentia tooling.

Generator hangs in VS package manager console and Powershell ISE

@soen

User story

As a yo helix generator user, I want to run the generator with in VS package Manager console so that I can quickly spin a new helix solution without moving out of VS

Expected behavior

Generator provides a way to select the solution options with in VS

Actual behavior

VS hangs
https://sitecorechat.slack.com/files/phani_abburi/F49U0FGLT/-.powershell

Steps to reproduce the behavior

run yo helix in VS package manager console

Documentation for extending the generator

As a Developer, I want to extend the default generator so that add my own generator steps. An example could be I want a step to add Sitecore.kernel refenreces

I would expected to find documentation on how to write such an extension

The documentation contains no description on how extend the generator

Error With AlwaysApplyName in the build.js

As a developer I've setup a new solution, and choosen to go with the option of using the pentia tools

after doing a npm install, i would be able to run gulp tasks.

But I get the following Error
The following error is shown within the visual studio output log
PATHTOPROJECT\node_modules.@pentia\publish-projects\build.js:14
this.AlwaysApplyName = this.solutionConfiguration.configurationTransform.AlwaysApplyName;
^
TypeError: Cannot read property 'AlwaysApplyName' of undefined
at new Build (PATHTOPROJECT\node_modules@pentia\publish-projects\build.js:14:75)
at Object. (PATHTOPROJECT\node_modules@pentia\publish-projects\build.js:64:16)
at Module._compile (module.js:397:26)
at Object.Module._extensions..js (module.js:404:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object. (PATHTOPROJECT\node_modules@pentia\publish-projects\gulpfile.js:9:13)
at Module._compile (module.js:397:26)

Steps to reproduce the behavior

To see this error

  1. run yo helix
    Choose the option "with pentia tools"
    F

  2. Point gulp to version 3.9.1 because i cant find a 3.9.5 version

  3. do a npm install

  4. Open visual studio and show output from Task runner.

Execution Policies add-project.ps1 cannot be loaded because running scripts is disabled on this system

External developer tells:

When I am adding a project to a solution through the helix generator, im met by this error

Error: C:\Users\xxx\AppData\Roaming\npm\node_modules\generator-helix\powershell\add-project.ps1 : File C:\Users\xxx\AppData\Roaming\npm\node_modules\generator-helix\powersh
ell\add-project.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at http://go.microsoft.com/fwlink/?Li

Error: nkID=135170.
At line:1 char:1

I would expect to be notified about whether or not i have to run the generator in a special execution policy state. Im not, and the script execution fails.

Add controller, view, model, factory and repository in the correct folders

Add a "Controller.cs" in the /Controllers folder and let it inherit from System.web.mvc.controller, and create a dummy ActionResult method, dummy poco view model, dummy factory and a dummy repository and let the repository get the view model in the controller and create a dummy view model and output some simple data in the view. So it is all hooked up nice and simple.

Add unicorn serialized YAML files

User story

As a developer, If I add serialization, I would also expect that the serialized files are also added, and the required NUGET packages are added to the the project

No solution is created when creating empty helix solution

As a developper, I want to setup a new empty helix folution so that I can start working with sitecore using helix.

After running the generator i would expected to have a empyt vs solution

no solution file is created but correct folder structure is

Reproduce:
Run the generator choose empty helix solution

Error adding feature project due to spaces in the path of the module

D:\Projects\Bane.Website [formsprojecthelixway]> npm install generator-helix -g
C:\Program Files\nodejs
`-- [email protected]

D:\Projects\Bane.Website [formsprojecthelixway]> yo helix:add Feature.Forms

 _-----_
|       |    ╭──────────────────────────╮
|--(o)--|    │    Lets generate that    │

---------´ │ project! │ ( _´U_ ) ╰──────────────────────────╯
/A\ /
| ~ |
'..'_
´ |° ´ Y

? Name of your project Feature.Forms
? Would you like to include Unicorn (serialization)? Yes
? Source code folder name src
? What layer do you want to add the project too? Feature layer?
? Choose target .net framework version? .net 4.6.1
Powershell - running: C:\Program Files\nodejs\node_modules\generator-helix\powershell\add-project.ps1 -SolutionFile 'D:\Projects\Bane.Website\Bane.Website.sln' -Name Feature.Feature.Forms -Type Feature -ProjectPath 'src\Feature\Feature.Forms\code' -SolutionFolderName Fea
ture.Forms
create src\Feature\Feature.Forms\code\Feature.Feature.Forms.csproj
create src\Feature\Feature.Forms\code\Properties\AssemblyInfo.cs
create src\Feature\Feature.Forms\code\App_Config\Include\Feature.Feature.Forms\serialization.config
create src\Feature\Feature.Forms\code\Properties\PublishProfiles\local.pubxml
Error: C:\Program : The term 'C:\Program' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

Error: At line:1 char:1

  • C:\Program Files\nodejs\node_modules\generator-helix\powershell\add-p ...
  •   + CategoryInfo          : ObjectNotFound: (C:\Program:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
    
    
    

Powershell - done running C:\Program Files\nodejs\node_modules\generator-helix\powershell\add-project.ps1-SolutionFile 'D:\Projects\Bane.Website\Bane.Website.sln' -Name Feature.Feature.Forms -Type Feature -ProjectPath 'src\Feature\Feature.Forms\code' -SolutionFolderName
Feature.Forms
D:\Projects\Bane.Website [formsprojecthelixway +1 ~0 -0 !]>

image

Missing files

Remove files from solution (I would prefer this) or create the files.

image

It is AnyCPU not Any CPU

User story

As a Developer, I want I want the build configuration to use AnyCPU so that so that the solution can build. (Please replace the <> areas and remove this parentheses)

Expected behavior

Solution builds using AnyCPU

Actual behavior

Solution does not build using Any CPU

Notice the added space.

Steps to reproduce the behavior

Rewrite powershell scripts to JavaScript

The powershell scripts can be rewritten into javascript, and should be to have as few dependcies on powershell as possible.

The powershell should be made into a module, if the functionality is needed as powershell else where.

Add T4 templates with rainbowcodegeneration and update the template to include field id's with curly brackets ("{" and "}")

Let field types have "{" and "}" in when creating the new ID.
i.e.
WRONG: public static readonly ID FieldId = new ID("d582b575-5fa5-463c-bcc7-e840fa83a995");
CORRECT: public static readonly ID FieldId = new ID("{d582b575-5fa5-463c-bcc7-e840fa83a995}");

Both way will compile and work. But in the real world and working with Sitecore - devs usually copy the ID of a item (including the "{" and "}" i.e. "{d582b575-5fa5-463c-bcc7-e840fa83a995}") and search the VS solution for the specific item ID. So if the T4 templates leave out the curly brackets the VS search hit is missed.

Note: per default the T4 template does create the ID of the template items with curly brackets - so it seems intentionel or simply an oversight to leave out the curly brackets when creating the data template ID's.

Local.pubxml is missing from Project.Environment

User story

When adding a project I get the Local.pubxml, but it is not included in the Project.Environment when creating a solution from scratch

image

Expected behavior

Local.pubxml is added, like when adding a project using yo helix:add

Actual behavior

Local.pubxml is not added

Steps to reproduce the behavior

create a new solution using yo helix, and select pentia tooling.

typos in readme.md

First thing is to install Yo usng nopm.

Should probably be:

First thing is to install yo using npm.

Error with 'Path must be a string' on add project

As a developer, I'm trying to add a project in an Empty Helix Solution.

Instead of generating the new project i'm getting an error message on the 'path must be a string':

events.js:161
throw er; // Unhandled 'error' event
^

TypeError: Path must be a string. Received undefined
at assertPath (path.js:7:11)
at Object.join (path.js:468:7)
at Object.Base.destinationPath (PATHTOGLOBAL\npm\node_modules\generator-helix\node_modules\yeoman-generator\lib\index.js:637:28)
at Object.writing (PATHTOGLOBAL\npm\node_modules\generator-helix\generators\add\index.js:148:62)
at Object. (PATHTOGLOBAL\npm\node_modules\generator-helix\node_modules\yeoman-generator\lib\index.js:408:23)
at PATHTOGLOBAL\npm\node_modules\generator-helix\node_modules\run-async\index.js:25:25
at PATHTOGLOBAL\npm\node_modules\generator-helix\node_modules\run-async\index.js:24:19
at PATHTOGLOBAL\npm\node_modules\generator-helix\node_modules\yeoman-generator\lib\index.js:409:9
at runCallback (timers.js:651:20)
at tryOnImmediate (timers.js:624:5)

Steps to reproduce the behavior

To see this error

  1. run yo helix. Choose the option "Empty Helix Solution"

  2. run yo helix:add

PublishProfile should be added to the project

Currently it is copied in, but as it is not part of the project file it does not show up in the project, and the LastUsedBuildConfiguration setting it therefore not modified if the build target is changed

FileSystem **Debug** Any CPU True False False

Custom console questions and actions

As a developer I'd like to add custom questions to the Helix console when a developer is adding a new project or solution.

It would be nice to be able to call a library of predefined system methods, and in the long term extend with you own custom methods.

It could be json formatted configuration:


{
   "questions": [
   {
      "question": {
         "title": "Include files as part of visual studio?",
         "options": [ 
         {
	    "title": "Yes", 
            "action": "DoAttachAllFilesToVisualStudio()"
         },
         {
	    "title": "No", 
            "action": "NoAction()"
         }  
         ]
      }, 
      "question": {
         "title": "Some other question?",
         "options": [ 
         {
	    "title": "Yes", 
            "action": "DoSomeOtherQuestionMethodAlternativeYes()"
         },
         {
	    "title": "No", 
            "action": "DoSomeOtherQuestionMethodAlternativeNo()"
         }  
         ]
      }
  ]
}

Correct the documentation for adding projects

User story

As a Developer, I want to have correct 'How To Add Project' documentation so that I can follow the documentation easily without confusion. (Please replace the <> areas and remove this parentheses)

image

Expected behavior

Documentation should say

yo helix:add

Actual behavior

Documentation says

yo helix:add [Projectname]

Steps to reproduce the behavior

RTFM :-D

Add in Support For Module Groups

User story

As a developer, I want to be prompted for an optional Module Group name when adding a module so that I can have groupings of logical modules together. This is documented as an optional file structure in section 2.3.1 of the Helix documentation.

Expected behavior

When adding a module to Helix, during the prompts, after Vendor Name prompt, I would expect to see an optional prompt for Module Group.

Actual behavior

The functionality does not prompt for Module Group.

Steps to reproduce the behavior

Adding a module does not provide you a method for specifying a module group.

Adding a new project throws "Cannot find module '../../modules/powershell'"

User story

As a developer, I want to add a new project to my solution so that I can extend my solution.

Expected behavior

When the command yo helix:add is invoked on the solution root folder, I expect that I'm able to add a new project to the solution.

Actual behavior

When I run the command yo helix:add (with or without the optional [ProjectName] argument), I get the following exception:

module.js:471
    throw err;
    ^

Error: Cannot find module '../../modules/powershell'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\Users\xxx\AppData\Roaming\npm\node_modules\generator-helix\generators\add\index.js:5:18)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)

Steps to reproduce the behavior

  1. Install the latest version of the Helix generator (@1.0.10)
  2. Create a new solution using the yo helix command
  3. Try to add a new project to the solution using the yo helix:add command

On step 3, the error will appear.

It should be noted that this error is only present on version @1.0.10

Possibility to add NuGet packages

As a developer, I want NuGet packages as part of my setup so that when I add a new project using the Helix generator the NuGet package is included.

Add T4 templates

User story

As a Developer I would like the option to add the T4 templates.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.