Giter Club home page Giter Club logo

leprechaun's People

Contributors

blipson89 avatar davy803 avatar dependabot[bot] avatar dmealo avatar fjrosario avatar gronex avatar jbreuer avatar kamsar avatar lcjordan avatar mike-jarosch-aw avatar mjarosch 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  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

leprechaun's Issues

[Question/Maybe Bug] namespacing

I'm in a situation right now where an item is located at /sitecore/templates/Feature/Navigation/Menu Item. In the roslyn code gen file, {template.CodeName} is returning Menu Item rather than MenuItem. I was able to determine that if I put a folder inbetween Navigation and Menu Item (i.e. /sitecore/templates/Feature/Navigation/Metadata/Menu Item, {template.CodeName} appropriately becomes MenuItem

I tracked it down to this if statement:
https://github.com/kamsar/Leprechaun/blob/e0a23cb499d11656d2ef1729ed0e8c6da4a31da4/src/Leprechaun/MetadataGeneration/StandardTypeNameGenerator.cs#L48

name = Menu Item. Since there's no ., it doesn't go through ConvertToIdentifier(), which would remove the spaces.

Is there a reason it's like this, or should I open a PR in which this situation is handled?

Troubleshooting Leprechaun.Validation.ArchitectureValidationException

I'm trying to run Leprechaun in a Helix project. When it runs I'm getting the exception

Leprechaun.Validation.ArchitectureValidationException: At least one error occurred validating your template architecture.

I don't see any information in this error that can help me troubleshoot what the problem is. Can you provide assistance in how to troubleshoot this error?

Enhancement suggestion: Ignored base templates should not be removed from template.TemplateInfo.BaseTemplateIds

At the moment, if I use default config which has the template exclusion rules on <templateReader> node:
<excludedBaseTemplate id="{8CA06D6A-B353-44E8-BC31-B528C7306971}" name="Rendering Parameters Template" />
I will have no possibility to know if the template is inherited from rendering parameters template or not.

What I would expect from this type of exclusion is that if we ignore that base template, it is obviously not included into de-serialized base templates property, as well as no fields from that base are template included into AllFields propery. However, I would still like to see base template ID in the template.TemplateInfo.BaseTemplateIds property.

That would mean that Leprechaun did read the .yaml properly, however did not de-serialize ignored base template.

Would that make sense?

Configuration not found on Mac OSX

Running dotnet leprechaun /c Leprechaun.config in a directory with a config fails to find the config file. It displays, "The import path \Users\username\Developer\Project\src\ did not exist, and will be skipped!"

Leprechaun & Sitecore Content Serialization

Is there any public example of project that using Leprechaun with Sitecore content serialization?

I spend a few hours to make it working but only what I can achive is:
1>Loaded metadata for 0 configurations (0 total templates) in 12ms.
1>Code generator has loaded in 199ms.

Multiple Leprechaun configurations in a SCS JSON file

Good morning,

I am currently in an upgrade from Sitecore 8.2 to 10.2, with leprechaun in use. We used it for model generation but also to generate builders to supplement unit tests, coming from a Unicorn background in 8.2. We basically just did this with a CodeGen file in the test project as well.

We are moving to SCS over Unicorn and now that the Serialization and Generation configs are tied together, is it possible to provide multiple generation configurations per serialization configuration?

Thanks,
Ryan

Exited with code 1

I have installed leprechaun 2.2.2 but when i build my project it always comes up with an error “exited with code 1”

same configurations work in other project, its been long i am trying to figure but not sure what is the issue

Configuration name in leprechaun config and module.json are same

same steps giving issues in other developer repo too and they are also facing same issue

what could be wrong?

Add a way to override field types

There may be times when I would like to override the return type of a field. Say for instance I have a droplink that will return IStandardTemplateItem. Maybe I know it'll always be IFooItem. I want to be able to have a way of overriding that.

[BUG] duplicate field code generation

If multiple base templates inherit the same base template, the field code gets generated multiple times.

Example:
The Page Description Base template has a property Introduction on it.
Page Base has Page Description Base as a base template.
Article Page has Page Base and Page Description Base as a base template.

The resulting code generation has Introduction twice.

Generate renderings constant from rainbow files

Is there also a way to generate code from rendering definitions? In TDS we had a structure like this for every project. So the rendering ID is available in code

namespace MySite.Feature.Accordion
{ 
  public static partial class Renderings { 
     public static readonly ID TimelineAccordionContainer = new ID("{80cb32f0-caa0-467a-bbdb-cd82f8f1b9c7}") ;  
  }  
}

Multi-Line Text value in `__Long description` causes generation of .cs files with wrong syntax

Presence of Multi-Line

    Hint: __Long description
    Value: |
      Line 1
      Line 2
      Line 3

__Long description in serialization file

....
ID: "049c2604-7311-45a2-b05d-590dce623b89"
Parent: "049c2604-7311-45a2-b05d-590dce623b88"
Template: "049c2604-7311-45a2-b05d-590dce623b87"
Path: /sitecore/templates/Feature/MyFeature/MyTemplate
Languages:
- Language: en
  Fields:
  - ID: "049c2604-7311-45a2-b05d-590dce623b86"
    Hint: Title
    Value: Field that require long desciption
  - ID: "049c2604-7311-45a2-b05d-590dce623b85"
    Hint: __Long description
    Value: |
      Line 1
      Line 2
      Line 3
 ...     

causes the generation of the .cs file that could not be compiled due to syntax errors.

/// <summary>Line 1
Line 2
Line 3</summary>
[SitecoreField(FieldName = ...)]

Migrate to .net 6

.net core 3.1 is reaching of support this year. Are there any plans for upgrading this repository to .net 6?

Notes

  • Requires .NET 4.6+ (due to Roslyn requirements)

TODO:

  • Target type inference based on includeTemplatesForSelection

Path to Scripts Does Not Work For Tokenized Paths or For Paths Relative to Config File Path

I'm trying to use the NuGet package version and specify the path to the scripts which I want in source control (but not the binaries), but Leprechaun seems to always append whatever path I specify to the path where the executable is (/packages/Leprechaun + /...) which is not to be in source control.

I've tried tokenized paths like $(ConfigDirectory), ./../../../Foundation/... and others, but it's always appended.

Here is the error output I'm getting since it can't find the scripts below the exe in the NuGet packages folder:

[16:21:36] Using gulpfile ~\Source\Repos\Website\Gulpfile.js
[16:21:36] Starting '07-Code-Generate-Models'...
  _                             _                       
 | |    ___ _ __  _ __ ___  ___| |__   __ _ _   _ _ __  
 | |   / _ \ '_ \| '__/ _ \/ __| '_ \ / _` | | | | '_ \ 
 | |__|  __/ |_) | | |  __/ (__| | | | (_| | |_| | | | |
 |_____\___| .__/|_|  \___|\___|_| |_|\__,_|\__,_|_| |_|
           |_|                       Version 1.0.1-pre01
                 @@                 .###@@::;%%&&00'
                @><@               .###@@::;%%&&00'
          ________)               .###@@::;%%&&00'
         |        |              .###@@::;%%&&00'
    _   _|===LI===|_            .###@@::;%%&&00'
   / \_(____________)          .###@@::;%%&&00'
   \  / (88 o  o 88)          .###@@::;%%&&00'
    \/\  88:  7 :88`         .###@@::;%%&&00'
     \/\ '88'=='88'         .###@@::;%%&&00'
      \ \__'8888'__________.###@@::;%%&&00'
       \___<\""/>_____/_/_.###@@::;%%&&00'
          /  ><  \       .###@@::;%%&&00'
        / __/--\__\     (oO@OoO@@o@oO@@o)
        '-.______.-'    /`"""""""""""""`\
          _|_||_|_     |                 |
       ___LI)||(LI___  |                 |
      (   ~~ || ~~   )  \               /
       `-----''-----`    '.___________.'
 
Loaded metadata for 17 configurations (0 total templates) in 156ms.
Unhandled Exception: System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> System.IO.FileNotFoundException: Code generation script 'C:\Users\david\Source\Repos\Website\packages\Leprechaun.Console.1.0.1-pre01\lib\net46\.\src\Foundation\CodeGen\code\Scripts\Diagnostics.csx' was not found on disk.
   at Leprechaun.CodeGen.Roslyn.CSharpScriptCodeGenerator.<ProcessScripts>b__7_0(String script)
   at System.Linq.Parallel.SelectQueryOperator`2.SelectQueryOperatorResults.GetElement(Int32 index)
   at System.Linq.Parallel.QueryResults`1.get_Item(Int32 index)
   at System.Linq.Parallel.PartitionedDataSource`1.ListContiguousIndexRangeEnumerator.MoveNext(T& currentElement, Int32& currentKey)
   at System.Linq.Parallel.StopAndGoSpoolingTask`2.SpoolingWork()
   at System.Linq.Parallel.SpoolingTaskBase.Work()
   at System.Linq.Parallel.QueryTask.BaseWork(Object unused)
   at System.Linq.Parallel.QueryTask.<>c.<.cctor>b__10_0(Object o)
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
   --- End of inner exception stack trace ---
   at System.Linq.Parallel.QueryTaskGroupState.QueryEnd(Boolean userInitiatedDispose)
   at System.Linq.Parallel.SpoolingTask.SpoolStopAndGo[TInputOutput,TIgnoreKey](QueryTaskGroupState groupState, PartitionedStream`2 partitions, SynchronousChannel`1[] channels, TaskScheduler taskScheduler)
   at System.Linq.Parallel.DefaultMergeHelper`2.System.Linq.Parallel.IMergeHelper<TInputOutput>.Execute()
   at System.Linq.Parallel.MergeExecutor`1.Execute()
   at System.Linq.Parallel.MergeExecutor`1.Execute[TKey](PartitionedStream`2 partitions, Boolean ignoreOutput, ParallelMergeOptions options, TaskScheduler taskScheduler, Boolean isOrdered, CancellationState cancellationState, Int32 queryId)
   at System.Linq.Parallel.PartitionedStreamMerger`1.Receive[TKey](PartitionedStream`2 partitionedStream)
   at System.Linq.Parallel.UnaryQueryOperator`2.UnaryQueryOperatorResults.GivePartitionedStream(IPartitionedStreamRecipient`1 recipient)
   at System.Linq.Parallel.QueryOperator`1.ExecuteAndGetResultsAsArray()
   at System.Linq.ParallelEnumerable.ToArray[TSource](ParallelQuery`1 source)
   at Leprechaun.CodeGen.Roslyn.CSharpScriptCodeGenerator.ProcessScripts(String scripts)
   at lambda_method(Closure , Object[] )
   at Configy.Containers.MicroContainer.Activate(Type type, KeyValuePair`2[] unmappedConstructorParameters)
   at Configy.XmlContainerBuilder.<>c__DisplayClass5_0.<RegisterConfigTypeInterface>b__0()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at System.Lazy`1.get_Value()
   at Configy.Containers.MicroContainer.Resolve(Type type)
   at Configy.Containers.MicroContainer.Resolve[T]()
   at Leprechaun.Console.Program.<>c__DisplayClass0_0.<Main>b__0()
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at Leprechaun.Console.Program.Main(String[] args)
[16:21:37] '07-Code-Generate-Models' errored after 529 ms
[16:21:37] Error: Command failed: C:\WINDOWS\system32\cmd.exe /s /c ".\packages\Leprechaun.Console.1.0.1-pre01\lib\net46\Leprechaun.console.exe /c .\src\Foundation\CodeGen\code\Leprechaun.config"
Unhandled Exception: System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> System.IO.FileNotFoundException: Code generation script 'C:\Users\david\Source\Repos\Website\packages\Leprechaun.Console.1.0.1-pre01\lib\net46\.\src\Foundation\CodeGen\code\Scripts\Diagnostics.csx' was not found on disk.
   at Leprechaun.CodeGen.Roslyn.CSharpScriptCodeGenerator.<ProcessScripts>b__7_0(String script)
   at System.Linq.Parallel.SelectQueryOperator`2.SelectQueryOperatorResults.GetElement(Int32 index)
   at System.Linq.Parallel.QueryResults`1.get_Item(Int32 index)
   at System.Linq.Parallel.PartitionedDataSource`1.ListContiguousIndexRangeEnumerator.MoveNext(T& currentElement, Int32& currentKey)
   at System.Linq.Parallel.StopAndGoSpoolingTask`2.SpoolingWork()
   at System.Linq.Parallel.SpoolingTaskBase.Work()
   at System.Linq.Parallel.QueryTask.BaseWork(Object unused)
   at System.Linq.Parallel.QueryTask.<>c.<.cctor>b__10_0(Object o)
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
   --- End of inner exception stack trace ---
   at System.Linq.Parallel.QueryTaskGroupState.QueryEnd(Boolean userInitiatedDispose)
   at System.Linq.Parallel.SpoolingTask.SpoolStopAndGo[TInputOutput,TIgnoreKey](QueryTaskGroupState groupState, PartitionedStream`2 partitions, SynchronousChannel`1[] channels, TaskScheduler taskScheduler)
   at System.Linq.Parallel.DefaultMergeHelper`2.System.Linq.Parallel.IMergeHelper<TInputOutput>.Execute()
   at System.Linq.Parallel.MergeExecutor`1.Execute()
   at System.Linq.Parallel.MergeExecutor`1.Execute[TKey](PartitionedStream`2 partitions, Boolean ignoreOutput, ParallelMergeOptions options, TaskScheduler taskScheduler, Boolean isOrdered, CancellationState cancellationState, Int32 queryId)
   at System.Linq.Parallel.PartitionedStreamMerger`1.Receive[TKey](PartitionedStream`2 partitionedStream)
   at System.Linq.Parallel.UnaryQueryOperator`2.UnaryQueryOperatorResults.GivePartitionedStream(IPartitionedStreamRecipient`1 recipient)
   at System.Linq.Parallel.QueryOperator`1.ExecuteAndGetResultsAsArray()
   at System.Linq.ParallelEnumerable.ToArray[TSource](ParallelQuery`1 source)
   at Leprechaun.CodeGen.Roslyn.CSharpScriptCodeGenerator.ProcessScripts(String scripts)
   at lambda_method(Closure , Object[] )
   at Configy.Containers.MicroContainer.Activate(Type type, KeyValuePair`2[] unmappedConstructorParameters)
   at Configy.XmlContainerBuilder.<>c__DisplayClass5_0.<RegisterConfigTypeInterface>b__0()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at System.Lazy`1.get_Value()
   at Configy.Containers.MicroContainer.Resolve(Type type)
   at Configy.Containers.MicroContainer.Resolve[T]()
   at Leprechaun.Console.Program.<>c__DisplayClass0_0.<Main>b__0()
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at Leprechaun.Console.Program.Main(String[] args)
    at ChildProcess.exithandler (child_process.js:213:12)
    at emitTwo (events.js:87:13)
    at ChildProcess.emit (events.js:172:7)
    at maybeClose (internal/child_process.js:821:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
Process terminated with code 1.```

NuGet package is not up-to-date (1.0.0-pre02)

Hello, I would like to use the NuGet version of this to keep binaries out of source control, but it seems that the only version available there is over a year old and missing many of the great features that you've added. I see that you have some scripts for packaging and pushing to NuGet - is it possibly an issue with these?

Thanks!

Feature Request: Whitelisting for missing base templates

In our solution, we sometimes use the standard rendering parameters item of sitecore as base templates. As this item comes from sitecore and defines some sitecore-internals, we don't want to serialize them.

Due to the missing serialization, we get the following message for all the items with the standard rendering parameters as base template:

Unable to resolve base template 8ca06d6a-b353-44e8-bc31-b528c7306971. No fields from this template will exist.

This is somehow annoying, as a real missing item wouldn't stand out of all these messages. Therefore, it would be really cool to get a possibility to whitelist some missing base templates, so that only "real" missing templates will generate a warning.

NuGet Package Doesn't Have Needed Dependencies?

I'm running Leprechaun from a Gulp script (although I tried from command line with the same result) and receive the following error. If I copy all of the DLLs from the zip on GitHub it works fine, but that shouldn't be necessary for a NuGet package.

Here is the error text:
C:\Users\david\Source\Repos\Website> cmd.exe /c gulp -b "C:\Users\david\Source\Repos\Website" --color --gulpfile "C:\Users\david\Source\Repos\Website\Gulpfile.js" 07-Code-Generate-Models [15:52:55] Using gulpfile ~\Source\Repos\Website\Gulpfile.js [15:52:55] Starting '07-Code-Generate-Models'... Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'CommandLineArgumentsParser, Version=3.0.9.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. at Leprechaun.Console.Program.Main(String[] args) [15:52:55] '07-Code-Generate-Models' errored after 164 ms [15:52:55] Error: Command failed: C:\WINDOWS\system32\cmd.exe /s /c ".\packages\Leprechaun.Console.1.0.1-pre01\lib\net46\Leprechaun.console.exe /c .\src\Foundation\CodeGen\code\Leprechaun.config" Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'CommandLineArgumentsParser, Version=3.0.9.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. at Leprechaun.Console.Program.Main(String[] args) at ChildProcess.exithandler (child_process.js:213:12) at emitTwo (events.js:87:13) at ChildProcess.emit (events.js:172:7) at maybeClose (internal/child_process.js:821:16) at Socket.<anonymous> (internal/child_process.js:319:11) at emitOne (events.js:77:13) at Socket.emit (events.js:169:7) at Pipe._onclose (net.js:469:12) Process terminated with code 1.

Thanks!

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.