Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command-line interface #872

Merged
merged 269 commits into from May 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
269 commits
Select commit Hold shift + click to select a range
e18507b
Merge changes
Apr 1, 2019
a40a156
Merge
Apr 1, 2019
43f6b04
CommandLine project reference added
Apr 1, 2019
283c837
Working on selenium generator's launcher
Apr 2, 2019
8819b8d
WIP run selenium generator through handler as console app
Strihtrs Apr 2, 2019
a84b4be
Class Arguments moved to CommandLine.Core
Apr 4, 2019
7745df4
Supporting ConfigurationHost for selenium generator
Strihtrs Apr 10, 2019
8b87f1c
merge
Strihtrs Apr 10, 2019
6ab0335
Merge branch 'master' into feature/selenium-generator
Strihtrs Apr 10, 2019
899d4d6
Merge branch 'master' into cli-compiler-invocation
quigamdev Apr 15, 2019
1112e33
Merge branch 'cli-compiler-invocation' into feature/selenium-generator
quigamdev Apr 15, 2019
d164ced
SeleniumGenerator copy from selenium-generator repo
Strihtrs Apr 24, 2019
7ea4daa
Merge branch 'feature/selenium-generator' of https://github.com/rigan…
Strihtrs Apr 24, 2019
821a58b
Merge branch 'master' into cli-compiler-invocation
quigamdev Apr 24, 2019
5d6b126
TestProjectTemplate changes + command handler - test project creating…
Apr 24, 2019
5586f34
Merge branch 'cli-compiler-invocation' into feature/selenium-generator
quigamdev Apr 24, 2019
a2b3aca
Removed old generators and fixed testProjectTemplate
Strihtrs Apr 24, 2019
48a6042
CLI: Resolving of project system, nuget caches and compiler/selenium …
quigamdev Apr 24, 2019
6866c5e
Add nuget packages folder discovery on new csproj sdk
quigamdev Apr 25, 2019
ac03b21
Add project references discovery on new csproj sdk
quigamdev Apr 26, 2019
cad017f
Merge
Apr 26, 2019
b77d598
Merge from selenium-generator repository
Apr 26, 2019
024bd64
Added new package 'DotVVM.Framework.Testing.SeleniumGenerator' to pub…
quigamdev Apr 26, 2019
c8bc499
SeleniumGeneratorOption assemblies fixed
Apr 27, 2019
188025b
Merge branch 'feature/selenium-generator' of https://github.com/rigan…
Apr 27, 2019
b0b1cf6
TestProjectTemplate - WebCsProj path reference added
Strihtrs Apr 27, 2019
d8e6217
Merge branch 'feature/selenium-generator' of https://github.com/rigan…
Strihtrs Apr 27, 2019
48e8f42
SeleniumGenerator class moved to Testing project
Apr 28, 2019
6ba5b24
Added selenium generator runtime.json and deps.json file to dotvvm pa…
quigamdev Apr 28, 2019
96e8112
CLI - Fixed resolving of selenium generator tool
quigamdev Apr 28, 2019
4287ebc
GridViewColumns namespace fixed
Apr 29, 2019
0fb58de
Add debugger starter
Apr 30, 2019
7a42719
changed process exit logic
Apr 30, 2019
0030471
Removed process debugger attaching
Apr 30, 2019
9430a95
Use default metadata values for invocation from MSBuild
Apr 30, 2019
a218783
Merge branch 'master' into feature/selenium-generator
quigamdev Apr 30, 2019
db3ee5d
Supported shadow copying of tools
quigamdev Apr 30, 2019
0b9e38c
Publish script - added Tools publishing
quigamdev May 2, 2019
75388f8
Changed configuration in selenium generator
quigamdev May 2, 2019
89180f8
Added SeleniumHelpers to publish script
quigamdev May 2, 2019
e0512af
SeleniumHelpers current version of project added
May 29, 2019
bf646de
All parts of Selenium Generator moved directory to DotVVM Repository
quigamdev Jun 23, 2019
884ae79
Merge from master
quigamdev Aug 4, 2019
6e3479b
Added clear IIS folders script
quigamdev Aug 21, 2019
ddf4f80
Merge branch 'master' into feature/selenium-generator
quigamdev Aug 30, 2019
b4591d2
Merge branch 'master' into feature/selenium-generator
quigamdev Sep 1, 2019
9eb22a5
Merge branch 'master' into feature/selenium-generator
quigamdev Sep 7, 2019
1b90e59
Added sample and tests, modified templates
quigamdev Sep 8, 2019
fb3c32e
Changes in selenium generation of namespaces
quigamdev Sep 10, 2019
2cf1600
Removed multiple uitest.names
quigamdev Sep 10, 2019
ff3db70
Merge branch 'master' into feature/selenium-generator
quigamdev Sep 18, 2019
fb01f1d
Fix the UITests.Name duplication bug
cafour Sep 20, 2019
dde5df0
Fix the backslash duplication bug
cafour Sep 20, 2019
43e5398
Simplify GetSeleniumHelpersUsingList
cafour Sep 20, 2019
0b4b650
Implement automatic usings for generated control page objects
cafour Sep 20, 2019
c0ca365
Merge branch 'master' into feature/selenium-generator
quigamdev Oct 10, 2019
2ddc322
Merge branch 'master' into feature/selenium-generator
quigamdev Oct 22, 2019
edfd6a9
Merge branch 'master' of github.com:riganti/dotvvm into feature/selen…
cafour Oct 26, 2019
f45b905
Update vscode tasks
cafour Oct 27, 2019
cb3650f
Add WebConfig
cafour Oct 27, 2019
7720a26
Add the net472 target to CommandLine
cafour Oct 27, 2019
34e6c74
Add DotVVM.Samples.SeleniumGenerator.Owin
cafour Oct 27, 2019
5a2c8be
Add ProjectUtils
cafour Oct 27, 2019
7448696
Add basic dependency collection
cafour Oct 27, 2019
ad7d70a
Merge branch 'master' into feature/selenium-generator
quigamdev Nov 1, 2019
5db1a42
Fix NullReferenceException in ProjectDependenciesProvider
cafour Nov 5, 2019
dcbb726
Merge branch 'master' of github.com:riganti/dotvvm into feature/selen…
cafour Nov 22, 2019
1d393dc
Implement ProjectUitls.ResolveMetadata
cafour Nov 22, 2019
23d5fe2
Merge branch 'master' of github.com:riganti/dotvvm into feature/selen…
cafour Nov 29, 2019
3466faa
Make the generator work with owin at least a little
cafour Nov 29, 2019
840da60
Add CLI stub
cafour Nov 30, 2019
b8058f1
Add Crossplatform.sln
cafour Dec 1, 2019
761f3d6
Merge remote-tracking branch 'origin' into feature/selenium-generator
cafour Dec 13, 2019
4352cd5
Remove .vscode
cafour Dec 13, 2019
016f8bd
Ignore .vs, .vscode, and .idea however deep they are
cafour Dec 13, 2019
66b1374
Make Selenium generator buildable on .net 4.5.1
cafour Dec 13, 2019
a534c0c
Merge remote-tracking branch 'origin' into cli
cafour Dec 17, 2019
cb8db0b
Merge remote-tracking branch 'origin' into feature/selenium-generator
cafour Dec 17, 2019
ef86958
Merge master to selenium-generator
quigamdev Apr 30, 2020
93b8290
Merge from master to selenium-generator
quigamdev May 1, 2020
c0bcf9e
Merge from master to featere/selenium-generator
quigamdev May 26, 2020
0dac66d
Merge from v3-master to selenium-generator-v3
quigamdev May 26, 2020
70cc023
Fixed build after merge with master-v3
quigamdev May 31, 2020
94d832c
Removed global.json
quigamdev May 31, 2020
a7d870d
Merge branch 'master' into feature/selenium-generator
quigamdev May 31, 2020
e087d4c
Merge branch 'master' into cli
cafour Jul 29, 2020
6843efd
Merge branch 'feature/selenium-generator' into cli
cafour Jul 29, 2020
7fa51aa
Add Tool stub
cafour Jul 29, 2020
73eb732
Add more of a stub
cafour Jul 29, 2020
a5a0efe
Find VS MSBuild
cafour Jul 31, 2020
3ec466b
Find MSBuild somewhat properly
cafour Jul 31, 2020
582ae8e
Find a prettier MSBuild path
cafour Jul 31, 2020
3ffef44
Actually compile the compiler shim
cafour Aug 3, 2020
d158599
Run the compiler through the shim
cafour Aug 3, 2020
7828705
Push the compiler just a little bit closer to being functional
cafour Aug 4, 2020
62dcda5
Add DotVVM.Cli
cafour Aug 5, 2020
eeb0b51
Refactor Program2
cafour Aug 5, 2020
b6bf95e
Make CommandLine compilable
cafour Aug 5, 2020
6a1a4aa
Rename Templates to Shims
cafour Aug 5, 2020
adc034a
Remove Compiler.Light
cafour Aug 5, 2020
954f324
Add Templater
cafour Aug 5, 2020
db74fba
Add Templater command stubs
cafour Aug 5, 2020
01e4730
Create dotvvm project metadata slightly more properly
cafour Aug 6, 2020
2a8d6af
Add a project metadata middleware
cafour Aug 6, 2020
e56e357
Implement the other templates
cafour Aug 7, 2020
887859d
Pass args from Tool to Compiler
cafour Aug 7, 2020
025abc2
Pass dotvvm package version to the compiler shim
cafour Aug 7, 2020
08b1cdc
Merge CommandLine.Core into CommandLine
cafour Aug 12, 2020
5d2235d
Add OpenApi commands to Tool
cafour Aug 12, 2020
21f8f26
Fix the api create command
cafour Aug 12, 2020
4c1c0f9
Add the api regen command
cafour Aug 12, 2020
1352fa1
Add new selenium generator stubs
cafour Aug 14, 2020
725c8ea
Move DotVVM.Framework.Testing.SeleniumHelpers to DotVVM.Framework.Tes…
cafour Aug 14, 2020
ab69061
Remove remnants of DotVVM.Framework.Testing.SeleniumHelpers
cafour Aug 14, 2020
03132b6
Move the rest of selenium generator to DotVVM.Framework.Testing.Gener…
cafour Aug 14, 2020
b3785ae
Rewrite the Program class of Selenium generator
cafour Aug 14, 2020
99ce7ad
Remove OldProgram
cafour Aug 14, 2020
5c3b7be
Add Selenium generator shim creation logic
cafour Aug 14, 2020
b36b367
Rename some commands
cafour Aug 14, 2020
028e29f
Rename the shim
cafour Aug 14, 2020
2a60094
Move Compiler and SeleniumGenerator samples
cafour Aug 19, 2020
57c573f
Fix the solution file for reals now
cafour Aug 19, 2020
b638d6f
Remove CommandLine
cafour Aug 19, 2020
1b0984e
Remove ConfigurationHost
cafour Aug 19, 2020
de1f161
Fix references to ConfigurationHost
cafour Aug 19, 2020
b7937f6
Make the solution buildable as a whole
cafour Aug 19, 2020
6a2fd9d
Fix paths of Compiler and SeleniumGenerator samples
cafour Aug 19, 2020
c4181f2
Add solution file for Compiler and SeleniumGenerator samples only
cafour Aug 19, 2020
a8eb093
Remove SampleApp1
cafour Aug 19, 2020
4bcbf9f
Rerun resx generator on SeleniumGenerator samples
cafour Aug 19, 2020
f0bc7be
Move the test projects back
cafour Aug 19, 2020
bb94aeb
Invalidate ProjectMetadata if the paths no longer exist
cafour Aug 19, 2020
e0e7004
Merge branch 'feature/selenium-generator-v3' of github.com:riganti/do…
cafour Aug 21, 2020
c8afde1
Merge branch 'master-v3' of github.com:riganti/dotvvm into cli
cafour Aug 21, 2020
14c98fd
Merge branch 'v3-master' of github.com:riganti/dotvvm into cli
cafour Aug 21, 2020
a84258f
Fix a compilation error in DotVVM.diff.Tests.ts
cafour Aug 21, 2020
6ea6ea6
Make Tool buildable on net472
cafour Aug 21, 2020
55e3d1e
Strive to get target frameworks properly
cafour Aug 21, 2020
de8dc17
Replace Tool's T4 templates with string interpolation
cafour Aug 21, 2020
c509cc6
Add the WriteDotvvmMetadata task
cafour Aug 21, 2020
13b0fcd
Fix GetRelativePath
cafour Aug 24, 2020
c2c5d83
Rename DotVVM.Tool to DotVVM.CommandLine
cafour Aug 24, 2020
1ff96ab
Add .dotvvm.json to .gitignore
cafour Aug 24, 2020
a11266e
Remove already-tracked .dotvvm.json files
cafour Aug 24, 2020
baab507
Rename DotVVM.Cli to DotVVM.CommandLine.Common
cafour Aug 24, 2020
c15b5d5
Add WriteProjectMetadata
cafour Aug 24, 2020
a2e8e20
Implement the info command
cafour Aug 24, 2020
ba3241c
Add vswhere and tweak target frameworks
cafour Aug 25, 2020
e1c2db0
Fix the msbuild-finding logic
cafour Aug 25, 2020
f11bf40
Determined the target framework of the shim based on the project
cafour Aug 25, 2020
c5a6368
Mess around with MSBuild
cafour Aug 26, 2020
31668d7
Remove DotVVM.Compiler.Wat
cafour Aug 27, 2020
08de941
Work around a breaking change in DotVVMConfiguration
cafour Aug 27, 2020
56bfea2
Make Compiler non-internal
cafour Aug 27, 2020
6fefd9f
Flatten Compiler's namespaces
cafour Aug 27, 2020
51eeae0
Remove Compiler's app.config
cafour Aug 27, 2020
e2d963c
Merge branch 'v3-master' of github.com:riganti/dotvvm into cli
cafour Oct 1, 2020
b1248b7
Fix solution file
cafour Oct 1, 2020
1141b1a
Fix compilation
cafour Oct 1, 2020
67f59f3
Make Compiler an executable once more
cafour Oct 1, 2020
b9338d5
Work on Compiler
cafour Oct 1, 2020
239b343
Make the compiler pseudo-work at least on netcoreapp3.1
cafour Oct 2, 2020
3f4d201
Add AppDomainExecutor
cafour Oct 8, 2020
cd57c32
Add StaticViewControlResolver
cafour Oct 9, 2020
653f805
Move configuration creation logic
cafour Oct 12, 2020
d7e5288
Add a hack around ReflectionUtils.FindType
cafour Oct 13, 2020
a549c4e
Work around some more issues caused by GetAllAssemblies
cafour Oct 16, 2020
baa3a1d
Emit actual, proper assemblies
cafour Oct 16, 2020
466b12c
Fix StaticView.ViewType resolution
cafour Oct 21, 2020
7f51ece
Add TextReportLogger
cafour Oct 23, 2020
7851ed6
Replace AppDomainExecutor with DefaultCompilerExecutor
cafour Oct 23, 2020
3ca9691
Attemp to hack around TypeRegistry
cafour Oct 23, 2020
3836329
Hack around ReflectionUtils with Reflection magic
cafour Oct 30, 2020
bcf22ea
Add AppDomainCompilerExecutor
cafour Oct 30, 2020
ffe49ec
Merge remote-tracking branch 'origin/main' into cli
cafour Nov 4, 2020
05bb837
Remove netcoreapp2.1-specific code
cafour Nov 5, 2020
c5cd643
Remove some dependencies of the Compiler
cafour Nov 6, 2020
7aad0b2
Add a compiler dir fallback to assembly resolution
cafour Nov 6, 2020
75877ad
Remove the System.CommandLine dependency from compiler
cafour Nov 6, 2020
9ff5d70
Add a nuspec file for DotVVM.CommandLine
cafour Nov 13, 2020
59326a7
Merge remote-tracking branch 'origin/main' into cli
cafour Nov 20, 2020
490ef43
Revert unnecessary whitespace changes
cafour Nov 20, 2020
4c0ebfe
Remove SeleniumGenerator (in this branch anyway)
cafour Nov 20, 2020
a19a643
Remove further unnecessary changes
cafour Nov 20, 2020
8a06d52
Revert back to the SeleniumGenerator from main
cafour Nov 20, 2020
c517e70
Undo further unnecessary changes
cafour Nov 20, 2020
eb5e6eb
Put SeleniumGenerator back in the solution
cafour Nov 20, 2020
fac4a0b
Add DotvvmProject
cafour Nov 27, 2020
ace2e73
Merge main into cli
quigamdev Nov 27, 2020
731ea31
Make CLI (almost) publishable
cafour Dec 4, 2020
1eaf095
Add the tools directory of the CLI to publish and pack
cafour Dec 4, 2020
7b1bdfa
Fix the target arg
cafour Dec 4, 2020
a957c5b
Add OutputPath to DotvvmProject
cafour Dec 4, 2020
336e30c
Fix target's default value
cafour Dec 4, 2020
795e570
Fix the linter
cafour Dec 5, 2020
9661191
Remove deprecated types
cafour Dec 5, 2020
84ada45
Remove DotVVM.CommandLine.Common from the solution
cafour Dec 5, 2020
b77258b
Remove the Compiler from the main project
cafour Dec 5, 2020
21f4ced
Remove a semicolon
cafour Dec 21, 2020
e9bcd03
Make Compiler compile under 2.5.0
cafour Dec 21, 2020
51a5daa
Fix a bug in the 2.5.0 version of the Compiler
cafour Dec 21, 2020
79a00d2
Merge branch 'main' of github.com:riganti/dotvvm into cli
cafour Jan 15, 2021
ab6ac64
Remove machine specific launchSettings.json
cafour Jan 15, 2021
a9b235e
Remove no longer used compiler types
cafour Jan 15, 2021
d4759d7
Move bulk of static dothtml compilation to Framework
cafour Jan 15, 2021
b67e077
Fixed package publish script
tomasherceg Jan 16, 2021
bc92fd0
NuGet package version 3.0.0-preview02-101797-cli
Jan 16, 2021
2aa6748
Make the linter return 1 on errors and warnings
cafour Jan 16, 2021
c9096cf
Fix the Compiler's missing dll issue on netcoreapp3.1
cafour Jan 16, 2021
b202eb4
Add a check for argument existence to the Compiler
cafour Jan 17, 2021
69138a6
Merge branch 'main' into cli
quigamdev Jan 20, 2021
ed3479f
Merge branch 'main' of github.com:riganti/dotvvm into cli
cafour Jan 22, 2021
48b0c4c
Merge branch 'main' into cli
quigamdev Feb 13, 2021
61afc69
Merge branch 'main' into cli
quigamdev Feb 14, 2021
e1fd348
Merge branch 'main' into cli
quigamdev Feb 25, 2021
f175666
Merge main into cli
quigamdev Feb 26, 2021
5581812
Merge branch 'main' into cli
cafour Mar 5, 2021
6a5c78e
Move ICompilerExecutor to Framework
cafour Mar 5, 2021
f9a7a94
Move ICompilerExecutor back to Compiler
cafour Mar 5, 2021
132fff6
Remove the InitializeDotvvmControls hack
cafour Mar 5, 2021
6a0530e
Rename Report to CompilationReport
cafour Mar 5, 2021
383d6fe
Add StaticViewCompiler.CompileAll
cafour Mar 5, 2021
08a2f7e
Remove dead code and add DotvvmConfiguration.CreateInternal
cafour Mar 5, 2021
bbac6a2
Uncomment Compiler's replacement of the default DepedencyContext
cafour Mar 5, 2021
c50a90e
Update CLI's packages
cafour Mar 5, 2021
dcbcff7
Add the API client regen command back into CLI
cafour Mar 5, 2021
08b8755
Merge main into cli
quigamdev Mar 12, 2021
84bcc06
Merge main into cli
quigamdev Mar 24, 2021
7ff70fd
NuGet package version 3.0.0-preview05-108700-cli
Mar 25, 2021
6e05a53
Merge main into cli
quigamdev Apr 13, 2021
b1eb4fd
Merge branch 'main' into cli
quigamdev Apr 24, 2021
11e8687
NuGet package version 3.1.0-preview01-110545-cli
Apr 25, 2021
924f72f
NuGet package version 3.1.0-preview01-110553-cli
Apr 25, 2021
de886f7
Added message to publish profile, changed dotvvm.compiler language ve…
quigamdev Apr 25, 2021
6d38150
NuGet package version 3.1.0-preview01-110566-cli
Apr 25, 2021
43bac38
Dotvvm Compiler - removed duplicate output type and added IsPackage attr
quigamdev Apr 25, 2021
aec0c74
NuGet package version 3.0.0-preview05-110575-cli
Apr 25, 2021
56aa7ee
NuGet package version 3.1.0-preview05-110581-cli
Apr 25, 2021
b38c790
Merge branch 'main' into cli
quigamdev Apr 25, 2021
20e0d13
NuGet package version 3.1.0-preview01-110600-cli
Apr 25, 2021
e9c3bfa
Merge main into cli
quigamdev Apr 26, 2021
ec1f723
Merge branch 'main' into cli
quigamdev May 14, 2021
ffd6f8e
Excluded .dotvvm.json file from project
quigamdev May 14, 2021
8c12eca
NuGet package version 3.1.0-preview02-111634-cli
May 14, 2021
b9b4aec
Add vswhere back to cli
cafour May 16, 2021
161c944
Fix incorrect propagation of dlls into the CLI
cafour May 16, 2021
22d67de
Merge branch 'main' into cli
quigamdev May 20, 2021
2828991
NuGet package version 3.1.0-preview03-111991-cli
May 20, 2021
e9bd8b4
Compiler - Added invocation of ConfigureServices() function
quigamdev May 20, 2021
749100f
Merge branch 'cli' of https://github.com/riganti/dotvvm into cli
quigamdev May 20, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 14 additions & 6 deletions .gitignore
Expand Up @@ -125,7 +125,7 @@ publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# TODO: Comment the next line if you want to checkin your web deploy settings
cafour marked this conversation as resolved.
Show resolved Hide resolved
# but database connection strings (with potential passwords) will be unencrypted

*.publishproj
Expand Down Expand Up @@ -184,7 +184,6 @@ UpgradeLog*.htm
FakesAssemblies/
*.bak
/src/DotVVM.sln.GhostDoc.xml
/src/.vs
/src/DotVVM.Framework/Resources/Scripts/DotVVM.js.map
/src/DotVVM.Framework.Tests.Javascript/tests/*.js
/src/DotVVM.Framework.Tests.Javascript/tests/*.js.map
Expand All @@ -195,12 +194,21 @@ FakesAssemblies/
/src/Tools/DotVVM.Framework.Hosting.Owin.nuspec
/src/DotVVM.Samples.Common/Temp/returnedFiles

/.vs
/.vscode
/.idea
/src/.idea
.vs/
.vscode/
.idea/

/src/DotVVM.Samples.BasicSamples.Api.AspNetCore/temp/returnedFiles
/src/DotVVM.Framework.Tools.SeleniumGenerator/Properties/launchSettings.json
/src/DotVVM.Compiler/Properties/launchSettings.json
/src/DotVVM.Framework.Tests.Javascript/package-lock.json
/src/DotVVM.Framework/package-lock.json

.dotvvm/
.dotvvm.json


*.binlog
/src/DotVVM.Framework/.vs/VSWorkspaceState.json
/src/Tools/npm/dotvvm-types/*.d.ts
/src/DotVVM.Framework/junit.xml
Expand Down
43 changes: 43 additions & 0 deletions src/DotVVM.CommandLine/ApiClientDefinition.cs
@@ -0,0 +1,43 @@
using System;
using System.ComponentModel;
using System.IO;
using System.Text.Json.Serialization;

namespace DotVVM.CommandLine
{
public class ApiClientDefinition
{
public const string DefaultSwaggerFile = "openapi.json";
public const string DefaultCSharpClient = "ApiClient.cs";
public const string DefaultTypeScriptClient = "ApiClient.ts";
public const string DefaultInvalidNamespace = "Invalid.Namespace";

[JsonPropertyName("swaggerFile")]
public Uri SwaggerFile { get; set; }
= new Uri(Path.Combine(Directory.GetCurrentDirectory(), DefaultSwaggerFile));

[JsonPropertyName("csharpClient")]
public string CSharpClient { get; set; } = DefaultCSharpClient;

[JsonPropertyName("typescriptClient")]
public string TypescriptClient { get; set; } = DefaultTypeScriptClient;

[JsonPropertyName("namespace")]
public string Namespace { get; set; } = DefaultInvalidNamespace;

[JsonPropertyName("compileTypescript")]
[DefaultValue(true)]
public bool CompileTypescript { get; set; } = true;

[JsonPropertyName("generateWrapperClass")]
[DefaultValue(true)]
public bool GenerateWrapperClass { get; set; } = true;

[DefaultValue(false)]
[JsonPropertyName("isSingleClient")]
public bool IsSingleClient { get; set; }

[JsonPropertyName("fetchOptions")]
public ApiClientFetchOptions FetchOptions { get; set; } = new ApiClientFetchOptions();
}
}
@@ -1,17 +1,12 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using Newtonsoft.Json;
using System.Text.Json.Serialization;

namespace DotVVM.CommandLine.Metadata
namespace DotVVM.CommandLine
{
public class ApiClientFetchOptions
{

[DefaultValue("same-origin")]
[JsonProperty("credentials")]
[JsonPropertyName("credentials")]
public string Credentials { get; set; } = "same-origin";

}
}
}
152 changes: 152 additions & 0 deletions src/DotVVM.CommandLine/CommandLineExtensions.cs
@@ -0,0 +1,152 @@
using System.Collections.Generic;
using System.CommandLine.Builder;
using System.CommandLine.Invocation;
using System.CommandLine.Parsing;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using DotVVM.CommandLine;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Logging.Console;

namespace System.CommandLine
{
public static class CommandLineExtensions
{
public const string VerboseAlias = "--verbose";
public const string DebuggerBreakAlias = "--debugger-break";
public const string TargetArg = "target";

public static ILoggerFactory Factory = new NullLoggerFactory();

private static readonly Option<bool> verboseOption = new Option<bool>(
aliases: new[] { "-v", VerboseAlias },
description: "Print more verbose output");

private static readonly Option<bool> debuggerBreakOption = new Option<bool>(
alias: DebuggerBreakAlias,
description: "Breaks to let a debugger attach to the process");

private static readonly Argument<FileSystemInfo> targetArgument = new Argument<FileSystemInfo>(
name: TargetArg,
description: "Path to a DotVVM project")
{
Arity = ArgumentArity.ZeroOrOne
};

public static void AddRange(this Command command, params Symbol[] symbols)
{
foreach (var symbol in symbols)
{
command.Add(symbol);
}
}

public static void AddVerboseOption(this Command command)
{
command.AddGlobalOption(verboseOption);
}

public static void AddDebuggerBreakOption(this Command command)
{
command.AddGlobalOption(debuggerBreakOption);
}

public static void AddTargetArgument(this Command command)
{
command.AddArgument(targetArgument);
}

public static CommandLineBuilder UseLogging(this CommandLineBuilder builder)
{
return builder.UseMiddleware(async (c, next) =>
{
var logLevel = c.ParseResult.ValueForOption(verboseOption)
? LogLevel.Debug
: LogLevel.Information;
Factory = LoggerFactory.Create(b => b.AddConsole().SetMinimumLevel(logLevel));
var loggerName = GetCommandPath(c.ParseResult.CommandResult);
c.BindingContext.AddService(_ => Factory.CreateLogger(loggerName));
await next(c);
Factory.Dispose();
});
}

public static CommandLineBuilder UseDotvvmMetadata(this CommandLineBuilder builder)
{
return builder.UseMiddleware(async (c, next) =>
{
var target = FindTarget(c.ParseResult);
if (target is object)
{
var logger = Factory.CreateLogger("Project Metadata");
var csproj = DotvvmProject.FindProjectFile(target.FullName);
if (csproj is null)
{
logger.LogError($"No project could be found in '{target}'.");
c.ResultCode = 1;
return;
}

var project = DotvvmProject.FromCsproj(csproj.FullName, logger);
if (project is null)
{
c.ResultCode = 1;
return;
}

c.BindingContext.AddService(_ => project);
}
await next(c);
});
}

public static CommandLineBuilder UseDebuggerBreak(this CommandLineBuilder builder)
{
return builder.UseMiddleware(async (c, next) =>
{
var shouldBreak = c.ParseResult.ValueForOption<bool>(DebuggerBreakAlias);
if (shouldBreak)
{
var logger = Factory.CreateLogger("debugging");
var pid = Diagnostics.Process.GetCurrentProcess().Id;
logger.LogInformation($"Started with PID '{pid}'. Waiting for debugger to attach.");
Debugger.Break();
}
await next(c);
});
}

private static FileSystemInfo? FindTarget(ParseResult result)
{
CommandResult? current = result.CommandResult;
while (current is object)
{
var target = current.Command.Arguments.FirstOrDefault(c => c.Name == TargetArg);
if (target is object)
{
var fsInfo = result.ValueForArgument((Argument<FileSystemInfo>)target);
fsInfo ??= new DirectoryInfo(Environment.CurrentDirectory);
return fsInfo;
}
current = current.Parent as CommandResult;
}
return null;
}

private static string GetCommandPath(CommandResult result)
{
var names = new List<string>();
CommandResult? current = result;
while (current is object)
{
names.Add(current.Symbol.Name);
current = current.Parent as CommandResult;
}
names.Reverse();
return string.Join(" ", names);
}
}
}
54 changes: 0 additions & 54 deletions src/DotVVM.CommandLine/Commands/Arguments.cs

This file was deleted.

29 changes: 0 additions & 29 deletions src/DotVVM.CommandLine/Commands/CommandBase.cs

This file was deleted.