SushiScript.JavaScript 1.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package SushiScript.JavaScript --version 1.0.2                
NuGet\Install-Package SushiScript.JavaScript -Version 1.0.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SushiScript.JavaScript" Version="1.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SushiScript.JavaScript --version 1.0.2                
#r "nuget: SushiScript.JavaScript, 1.0.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install SushiScript.JavaScript as a Cake Addin
#addin nuget:?package=SushiScript.JavaScript&version=1.0.2

// Install SushiScript.JavaScript as a Cake Tool
#tool nuget:?package=SushiScript.JavaScript&version=1.0.2                

Sushi

Library for converting .NET models to different script languages.

Developed by: Jeroen Vorsselman @ 2018<br> GitHub LinkedIn

Main features

Main framework for generating script files.

  • Write inline code documentation to script
  • Customize templates and formatting
  • Extend by implementing your own script-language
  • Write to file (asynchronous)
  • Detect models to convert in assembly
    • By Interface or Attribute <br> <br>

Sushi.JavaScript

Implementation for generating JavaScript (EcmaScript) models.

  • EcmaScript V5 and V6
  • Isolated function-block
  • Complete JsDoc support
  • object parsing & validation
  • Class inheritance <br> <br>

Sushi.JavaScript

Implementation for generating TypeScript models.

  • Able to generate the latest TypeScript specification
  • Able to generate DefinitelyTyped declaration files
    • Use to improve autocomplete for Visual Studio Intellisense
  • Class inheritance <br> <br>

How to use

  1. Create an instance of the ConversionKernel and pass the assembly with the models to convert.
    • Invoke the LoadXmlDocumentation method to try and load the "PROJECT_NAMESPACE".xml file generated by the VS project.
  2. Create the ModelConverter instance for the requested script-language.
    • Default script-languages have a static method for doing this that are named as follows CreateConverterFor + script-language depending on what Sushi implementation is referenced.
  3. Invoke the Convert() method on the created ModelConverter instance.
    • Iterates through each found DataModel and compiles them.
    • The generated script string will be set on the DataModel.Script property.

Reading the generated script as a string:<br> Simply invoke the ModelConverter.MergeModelsToString method and pass the converted IEnumerable<DataModel>. This will iterate through the populated DataModel(s) and join its Script contents to one string. <br> <br> Writing the generated script to a file:<br> The ModelConverter.FlushToFile'Async' can be used to write the script contents to a file with a given name and path. This method uses the ModelConverter.MergeModelsToString method internally to join the generated script(s) to one string. <br>

PLEASE NOTE: The fileName argument does not include its extension. This is defined in the language-specification.

Minifying the generated script:<br> Basic script minification is supported. This only removes return-newline(s), tabs, comments and leading-whitespaces. This can be done in the ModelConverter.MergeModelsToString and ModelConverter.FlushToFile'Async' methods. Both have a minify:boolean argument. <br> <br>

Creating or modifing a script-language

Sushi contains two base-classes for defining a language, the LanguageSpecification and StatementPipeline.<br> Directly linked to how certain placeholders in the template are generated so it can best be explained with including the placeholders.

KEY USAGE SUMMARY
$$SUMMARY$$ LanguageSpecification.FormatProperty The summary doc for the specific PropertyInfo.
$$TYPENAME$$ ModelConverter.Compile>Replace The name for the specific Type to compile.
$$TYPE_NAMESPACE$$ ModelConverter.Compile>Replace The namespace for the specific Type to compile.
$$VALIDATE_OBJECT$$ LanguageSpecification.FormatStatements Placeholder for the Type properties validation.
$$DEFINE_PROPERTIES$$ LanguageSpecification.FormatPropertyDefinition Placeholder for the properties that should be defined.
$$SET_PROPERTY_VALUES$$ LanguageSpecification.FormatProperty Placeholder for the values that should be set.
$$INHERIT_TYPE$$ LanguageSpecification.FormatInheritanceStatement Statement for the name of the inherited Type.
$$DEFINED_CHECK$$ StatementPipeline.ArgumentDefinedStatement Statement if the Property is defined / has a value.
$$UNDEFINED_CHECK$$ StatementPipeline.ArgumentUndefinedStatement Statement if the Property is not defined / has no value.
$$ARGUMENT_NAME$$ ModelConverter.Compile>Replace Placeholder for the argument of the object that should be used.
Product Compatible and additional computed target framework versions.
.NET Framework net461 is compatible.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.1 1,804 5/27/2018 1.1.1 is deprecated because it is no longer maintained.
1.1.0 1,213 5/27/2018
1.0.7 1,330 4/12/2018
1.0.6 1,285 4/12/2018
1.0.5 1,421 4/3/2018
1.0.4 1,293 4/1/2018
1.0.3 1,466 4/1/2018
1.0.2 1,478 3/30/2018
1.0.1 1,398 3/29/2018

- Support for EcmaScript (JavaScript) and TypeScript
     - Write inline code documentation to script
     - Customize templates and formatting
     - Extend by implementing your own script-language
     - Write to file (asynchronous)
     - Detect models to convert in assembly