microsoft/typespec

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
8af108ddebe4ceed6e6629ce1f9a200e7ceb113c

Branches

Tags

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

Clone

HTTPS

Download ZIP

packages/compiler/scripts/watch-tmlanguage.js

17lines · modecode

1import { runWatch } from "@cadl-lang/internal-build-utils";
2import { copyFile } from "fs/promises";
3import mkdirp from "mkdirp";
4import { resolve } from "path";
5import { pathToFileURL } from "url";
6
7let count = 0;
8const scriptPath = resolve("dist/server/tmlanguage.js");
9
10async function regenerate() {
11 const script = await import(`${pathToFileURL(scriptPath)}?q=${count++}`);
12 await script.main();
13 await mkdirp("../cadl-vscode/dist");
14 await copyFile("dist/cadl.tmLanguage", "../cadl-vscode/dist/cadl.tmLanguage");
15}
16
17runWatch("dist/server/tmlanguage.js", regenerate, {});
18