microsoft/typespec

Public

mirrored from https://github.com/microsoft/typespecAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
e07d86c87a444d4145b98d85fa416eca819e251c

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

packages/html-program-viewer/src/emitter.ts

11lines · modecode

1import { Program, resolvePath } from "@cadl-lang/compiler";
2import { renderProgram } from "./ui.js";
3
4export async function $onEmit(program: Program) {
5 const html = renderProgram(program);
6 const htmlPath = resolvePath(program.compilerOptions.outputPath!, "cadl-program.html");
7 await program.host.writeFile(
8 htmlPath,
9 `<!DOCTYPE html><html lang="en"><link rel="stylesheet" href="style.css"><body>${html}</body></html>`
10 );
11}
12