MCPcopy Create free account
hub / github.com/cure53/DOMPurify / verify

Function verify

typescript/verify.js:74–98  ·  view source on GitHub ↗

* Verifies that a TypeScript project compiles. * @param {string} name The name of the project. * @param {string} directory The project directory. * @returns {Promise }

(name, directory)

Source from the content-addressed store, hash-verified

72 * @returns {Promise<void>}
73 */
74async function verify(name, directory) {
75 let compiler = await loadCompiler(directory);
76 let label =
77 compiler === ts ? name : `${name} (TypeScript ${compiler.version})`;
78 let line = ` ${label}...`;
79 process.stdout.write(line);
80
81 let diagnostics = await compile(
82 compiler,
83 path.join(directory, 'tsconfig.json')
84 );
85 let success = diagnostics.length === 0;
86 let report = `\x1b${success ? '[32m✔' : '[31mX'}\x1b[0m`;
87
88 if (process.stdout.isTTY) {
89 process.stdout.write(`\x1b[${line.length}D${report} ${label} \n`);
90 } else {
91 process.stdout.write(` ${report}\n`);
92 }
93
94 if (!success) {
95 printDiagnostics(compiler, diagnostics);
96 process.exitCode = 1;
97 }
98}
99
100/**
101 * Compiles a TypeScript project.

Callers 1

runFunction · 0.85

Calls 3

loadCompilerFunction · 0.85
compileFunction · 0.85
printDiagnosticsFunction · 0.85

Tested by

no test coverage detected