SushiScriptCore 1.1.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package SushiScriptCore --version 1.1.3
NuGet\Install-Package SushiScriptCore -Version 1.1.3
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="SushiScriptCore" Version="1.1.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SushiScriptCore --version 1.1.3
#r "nuget: SushiScriptCore, 1.1.3"
#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 SushiScriptCore as a Cake Addin
#addin nuget:?package=SushiScriptCore&version=1.1.3

// Install SushiScriptCore as a Cake Tool
#tool nuget:?package=SushiScriptCore&version=1.1.3

Sushi

Library for converting .NET classes to script language classes.

Currently supports

Author

Jeroen Vorsselman @ 2023

GitHub

NuGet


Main features

  • Support for nested generic types.
  • Compliled using .NET Standard 2.0.
  • Support for .NET Core, .NET Framework etc.
  • Vastly improved compared to its predecessor.
  • Creates extended classes and their constructors.
  • Simple object mapping.
  • Improved type dependency tree ordering.
  • Adds documentation from the XML file generated using MS build.
  • 95% Code coverage.

How to use

Script models are discovered in the Assembly.ExportedTypes. These classes must be decorated with the ConvertToScriptAttribute or by inherit from the IScriptModel interface and can be ignored using the IgnoreForScriptAttribute. <br> Create an instance of the SushiConverter using the given types or assembly and invoke the target script language method to create a converter.

Example

// 1) Get the assembly with the exported types.
var assembly = typeof(PersonViewModel).Assembly;
var converter = new SushiConverter(assembly).UseDocumentation(XmlDocPath);

// 2) Specify conversion options.
var options = new ConverterOptions(excludeComments: true);

// 3) Specify the target language and invoke ToString().
var script = converter.TypeScript(options).ToString();

// 4) The resulting script can be written to a file(stream).
WriteToFile(script, GetFilePath("models.no-comments.ts"));

Typescript result

/**
 * Simple model to verify complex types.
 * @typedef {Object} TypeModel
 * @extends ViewModel 
 */
export class TypeModel extends ViewModel {
    /** A nullable boolean. */
    nullableBool!: boolean | null;
    /** A nullable string, defaults to null. */
    nullableString!: string;
    /** A DateTime instance. */
    date: Date | string | null = null;
    student: StudentViewModel = new StudentViewModel();
    students: Array<StudentViewModel> = [];
    studentPerClass: Array<Array<StudentViewModel>> = [];
    /** A readonly string. */
    readonlyString!: string;

    constructor(value?: any) {
        super(value);

        if (value) {
            this.nullableBool = value.nullableBool;
            this.nullableString = value.nullableString;
            this.guid = value.guid;
            this.date = value.date;
            this.student = value.student;
            this.students = value.students;
            this.studentPerClass = value.studentPerClass;
            this.createdOn = value.createdOn;
            this.readonlyString = value.readonlyString;
        }
    }
}
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

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.3.1 120 3/25/2024
1.3.0 117 3/25/2024
1.2.5 676 11/11/2023
1.2.4 388 11/11/2023
1.2.3 341 11/10/2023
1.2.2 344 11/10/2023
1.2.1 327 11/8/2023
1.2.0 367 11/8/2023
1.1.6 598 10/4/2023
1.1.5 623 8/16/2023
1.1.4 528 8/15/2023
1.1.3 591 5/16/2023
1.1.2 571 5/15/2023
1.1.1 538 5/15/2023
1.1.0 565 5/15/2023
1.0.9 594 5/10/2023
1.0.8 557 5/10/2023
1.0.7 565 5/10/2023
1.0.6 574 5/10/2023
1.0.5 698 1/14/2023
1.0.4 711 1/14/2023
1.0.3 701 1/12/2023
1.0.2 740 1/5/2023
1.0.1 711 1/5/2023
1.0.0 729 1/3/2023