deno.land / x / deno2node@v1.6.0 / src / cli.ts

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env -S deno run --no-prompt --allow-read=. --allow-write=.import { ts } from "./deps.deno.ts";import { getHelpText } from "./help.ts";import { getVersion, initializeProject } from "./init.ts";import { Context, deno2node, emit } from "./mod.ts";
const { options, fileNames, errors } = ts.parseCommandLine(Deno.args);const tsConfigFilePath = options.project ?? fileNames[0] ?? "tsconfig.json";
if (errors.length) { for (const error of errors) { console.error(error.messageText); } Deno.exit(2);}
if (options.help) { console.log(getHelpText(await getVersion())); Deno.exit(0);}
if (options.version) { console.log("deno2node", await getVersion()); console.log("typescript", ts.version); Deno.exit(0);}
if (options.init) { await initializeProject(); Deno.exit(0);}
console.time("Loading tsconfig");const ctx = new Context({ tsConfigFilePath, compilerOptions: options });console.timeEnd("Loading tsconfig");
await deno2node(ctx);console.time("Emitting");const diagnostics = await emit(ctx.project);console.timeEnd("Emitting");if (diagnostics.length !== 0) { console.info(ctx.project.formatDiagnosticsWithColorAndContext(diagnostics)); console.info("TypeScript", ts.version); console.info(`Found ${diagnostics.length} errors.`); Deno.exit(1);}
deno2node

Version Info

Tagged at
a year ago