From b240d590baf4a22d39b4ae912724db9c03d4de81 Mon Sep 17 00:00:00 2001 From: Ilya Klimenko Date: Tue, 22 Nov 2022 15:30:36 +0300 Subject: [PATCH 1/3] Added taskfile with build pipelines --- .env | 5 ++ .gitignore | 1 + .../Asp.AwesomeTemplates.Main.Nuget.csproj | 2 +- Taskfile.yaml | 57 +++++++++++++++++++ 4 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 .env create mode 100644 Taskfile.yaml diff --git a/.env b/.env new file mode 100644 index 0000000..8682181 --- /dev/null +++ b/.env @@ -0,0 +1,5 @@ +TEST_PROJ_NAME:MyProject + +TEMPL_DOTNET_NAME:asp-awesome-main +TEMPL_NAME:Asp.AwesomeTemplates.Main +TEMPL_NAME_VER:Asp.AwesomeTemplates.Main.0.2.2.nupkg \ No newline at end of file diff --git a/.gitignore b/.gitignore index 46347ff..301a1e1 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ MainTemplate/.vs MainTemplate/nupkg Level X/.vs Level X/nupkg +.env.prod diff --git a/Level X/Asp.AwesomeTemplates.Main.Nuget.csproj b/Level X/Asp.AwesomeTemplates.Main.Nuget.csproj index ff40e84..e52c4c2 100644 --- a/Level X/Asp.AwesomeTemplates.Main.Nuget.csproj +++ b/Level X/Asp.AwesomeTemplates.Main.Nuget.csproj @@ -2,7 +2,7 @@ Template - 0.2.1 + 0.2.2 Asp.AwesomeTemplates.Main ASP.NET 6 awesome templates Ilya Klimenko (MadL1me) diff --git a/Taskfile.yaml b/Taskfile.yaml new file mode 100644 index 0000000..e952aa4 --- /dev/null +++ b/Taskfile.yaml @@ -0,0 +1,57 @@ +version: "3" + +env: + TEMPL_DIR: Level X + +dotenv: [".env"] + +tasks: + remove: + dir: '{{.TEMPL_DIR}}\nupkg\' + cmds: + - pwd + - dotnet new --uninstall $TEMPL_NAME + - rm -rf * + ignore_error: true + + create: + dir: "{{.TEMPL_DIR}}" + cmds: + - dotnet pack + ignore_error: true + + install: + dir: '{{.TEMPL_DIR}}\nupkg\' + cmds: + - dotnet new --install $TEMPL_NAME_VER + silent: false + + new: + dir: '{{.TEMPL_DIR}}\nupkg\' + cmds: + - dotnet new $TEMPL_DOTNET_NAME -o $TEST_PROJ_NAME + + run-dotnet: + dir: '{{.TEMPL_DIR}}\nupkg\{{.TEST_PROJ_NAME}}' + cmds: + - dotnet run + + run: + dir: '{{.TEMPL_DIR}}\nupkg\{{.TEST_PROJ_NAME}}' + cmds: + - docker compose up + + all: + cmds: + - task: remove + - task: create + - task: install + - task: new + + list: + cmds: + - dotnet new -l + + deploy: + cmds: + - echo "Hello from $NUGET_APIKEY" From 567bbe1471a6fece15e29340fbf442bd3fe21735 Mon Sep 17 00:00:00 2001 From: Ilya Klimenko Date: Wed, 23 Nov 2022 15:39:16 +0300 Subject: [PATCH 2/3] Renamed package and template vars name --- .env | 6 ++--- .gitignore | 1 + .../Asp.AwesomeTemplates.Spa.csproj | 6 ++--- .../Template/.template.config/template.json | 20 +++++---------- .../Template/_AWESOME_SPA_}/.dockerignore | 0 .../Controllers/ExampleController.cs | 2 +- .../Data/_AWESOME_SPA_DbContext.cs | 2 +- .../Template/_AWESOME_SPA_/Dockerfile | 20 +++++++++++++++ .../Template/_AWESOME_SPA_}/Program.cs | 4 +-- .../Properties/launchSettings.json | 2 +- .../Template/_AWESOME_SPA_}/README.md | 24 +++++++++++------- .../_AWESOME_SPA_/_AWESOME_SPA_.csproj | 0 .../appsettings.Development.json | 0 .../Template/_AWESOME_SPA_}/appsettings.json | 0 .../_AWESOME_SPA_}/docker-compose.yaml | 9 ++----- .../Template/react-ui/.env.development | 0 .../Template/react-ui/.env.production | 0 .../Template/react-ui/.gitignore | 0 .../Template/react-ui/Dockerfile | 0 .../Template/react-ui/README.md | 0 .../Template/react-ui/package.json | 0 .../Template/react-ui/public/favicon.ico | Bin .../Template/react-ui/public/index.html | 0 .../Template/react-ui/public/logo192.png | Bin .../Template/react-ui/public/logo512.png | Bin .../Template/react-ui/public/manifest.json | 0 .../Template/react-ui/public/robots.txt | 0 .../react-ui/src/components/App/App.css | 0 .../react-ui/src/components/App/App.test.tsx | 0 .../react-ui/src/components/App/App.tsx | 0 .../Template/react-ui/src/index.css | 0 .../Template/react-ui/src/index.tsx | 0 .../react-ui/src/resources/TupTup.png | Bin .../Template/react-ui/src/resources/logo.svg | 0 .../react-ui/src/utils/react-app-env.d.ts | 0 .../react-ui/src/utils/reportWebVitals.ts | 0 .../Template/react-ui/src/utils/setupTests.ts | 0 .../Template/react-ui/tsconfig.json | 0 .../Template/react-ui/yarn.lock | 0 Level X/Template/Dockerfile | 20 --------------- Taskfile.yaml | 4 +-- 41 files changed, 58 insertions(+), 62 deletions(-) rename Level X/Asp.AwesomeTemplates.Main.Nuget.csproj => Asp.AwesomeTemplates.Spa/Asp.AwesomeTemplates.Spa.csproj (87%) rename {Level X => Asp.AwesomeTemplates.Spa}/Template/.template.config/template.json (83%) rename {Level X/Template => Asp.AwesomeTemplates.Spa/Template/_AWESOME_SPA_}/.dockerignore (100%) rename {Level X/Template => Asp.AwesomeTemplates.Spa/Template/_AWESOME_SPA_}/Controllers/ExampleController.cs (97%) rename Level X/Template/Data/Asp.AwesomeTemplateDbContext.cs => Asp.AwesomeTemplates.Spa/Template/_AWESOME_SPA_/Data/_AWESOME_SPA_DbContext.cs (90%) create mode 100644 Asp.AwesomeTemplates.Spa/Template/_AWESOME_SPA_/Dockerfile rename {Level X/Template => Asp.AwesomeTemplates.Spa/Template/_AWESOME_SPA_}/Program.cs (88%) rename {Level X/Template => Asp.AwesomeTemplates.Spa/Template/_AWESOME_SPA_}/Properties/launchSettings.json (96%) rename {Level X/Template => Asp.AwesomeTemplates.Spa/Template/_AWESOME_SPA_}/README.md (75%) rename Level X/Template/Asp.AwesomeTemplate.csproj => Asp.AwesomeTemplates.Spa/Template/_AWESOME_SPA_/_AWESOME_SPA_.csproj (100%) rename {Level X/Template => Asp.AwesomeTemplates.Spa/Template/_AWESOME_SPA_}/appsettings.Development.json (100%) rename {Level X/Template => Asp.AwesomeTemplates.Spa/Template/_AWESOME_SPA_}/appsettings.json (100%) rename {Level X/Template => Asp.AwesomeTemplates.Spa/Template/_AWESOME_SPA_}/docker-compose.yaml (85%) rename {Level X => Asp.AwesomeTemplates.Spa}/Template/react-ui/.env.development (100%) rename {Level X => Asp.AwesomeTemplates.Spa}/Template/react-ui/.env.production (100%) rename {Level X => Asp.AwesomeTemplates.Spa}/Template/react-ui/.gitignore (100%) rename {Level X => Asp.AwesomeTemplates.Spa}/Template/react-ui/Dockerfile (100%) rename {Level X => Asp.AwesomeTemplates.Spa}/Template/react-ui/README.md (100%) rename {Level X => Asp.AwesomeTemplates.Spa}/Template/react-ui/package.json (100%) rename {Level X => Asp.AwesomeTemplates.Spa}/Template/react-ui/public/favicon.ico (100%) rename {Level X => Asp.AwesomeTemplates.Spa}/Template/react-ui/public/index.html (100%) rename {Level X => Asp.AwesomeTemplates.Spa}/Template/react-ui/public/logo192.png (100%) rename {Level X => Asp.AwesomeTemplates.Spa}/Template/react-ui/public/logo512.png (100%) rename {Level X => Asp.AwesomeTemplates.Spa}/Template/react-ui/public/manifest.json (100%) rename {Level X => Asp.AwesomeTemplates.Spa}/Template/react-ui/public/robots.txt (100%) rename {Level X => Asp.AwesomeTemplates.Spa}/Template/react-ui/src/components/App/App.css (100%) rename {Level X => Asp.AwesomeTemplates.Spa}/Template/react-ui/src/components/App/App.test.tsx (100%) rename {Level X => Asp.AwesomeTemplates.Spa}/Template/react-ui/src/components/App/App.tsx (100%) rename {Level X => Asp.AwesomeTemplates.Spa}/Template/react-ui/src/index.css (100%) rename {Level X => Asp.AwesomeTemplates.Spa}/Template/react-ui/src/index.tsx (100%) rename {Level X => Asp.AwesomeTemplates.Spa}/Template/react-ui/src/resources/TupTup.png (100%) rename {Level X => Asp.AwesomeTemplates.Spa}/Template/react-ui/src/resources/logo.svg (100%) rename {Level X => Asp.AwesomeTemplates.Spa}/Template/react-ui/src/utils/react-app-env.d.ts (100%) rename {Level X => Asp.AwesomeTemplates.Spa}/Template/react-ui/src/utils/reportWebVitals.ts (100%) rename {Level X => Asp.AwesomeTemplates.Spa}/Template/react-ui/src/utils/setupTests.ts (100%) rename {Level X => Asp.AwesomeTemplates.Spa}/Template/react-ui/tsconfig.json (100%) rename {Level X => Asp.AwesomeTemplates.Spa}/Template/react-ui/yarn.lock (100%) delete mode 100644 Level X/Template/Dockerfile diff --git a/.env b/.env index 8682181..7d2dd6b 100644 --- a/.env +++ b/.env @@ -1,5 +1,5 @@ TEST_PROJ_NAME:MyProject -TEMPL_DOTNET_NAME:asp-awesome-main -TEMPL_NAME:Asp.AwesomeTemplates.Main -TEMPL_NAME_VER:Asp.AwesomeTemplates.Main.0.2.2.nupkg \ No newline at end of file +TEMPL_DOTNET_NAME:asp-awesome-spa +TEMPL_NAME:Asp.AwesomeTemplates.Spa +TEMPL_NAME_VER:Asp.AwesomeTemplates.Spa.0.2.2.nupkg \ No newline at end of file diff --git a/.gitignore b/.gitignore index 301a1e1..1cfd8f4 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ MainTemplate/nupkg Level X/.vs Level X/nupkg .env.prod +Asp.AwesomeTemplates.Spa/nupkg diff --git a/Level X/Asp.AwesomeTemplates.Main.Nuget.csproj b/Asp.AwesomeTemplates.Spa/Asp.AwesomeTemplates.Spa.csproj similarity index 87% rename from Level X/Asp.AwesomeTemplates.Main.Nuget.csproj rename to Asp.AwesomeTemplates.Spa/Asp.AwesomeTemplates.Spa.csproj index e52c4c2..dc0e353 100644 --- a/Level X/Asp.AwesomeTemplates.Main.Nuget.csproj +++ b/Asp.AwesomeTemplates.Spa/Asp.AwesomeTemplates.Spa.csproj @@ -3,10 +3,10 @@ Template 0.2.2 - Asp.AwesomeTemplates.Main - ASP.NET 6 awesome templates + Asp.AwesomeTemplates.Spa + ASP.NET 6 awesome SPA template Ilya Klimenko (MadL1me) - ASP.NET 6 Easy-to-use, modern and awesome template + ASP.NET 6 Easy-to-use, modern and awesome template. Use dotnet-new;templates;aspnet;ez-template;webapp;aspnet-react;aspnet-vue net6.0 true diff --git a/Level X/Template/.template.config/template.json b/Asp.AwesomeTemplates.Spa/Template/.template.config/template.json similarity index 83% rename from Level X/Template/.template.config/template.json rename to Asp.AwesomeTemplates.Spa/Template/.template.config/template.json index b56a75f..c19280c 100644 --- a/Level X/Template/.template.config/template.json +++ b/Asp.AwesomeTemplates.Spa/Template/.template.config/template.json @@ -1,11 +1,11 @@ { "$schema": "http://json.schemastore.org/template", "author": "Ilya Klimenko (MadL1me)", - "classifications": [ "Webapp", "Asp net 6" ], - "identity": "Asp.AwesomeTemplates.Main.CSharp", + "classifications": ["Webapp", "Asp net 6"], + "identity": "Asp.AwesomeTemplates.Spa.CSharp", "name": "ASP.NET 6 Easy-to-use, modern and awesome template", - "shortName": "asp-awesome-main", - "sourceName": "Asp.AwesomeTemplate", + "shortName": "asp-awesome-spa", + "sourceName": "_AWESOME_SPA_", "tags": { "type": "project", "language": "C#" @@ -70,21 +70,15 @@ "modifiers": [ { "condition": "(!AddExampleController)", - "exclude": [ - "Controllers/ExampleController.cs" - ] + "exclude": ["_AWESOME_SPA_/Controllers/ExampleController.cs"] }, { "condition": "(!UseReact)", - "exclude": [ - "react-ui/**" - ] + "exclude": ["react-ui/**"] }, { "condition": "(!UsePostgreSql)", - "exclude": [ - "Data/Asp.AwesomeTemplateDbContext.cs" - ] + "exclude": ["_AWESOME_SPA_/Data/Asp.AwesomeTemplateDbContext.cs"] } ] } diff --git a/Level X/Template/.dockerignore b/Asp.AwesomeTemplates.Spa/Template/_AWESOME_SPA_/.dockerignore similarity index 100% rename from Level X/Template/.dockerignore rename to Asp.AwesomeTemplates.Spa/Template/_AWESOME_SPA_/.dockerignore diff --git a/Level X/Template/Controllers/ExampleController.cs b/Asp.AwesomeTemplates.Spa/Template/_AWESOME_SPA_/Controllers/ExampleController.cs similarity index 97% rename from Level X/Template/Controllers/ExampleController.cs rename to Asp.AwesomeTemplates.Spa/Template/_AWESOME_SPA_/Controllers/ExampleController.cs index 19a7427..ed7db80 100644 --- a/Level X/Template/Controllers/ExampleController.cs +++ b/Asp.AwesomeTemplates.Spa/Template/_AWESOME_SPA_/Controllers/ExampleController.cs @@ -1,6 +1,6 @@ using Microsoft.AspNetCore.Mvc; -namespace Asp.AwesomeTemplate.Controllers; +namespace _AWESOME_SPA_.Controllers; public record ExampleUserDto { diff --git a/Level X/Template/Data/Asp.AwesomeTemplateDbContext.cs b/Asp.AwesomeTemplates.Spa/Template/_AWESOME_SPA_/Data/_AWESOME_SPA_DbContext.cs similarity index 90% rename from Level X/Template/Data/Asp.AwesomeTemplateDbContext.cs rename to Asp.AwesomeTemplates.Spa/Template/_AWESOME_SPA_/Data/_AWESOME_SPA_DbContext.cs index 6ea6ea4..77da7fc 100644 --- a/Level X/Template/Data/Asp.AwesomeTemplateDbContext.cs +++ b/Asp.AwesomeTemplates.Spa/Template/_AWESOME_SPA_/Data/_AWESOME_SPA_DbContext.cs @@ -1,6 +1,6 @@ using Microsoft.EntityFrameworkCore; -namespace Asp.AwesomeTemplate.Data; +namespace _AWESOME_SPA_.Data; public sealed class Asp.AwesomeTemplateDbContext : DbContext { diff --git a/Asp.AwesomeTemplates.Spa/Template/_AWESOME_SPA_/Dockerfile b/Asp.AwesomeTemplates.Spa/Template/_AWESOME_SPA_/Dockerfile new file mode 100644 index 0000000..3d0fb0f --- /dev/null +++ b/Asp.AwesomeTemplates.Spa/Template/_AWESOME_SPA_/Dockerfile @@ -0,0 +1,20 @@ +FROM mcr.microsoft.com/dotnet/aspnet:6.0-bullseye-slim AS base +WORKDIR /app +EXPOSE 80 +EXPOSE 443 + +FROM mcr.microsoft.com/dotnet/sdk:6.0-bullseye-slim AS build +WORKDIR /src +COPY ["_AWESOME_SPA_.csproj", "_AWESOME_SPA_/"] +RUN dotnet restore "_AWESOME_SPA_/_AWESOME_SPA_.csproj" +COPY . ./_AWESOME_SPA_ +WORKDIR "/src/_AWESOME_SPA_" +RUN dotnet build "_AWESOME_SPA_.csproj" -c Release -o /app/build + +FROM build AS publish +RUN dotnet publish "_AWESOME_SPA_.csproj" -c Release -o /app/publish + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "_AWESOME_SPA_.dll"] diff --git a/Level X/Template/Program.cs b/Asp.AwesomeTemplates.Spa/Template/_AWESOME_SPA_/Program.cs similarity index 88% rename from Level X/Template/Program.cs rename to Asp.AwesomeTemplates.Spa/Template/_AWESOME_SPA_/Program.cs index 2e9430a..2f26249 100644 --- a/Level X/Template/Program.cs +++ b/Asp.AwesomeTemplates.Spa/Template/_AWESOME_SPA_/Program.cs @@ -4,7 +4,7 @@ #endif #if (UsePostgreSql) using Microsoft.EntityFrameworkCore; -using Asp.AwesomeTemplate.Data; +using _AWESOME_SPA_.Data; #endif var builder = WebApplication.CreateBuilder(args); @@ -19,7 +19,7 @@ builder.Services.AddSwaggerGen(c => { - c.SwaggerDoc("v1", new OpenApiInfo { Title = "Asp.AwesomeTemplate API", Version = "v1" }); + c.SwaggerDoc("v1", new OpenApiInfo { Title = "_AWESOME_SPA_ API", Version = "v1" }); }); #endif diff --git a/Level X/Template/Properties/launchSettings.json b/Asp.AwesomeTemplates.Spa/Template/_AWESOME_SPA_/Properties/launchSettings.json similarity index 96% rename from Level X/Template/Properties/launchSettings.json rename to Asp.AwesomeTemplates.Spa/Template/_AWESOME_SPA_/Properties/launchSettings.json index 92df0e5..95a2770 100644 --- a/Level X/Template/Properties/launchSettings.json +++ b/Asp.AwesomeTemplates.Spa/Template/_AWESOME_SPA_/Properties/launchSettings.json @@ -9,7 +9,7 @@ } }, "profiles": { - "Asp.AwesomeTemplate": { + "_AWESOME_SPA_": { "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": true, diff --git a/Level X/Template/README.md b/Asp.AwesomeTemplates.Spa/Template/_AWESOME_SPA_/README.md similarity index 75% rename from Level X/Template/README.md rename to Asp.AwesomeTemplates.Spa/Template/_AWESOME_SPA_/README.md index d1abb08..031181c 100644 --- a/Level X/Template/README.md +++ b/Asp.AwesomeTemplates.Spa/Template/_AWESOME_SPA_/README.md @@ -1,19 +1,20 @@ -# Asp.AwesomeTemplate Project +# _AWESOME_SPA_ Project ## Develop -*** +--- ### First Run -At first, you need to create TLS certificate. You can make it with this command: + +At first, you need to create TLS certificate. You can make it with this command: ```sh -dotnet dev-certs https -ep ${HOME}/.aspnet/https/Asp.AwesomeTemplate.pfx -p PASSWORD -``` +dotnet dev-certs https -ep ${HOME}/.aspnet/https/_AWESOME_SPA_.pfx -p PASSWORD +``` > (You can change PASSWORD to your custom certificate password, but then you need also to change it in `docker-compose.yaml`. Because this certificate is development only, I think you can use default password) -Then, trust the certificate: +Then, trust the certificate: ```sh dotnet dev-certs https --trust @@ -21,19 +22,24 @@ Then, trust the certificate: Congrats, you setuped your dev certificates -*** +--- ### Run Now, you can simply run your app with one command in interactive mode: ```sh -docker compose up +docker compose up ``` + + Back-end Swagger docs: https://localhost:443/swagger + + Front-end React-app: http://localhost:3000 - \ No newline at end of file + + diff --git a/Level X/Template/Asp.AwesomeTemplate.csproj b/Asp.AwesomeTemplates.Spa/Template/_AWESOME_SPA_/_AWESOME_SPA_.csproj similarity index 100% rename from Level X/Template/Asp.AwesomeTemplate.csproj rename to Asp.AwesomeTemplates.Spa/Template/_AWESOME_SPA_/_AWESOME_SPA_.csproj diff --git a/Level X/Template/appsettings.Development.json b/Asp.AwesomeTemplates.Spa/Template/_AWESOME_SPA_/appsettings.Development.json similarity index 100% rename from Level X/Template/appsettings.Development.json rename to Asp.AwesomeTemplates.Spa/Template/_AWESOME_SPA_/appsettings.Development.json diff --git a/Level X/Template/appsettings.json b/Asp.AwesomeTemplates.Spa/Template/_AWESOME_SPA_/appsettings.json similarity index 100% rename from Level X/Template/appsettings.json rename to Asp.AwesomeTemplates.Spa/Template/_AWESOME_SPA_/appsettings.json diff --git a/Level X/Template/docker-compose.yaml b/Asp.AwesomeTemplates.Spa/Template/_AWESOME_SPA_/docker-compose.yaml similarity index 85% rename from Level X/Template/docker-compose.yaml rename to Asp.AwesomeTemplates.Spa/Template/_AWESOME_SPA_/docker-compose.yaml index e7391e7..31ae0c4 100644 --- a/Level X/Template/docker-compose.yaml +++ b/Asp.AwesomeTemplates.Spa/Template/_AWESOME_SPA_/docker-compose.yaml @@ -5,23 +5,21 @@ services: ports: - "8000:80" - "443:443" - container_name: "Asp.AwesomeTemplate" environment: - ASPNETCORE_ENVIRONMENT=Development - ASPNETCORE_URLS=https://+:443;http://+:80 # Development certificate for TLS - ASPNETCORE_Kestrel__Certificates__Default__Password=PASSWORD - - ASPNETCORE_Kestrel__Certificates__Default__Path=/https/Asp.AwesomeTemplate.pfx + - ASPNETCORE_Kestrel__Certificates__Default__Path=/https/_AWESOME_SPA_.pfx volumes: # Development certificate volume - ~/.aspnet/https:/https:ro //#if(UseReact) react-ui: build: - context: ./react-ui + context: ../react-ui ports: - "3000:3000" - container_name: react-ui stdin_open: true tty: true environment: @@ -36,7 +34,6 @@ services: //#endif //#if(UsePostgreSql) postgres: - container_name: postgres_container image: postgres environment: POSTGRES_USER: ${POSTGRES_USER:-postgres} @@ -51,7 +48,6 @@ services: restart: unless-stopped pgadmin: - container_name: pgadmin_container image: dpage/pgadmin4 environment: PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL:-pgadmin4@pgadmin.org} @@ -59,7 +55,6 @@ services: PGADMIN_CONFIG_SERVER_MODE: 'False' volumes: - pgadmin:/var/lib/pgadmin - ports: - "${PGADMIN_PORT:-5050}:80" networks: diff --git a/Level X/Template/react-ui/.env.development b/Asp.AwesomeTemplates.Spa/Template/react-ui/.env.development similarity index 100% rename from Level X/Template/react-ui/.env.development rename to Asp.AwesomeTemplates.Spa/Template/react-ui/.env.development diff --git a/Level X/Template/react-ui/.env.production b/Asp.AwesomeTemplates.Spa/Template/react-ui/.env.production similarity index 100% rename from Level X/Template/react-ui/.env.production rename to Asp.AwesomeTemplates.Spa/Template/react-ui/.env.production diff --git a/Level X/Template/react-ui/.gitignore b/Asp.AwesomeTemplates.Spa/Template/react-ui/.gitignore similarity index 100% rename from Level X/Template/react-ui/.gitignore rename to Asp.AwesomeTemplates.Spa/Template/react-ui/.gitignore diff --git a/Level X/Template/react-ui/Dockerfile b/Asp.AwesomeTemplates.Spa/Template/react-ui/Dockerfile similarity index 100% rename from Level X/Template/react-ui/Dockerfile rename to Asp.AwesomeTemplates.Spa/Template/react-ui/Dockerfile diff --git a/Level X/Template/react-ui/README.md b/Asp.AwesomeTemplates.Spa/Template/react-ui/README.md similarity index 100% rename from Level X/Template/react-ui/README.md rename to Asp.AwesomeTemplates.Spa/Template/react-ui/README.md diff --git a/Level X/Template/react-ui/package.json b/Asp.AwesomeTemplates.Spa/Template/react-ui/package.json similarity index 100% rename from Level X/Template/react-ui/package.json rename to Asp.AwesomeTemplates.Spa/Template/react-ui/package.json diff --git a/Level X/Template/react-ui/public/favicon.ico b/Asp.AwesomeTemplates.Spa/Template/react-ui/public/favicon.ico similarity index 100% rename from Level X/Template/react-ui/public/favicon.ico rename to Asp.AwesomeTemplates.Spa/Template/react-ui/public/favicon.ico diff --git a/Level X/Template/react-ui/public/index.html b/Asp.AwesomeTemplates.Spa/Template/react-ui/public/index.html similarity index 100% rename from Level X/Template/react-ui/public/index.html rename to Asp.AwesomeTemplates.Spa/Template/react-ui/public/index.html diff --git a/Level X/Template/react-ui/public/logo192.png b/Asp.AwesomeTemplates.Spa/Template/react-ui/public/logo192.png similarity index 100% rename from Level X/Template/react-ui/public/logo192.png rename to Asp.AwesomeTemplates.Spa/Template/react-ui/public/logo192.png diff --git a/Level X/Template/react-ui/public/logo512.png b/Asp.AwesomeTemplates.Spa/Template/react-ui/public/logo512.png similarity index 100% rename from Level X/Template/react-ui/public/logo512.png rename to Asp.AwesomeTemplates.Spa/Template/react-ui/public/logo512.png diff --git a/Level X/Template/react-ui/public/manifest.json b/Asp.AwesomeTemplates.Spa/Template/react-ui/public/manifest.json similarity index 100% rename from Level X/Template/react-ui/public/manifest.json rename to Asp.AwesomeTemplates.Spa/Template/react-ui/public/manifest.json diff --git a/Level X/Template/react-ui/public/robots.txt b/Asp.AwesomeTemplates.Spa/Template/react-ui/public/robots.txt similarity index 100% rename from Level X/Template/react-ui/public/robots.txt rename to Asp.AwesomeTemplates.Spa/Template/react-ui/public/robots.txt diff --git a/Level X/Template/react-ui/src/components/App/App.css b/Asp.AwesomeTemplates.Spa/Template/react-ui/src/components/App/App.css similarity index 100% rename from Level X/Template/react-ui/src/components/App/App.css rename to Asp.AwesomeTemplates.Spa/Template/react-ui/src/components/App/App.css diff --git a/Level X/Template/react-ui/src/components/App/App.test.tsx b/Asp.AwesomeTemplates.Spa/Template/react-ui/src/components/App/App.test.tsx similarity index 100% rename from Level X/Template/react-ui/src/components/App/App.test.tsx rename to Asp.AwesomeTemplates.Spa/Template/react-ui/src/components/App/App.test.tsx diff --git a/Level X/Template/react-ui/src/components/App/App.tsx b/Asp.AwesomeTemplates.Spa/Template/react-ui/src/components/App/App.tsx similarity index 100% rename from Level X/Template/react-ui/src/components/App/App.tsx rename to Asp.AwesomeTemplates.Spa/Template/react-ui/src/components/App/App.tsx diff --git a/Level X/Template/react-ui/src/index.css b/Asp.AwesomeTemplates.Spa/Template/react-ui/src/index.css similarity index 100% rename from Level X/Template/react-ui/src/index.css rename to Asp.AwesomeTemplates.Spa/Template/react-ui/src/index.css diff --git a/Level X/Template/react-ui/src/index.tsx b/Asp.AwesomeTemplates.Spa/Template/react-ui/src/index.tsx similarity index 100% rename from Level X/Template/react-ui/src/index.tsx rename to Asp.AwesomeTemplates.Spa/Template/react-ui/src/index.tsx diff --git a/Level X/Template/react-ui/src/resources/TupTup.png b/Asp.AwesomeTemplates.Spa/Template/react-ui/src/resources/TupTup.png similarity index 100% rename from Level X/Template/react-ui/src/resources/TupTup.png rename to Asp.AwesomeTemplates.Spa/Template/react-ui/src/resources/TupTup.png diff --git a/Level X/Template/react-ui/src/resources/logo.svg b/Asp.AwesomeTemplates.Spa/Template/react-ui/src/resources/logo.svg similarity index 100% rename from Level X/Template/react-ui/src/resources/logo.svg rename to Asp.AwesomeTemplates.Spa/Template/react-ui/src/resources/logo.svg diff --git a/Level X/Template/react-ui/src/utils/react-app-env.d.ts b/Asp.AwesomeTemplates.Spa/Template/react-ui/src/utils/react-app-env.d.ts similarity index 100% rename from Level X/Template/react-ui/src/utils/react-app-env.d.ts rename to Asp.AwesomeTemplates.Spa/Template/react-ui/src/utils/react-app-env.d.ts diff --git a/Level X/Template/react-ui/src/utils/reportWebVitals.ts b/Asp.AwesomeTemplates.Spa/Template/react-ui/src/utils/reportWebVitals.ts similarity index 100% rename from Level X/Template/react-ui/src/utils/reportWebVitals.ts rename to Asp.AwesomeTemplates.Spa/Template/react-ui/src/utils/reportWebVitals.ts diff --git a/Level X/Template/react-ui/src/utils/setupTests.ts b/Asp.AwesomeTemplates.Spa/Template/react-ui/src/utils/setupTests.ts similarity index 100% rename from Level X/Template/react-ui/src/utils/setupTests.ts rename to Asp.AwesomeTemplates.Spa/Template/react-ui/src/utils/setupTests.ts diff --git a/Level X/Template/react-ui/tsconfig.json b/Asp.AwesomeTemplates.Spa/Template/react-ui/tsconfig.json similarity index 100% rename from Level X/Template/react-ui/tsconfig.json rename to Asp.AwesomeTemplates.Spa/Template/react-ui/tsconfig.json diff --git a/Level X/Template/react-ui/yarn.lock b/Asp.AwesomeTemplates.Spa/Template/react-ui/yarn.lock similarity index 100% rename from Level X/Template/react-ui/yarn.lock rename to Asp.AwesomeTemplates.Spa/Template/react-ui/yarn.lock diff --git a/Level X/Template/Dockerfile b/Level X/Template/Dockerfile deleted file mode 100644 index beaa13f..0000000 --- a/Level X/Template/Dockerfile +++ /dev/null @@ -1,20 +0,0 @@ -FROM mcr.microsoft.com/dotnet/aspnet:6.0-bullseye-slim AS base -WORKDIR /app -EXPOSE 80 -EXPOSE 443 - -FROM mcr.microsoft.com/dotnet/sdk:6.0-bullseye-slim AS build -WORKDIR /src -COPY ["Asp.AwesomeTemplate.csproj", "Asp.AwesomeTemplate/"] -RUN dotnet restore "Asp.AwesomeTemplate/Asp.AwesomeTemplate.csproj" -COPY . ./Asp.AwesomeTemplate -WORKDIR "/src/Asp.AwesomeTemplate" -RUN dotnet build "Asp.AwesomeTemplate.csproj" -c Release -o /app/build - -FROM build AS publish -RUN dotnet publish "Asp.AwesomeTemplate.csproj" -c Release -o /app/publish - -FROM base AS final -WORKDIR /app -COPY --from=publish /app/publish . -ENTRYPOINT ["dotnet", "Asp.AwesomeTemplate.dll"] diff --git a/Taskfile.yaml b/Taskfile.yaml index e952aa4..1c484c8 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -1,7 +1,7 @@ version: "3" env: - TEMPL_DIR: Level X + TEMPL_DIR: Asp.AwesomeTemplates.Spa dotenv: [".env"] @@ -37,7 +37,7 @@ tasks: - dotnet run run: - dir: '{{.TEMPL_DIR}}\nupkg\{{.TEST_PROJ_NAME}}' + dir: '{{.TEMPL_DIR}}\nupkg\{{.TEST_PROJ_NAME}}\{{.TEST_PROJ_NAME}}' cmds: - docker compose up From 07b9033772c77033b17a4c361c7c4ca62cb7bfe2 Mon Sep 17 00:00:00 2001 From: Ilya Klimenko Date: Wed, 23 Nov 2022 15:58:03 +0300 Subject: [PATCH 3/3] Renamed cli params --- .env | 2 +- .../Asp.AwesomeTemplates.Spa.csproj | 2 +- .../.template.config/dotnetcli.host.json | 21 +++++++++++++++++++ .../Template/.template.config/template.json | 9 ++++---- Taskfile.yaml | 11 +++++++--- 5 files changed, 36 insertions(+), 9 deletions(-) create mode 100644 Asp.AwesomeTemplates.Spa/Template/.template.config/dotnetcli.host.json diff --git a/.env b/.env index 7d2dd6b..d4cf4b2 100644 --- a/.env +++ b/.env @@ -2,4 +2,4 @@ TEST_PROJ_NAME:MyProject TEMPL_DOTNET_NAME:asp-awesome-spa TEMPL_NAME:Asp.AwesomeTemplates.Spa -TEMPL_NAME_VER:Asp.AwesomeTemplates.Spa.0.2.2.nupkg \ No newline at end of file +NUGET_FILE:Asp.AwesomeTemplates.Spa.0.2.2.nupkg \ No newline at end of file diff --git a/Asp.AwesomeTemplates.Spa/Asp.AwesomeTemplates.Spa.csproj b/Asp.AwesomeTemplates.Spa/Asp.AwesomeTemplates.Spa.csproj index dc0e353..ec55de2 100644 --- a/Asp.AwesomeTemplates.Spa/Asp.AwesomeTemplates.Spa.csproj +++ b/Asp.AwesomeTemplates.Spa/Asp.AwesomeTemplates.Spa.csproj @@ -6,7 +6,7 @@ Asp.AwesomeTemplates.Spa ASP.NET 6 awesome SPA template Ilya Klimenko (MadL1me) - ASP.NET 6 Easy-to-use, modern and awesome template. Use + ASP.NET 6 Easy-to-use, modern and awesome template. dotnet-new;templates;aspnet;ez-template;webapp;aspnet-react;aspnet-vue net6.0 true diff --git a/Asp.AwesomeTemplates.Spa/Template/.template.config/dotnetcli.host.json b/Asp.AwesomeTemplates.Spa/Template/.template.config/dotnetcli.host.json new file mode 100644 index 0000000..d8b3857 --- /dev/null +++ b/Asp.AwesomeTemplates.Spa/Template/.template.config/dotnetcli.host.json @@ -0,0 +1,21 @@ +{ + "$schema": "http://json.schemastore.org/dotnetcli.host", + "symbolInfo": { + "EnableSwaggerSupport": { + "longName": "swagger", + "shortName": "sw" + }, + "UseEfDatabase": { + "longName": "database", + "shortName": "db" + }, + "UseSpaFrontendFramework": { + "longName": "frontend", + "shortName": "f" + }, + "AddExampleController": { + "longName": "with-examples", + "shortName": "e" + } + } +} diff --git a/Asp.AwesomeTemplates.Spa/Template/.template.config/template.json b/Asp.AwesomeTemplates.Spa/Template/.template.config/template.json index c19280c..d20e534 100644 --- a/Asp.AwesomeTemplates.Spa/Template/.template.config/template.json +++ b/Asp.AwesomeTemplates.Spa/Template/.template.config/template.json @@ -20,18 +20,19 @@ }, "EnableSwaggerSupport": { "type": "parameter", + "displayName": "swagger", "descriptions": "Enables swagger support", "datatype": "bool", "defaultValue": "true" }, "UseSpaFrontendFramework": { "type": "parameter", - "descriptions": "Adds selected SPA framework (React/Vue)", + "descriptions": "Adds selected SPA framework (React)", "datatype": "choice", - "defaultValue": "None", + "defaultValue": "ReactCra", "choices": [ { - "choice": "React", + "choice": "ReactCra", "description": "Use React.Ts created with create-react-app and configured to be better" }, { @@ -62,7 +63,7 @@ }, "UseReact": { "type": "computed", - "value": "(UseSpaFrontendFramework == \"React\")" + "value": "(UseSpaFrontendFramework == \"ReactCra\")" } }, "sources": [ diff --git a/Taskfile.yaml b/Taskfile.yaml index 1c484c8..53147d5 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -3,7 +3,7 @@ version: "3" env: TEMPL_DIR: Asp.AwesomeTemplates.Spa -dotenv: [".env"] +dotenv: [".env.prod"] tasks: remove: @@ -23,7 +23,7 @@ tasks: install: dir: '{{.TEMPL_DIR}}\nupkg\' cmds: - - dotnet new --install $TEMPL_NAME_VER + - dotnet new --install $NUGET_FILE silent: false new: @@ -52,6 +52,11 @@ tasks: cmds: - dotnet new -l + info: + cmds: + - dotnet new $TEMPL_DOTNET_NAME -h + deploy: + dir: '{{.TEMPL_DIR}}\nupkg' cmds: - - echo "Hello from $NUGET_APIKEY" + - dotnet nuget push $NUGET_FILE --api-key $NUGET_APIKEY --source https://api.nuget.org/v3/index.json