forked from FacilityApi/FacilityJavaScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFsdGenJavaScriptApp.cs
More file actions
52 lines (46 loc) · 1.79 KB
/
Copy pathFsdGenJavaScriptApp.cs
File metadata and controls
52 lines (46 loc) · 1.79 KB
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
48
49
50
51
52
using ArgsReading;
using Facility.CodeGen.Console;
using Facility.CodeGen.JavaScript;
using Facility.Definition.CodeGen;
using Facility.Definition.Fsd;
namespace fsdgenjs
{
public sealed class FsdGenJavaScriptApp : CodeGeneratorApp
{
public static int Main(string[] args) => new FsdGenJavaScriptApp().Run(args);
protected override IReadOnlyList<string> Description =>
[
"Generates a JavaScript client for a Facility Service Definition.",
];
protected override IReadOnlyList<string> ExtraUsage =>
[
" --module <name>",
" The module name used by the generated JavaScript.",
" --typescript",
" Generates TypeScript.",
" --express",
" Generates Express service.",
" --fastify",
" Generates a Fastify plugin. When specified, only the server plugin is generated, not the client. EXPERIMENTAL: This option is subject to change/removal without a major version bump.",
" --disable-eslint",
" Disables ESLint via code comment.",
" --no-http",
" Omits generated HTTP client code.",
" --file-name-suffix",
" Suffix to append to generated file names before the file extension.",
];
protected override ServiceParser CreateParser() => new FsdParser(new FsdParserSettings { SupportsEvents = true });
protected override CodeGenerator CreateGenerator() => new JavaScriptGenerator();
protected override FileGeneratorSettings CreateSettings(ArgsReader args) =>
new JavaScriptGeneratorSettings
{
ModuleName = args.ReadOption("module"),
TypeScript = args.ReadFlag("typescript"),
NoHttp = args.ReadFlag("no-http"),
Express = args.ReadFlag("express"),
Fastify = args.ReadFlag("fastify"),
DisableESLint = args.ReadFlag("disable-eslint"),
FileNameSuffix = args.ReadOption("file-name-suffix"),
};
}
}