public static void Main(string[] args) { var arguments = new CommandLineArgumentParser(args); CleanOutputDirectory(arguments); var models = ModelGenerator.Generate(arguments); ControllerGenerator.Generate(models, arguments); }
internal static void CleanOutputDirectory(CommandLineArgumentParser arguments) { var directory = new DirectoryInfo(arguments.GetOutputPath()); foreach (var file in directory.GetFiles()) { file.Delete(); } foreach (var subDirectory in directory.GetDirectories()) { subDirectory.Delete(true); } }
internal static IReadOnlyList<TypeScriptClass> Generate(CommandLineArgumentParser arguments) { var sourceFileProcessors = SourceFileProcessor.GetSourceFileProcessors(arguments.GetSourcePath(), typeof(GeneratedModel)); var models = GetModels(sourceFileProcessors); if (models.Any()) { FileGenerationHelper.CreateDirectoryIfNecessary(arguments.GetOutputPath(), ModelsDirectoryName); } RenderClassFiles(arguments.GetOutputPath(), models); return models; }