private void WriteType(TypeMember type, IList <string> commonNamespaceParts) { var syntaxBuilder = new UnitSyntaxEmitter(_codeModel, type); var syntaxTree = syntaxBuilder.EmitSyntax(); var subFolderParts = GetSubFolder(type, commonNamespaceParts); _output.AddSourceFile(subFolderParts, $"{type.Name}.cs", syntaxTree.ToString()); }
public void WriteModule(ModuleMember module, bool privateScope = false) { _code = new CodeTextBuilder(_output.TextOptions); WriteImports(module); if (privateScope) { _code.WriteLine("(function() {"); _code.Indent(1); } WriteMembers(module); WriteGlobalBlock(module); if (privateScope) { _code.Indent(-1); _code.WriteLine("}());"); } _output.AddSourceFile(module.FolderPath, $"{module.Name.ToString(CasingStyle.Kebab)}.js", _code.ToString()); }
public static void AddSourceFile(this ICodeGeneratorOutput output, IEnumerable <string> folderPath, string fileName, string contents) { output.AddSourceFile(new FilePath(folderPath, fileName), contents); }
private void CopyFrameworkFiles() { _output.AddSourceFile(new[] { "src", "components" }, "form.js", GetFrameworkFileContents("Components", "form.js")); }