From 3d41762b316d29e0217060e652bdf45552ffb95b Mon Sep 17 00:00:00 2001 From: Antonio Lanzolla Date: Sun, 29 Jan 2023 12:36:26 +0100 Subject: [PATCH] dotnet new ca-sln created solution with Angular dotnet new ca-sln --apiOnly=true create solution without Angular --- .template.config/template.json | 9 +++ src/WebUI/Properties/launchSettings.json | 7 ++ src/WebUI/WebUI.csproj | 88 +++++++++++++----------- src/WebUI/nswag.json | 8 ++- 4 files changed, 69 insertions(+), 43 deletions(-) diff --git a/.template.config/template.json b/.template.config/template.json index 02177c88d..1ee62509b 100644 --- a/.template.config/template.json +++ b/.template.config/template.json @@ -18,8 +18,17 @@ }, "sourceName": "CleanArchitecture", "preferNameDirectory": true, + "symbols":{ + "apiOnly":{ "type": "parameter", "dataType":"bool", "defaultValue": "false" } + }, "sources": [ { + "modifiers": [ + { + "condition": "(apiOnly)", + "exclude": ["src/WebUI/ClientApp/**/*"] + } + ], "source": "./", "target": "./", "exclude": [ diff --git a/src/WebUI/Properties/launchSettings.json b/src/WebUI/Properties/launchSettings.json index 9dcdb5c5f..9ba871594 100644 --- a/src/WebUI/Properties/launchSettings.json +++ b/src/WebUI/Properties/launchSettings.json @@ -11,10 +11,15 @@ "CleanArchitecture.WebUI": { "commandName": "Project", "launchBrowser": true, + //#if(apiOnly) + "launchUrl": "https://localhost:5001/api", + //#endif "applicationUrl": "https://localhost:5001;http://localhost:5000", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development", + //#if(!apiOnly) "ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.SpaProxy" + //#endif } }, "IIS Express": { @@ -22,7 +27,9 @@ "launchBrowser": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development", + //#if(!apiOnly) "ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.SpaProxy" + //#endif } } } diff --git a/src/WebUI/WebUI.csproj b/src/WebUI/WebUI.csproj index fe330404e..aca8452d7 100644 --- a/src/WebUI/WebUI.csproj +++ b/src/WebUI/WebUI.csproj @@ -4,9 +4,11 @@ net7.0 enable true + ClientApp\ https://localhost:44447 npm start + enable true @@ -25,9 +27,11 @@ + - + + all @@ -42,51 +46,55 @@ + + + OnBuildSuccess + + + + + + + + + + + + + - + + - - - - - - - - - - - - OnBuildSuccess - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - - - - wwwroot\%(RecursiveDir)%(FileName)%(Extension) - PreserveNewest - true - - - + + + + + wwwroot\%(RecursiveDir)%(FileName)%(Extension) + PreserveNewest + true + + + + diff --git a/src/WebUI/nswag.json b/src/WebUI/nswag.json index bd92a82bd..3df3a0e4a 100644 --- a/src/WebUI/nswag.json +++ b/src/WebUI/nswag.json @@ -59,8 +59,9 @@ "referencePaths": [], "useNuGetCache": false } - }, - "codeGenerators": { + } + //#if(!apiOnly) + ,"codeGenerators": { "openApiToTypeScriptClient": { "className": "{controller}Client", "moduleName": "", @@ -124,4 +125,5 @@ "newLineBehavior": "Auto" } } -} + //#endif +} \ No newline at end of file