public static void Execute() { var controllers = typeof(TypeScriptGeneration).Assembly.ExportedTypes .Where(x => x.BaseType == typeof(ControllerBase)).ToList(); var destination = Path.Combine(RootDirectory.FullName, "Website", "src", "app"); var typeScriptDefinition = TypeScriptDefinitionFactory.Create() .Folder("services", servicesFolder => servicesFolder.HttpServices(controllers, serviceBuilder => serviceBuilder .WithContent(content => content .AddImport("import { HttpClient } from '@angular/common/http';") .AddImport("import { Injectable } from '@angular/core';") .AddImport("import { Observable } from 'rxjs';") .AddDecorator("@Injectable({ providedIn: 'root' })") ))); TypeScriptModelsGeneration .Setup(typeScriptDefinition, destination, (options) => { options.GenerationMode = GenerationMode.Crawl; options.AddNamespaceReplaceRule(nameof(WebApi), "models"); options.CleanDestinationDirectories.AddRange(new [] { "models", "services" }); }) .Execute(); }
static void Main(string[] args) { var definition = TypeScriptDefinitionFactory.Create() .Include(typeof(Session).Assembly); TypeScriptModelsGeneration.Setup(definition, "../../../../../app/Slidezy/src/app/types", options => { options.GenerationMode = TypeScriptModelsGenerator.Options.GenerationMode.Crawl; options.InitializeTypes = false; options.AddNamespaceReplaceRule("Slidezy.Core", string.Empty); }).Execute(); }