Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c17b1b4

Browse files
committed
Lots of improvements.
1 parent 0929fe7 commit c17b1b4

22 files changed

+1028
-492
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ indent_style = space
77
insert_final_newline = true
88
trim_trailing_whitespace = true
99

10-
[*.{cake,cs,fsd}]
10+
[*.{cake,cs,fsd,ts}]
1111
indent_size = 4
1212
indent_style = tab

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
.vs/
2+
.vscode/
23
bin/
34
cake/
5+
node_modules/
46
obj/
57
packages/
68
release/

build.cake

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ string GetSemVerFromFile(string path)
3636
return $"{versionInfo.FileMajorPart}.{versionInfo.FileMinorPart}.{versionInfo.FileBuildPart}";
3737
}
3838

39+
void CodeGen(bool verify)
40+
{
41+
ExecuteProcess($@"src\fsdgenjs\bin\{configuration}\fsdgenjs.exe",
42+
@"example\ExampleApi.fsd example\js --indent 2" + (verify ? " --verify" : ""));
43+
ExecuteProcess($@"src\fsdgenjs\bin\{configuration}\fsdgenjs.exe",
44+
@"example\ExampleApi.fsd example\ts --typescript" + (verify ? " --verify" : ""));
45+
}
46+
3947
Task("Clean")
4048
.Does(() =>
4149
{
@@ -54,8 +62,16 @@ Task("Build")
5462
MSBuild(solutionFileName, settings => settings.SetConfiguration(configuration));
5563
});
5664

57-
Task("Test")
65+
Task("VerifyCodeGen")
5866
.IsDependentOn("Build")
67+
.Does(() => CodeGen(verify: true));
68+
69+
Task("CodeGen")
70+
.IsDependentOn("Build")
71+
.Does(() => CodeGen(verify: false));
72+
73+
Task("Test")
74+
.IsDependentOn("VerifyCodeGen")
5975
.Does(() => NUnit3($"tests/**/bin/**/*.UnitTests.dll", new NUnit3Settings { NoResults = true }));
6076

6177
Task("SourceIndex")

example/ExampleApi.fsd

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ service ExampleApi
4141
}
4242

4343
/// Creates a new widget.
44-
[http(method: POST, path: "/widgets/", code: 201)]
44+
[http(method: POST, path: "/widgets", code: 201)]
4545
method createWidget
4646
{
4747
/// The widget to create.
@@ -165,6 +165,16 @@ service ExampleApi
165165
value: Preference;
166166
}
167167

168+
/// Gets service info.
169+
[http(method: GET, path: "/")]
170+
method getInfo
171+
{
172+
}:
173+
{
174+
/// The name of the service.
175+
name: string;
176+
}
177+
168178
/// Demonstrates the default HTTP behavior.
169179
method notRestful
170180
{

example/js/.babelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"presets": ["es2015"]
3+
}

0 commit comments

Comments
 (0)