Skip to content

Commit

Permalink
refactor: ♻️ upgrade to .net 8 and packages upgrade (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
mehdihadeli authored Jul 27, 2024
1 parent c0dea3e commit c4a4456
Show file tree
Hide file tree
Showing 30 changed files with 298 additions and 285 deletions.
7 changes: 7 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@
"dotnet-outdated"
],
"rollForward": false
},
"nbgv": {
"version": "3.6.139",
"commands": [
"nbgv"
],
"rollForward": false
}
}
}
80 changes: 38 additions & 42 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
"ghcr.io/devcontainers/features/dotnet:2": {
// this version should be matched with global.json .net version for working vscode IntelliSense correctly
"version": "8.0.303",
"additionalVersions": "latest, 7.0.410, 8.0.303, 6.0.424",
"aspNetCoreRuntimeVersions": "latest, 7.0"
"additionalVersions": "latest, 8.0.303",
"aspNetCoreRuntimeVersions": "latest"
},
// https://github.com/devcontainers/features/tree/main/src/github-cli
"ghcr.io/devcontainers/features/github-cli:1": {
Expand All @@ -36,15 +36,6 @@
},
// https://github.com/devcontainers/features/tree/main/src/node
"ghcr.io/devcontainers/features/node:1": {},
// // https://github.com/devcontainers/features/tree/main/src/kubectl-helm-minikube
// "ghcr.io/devcontainers/features/kubectl-helm-minikube:1": {},
// // https://github.com/devcontainers/features/tree/main/src/terraform
// "ghcr.io/devcontainers/features/terraform:1": {},
// https://github.com/devcontainers/features/tree/main/src/docker-in-docker
// https://devopscube.com/run-docker-in-docker/
"ghcr.io/devcontainers/features/docker-in-docker:2": {
"dockerDashComposeVersion": "v2"
},
"ghcr.io/devcontainers/features/git:1": {},
// https://github.com/devcontainers/features/tree/main/src/common-utils
"ghcr.io/devcontainers/features/common-utils:2": {
Expand All @@ -56,33 +47,37 @@
// Configure properties specific to VS Code.
"vscode": {
"settings": {
"git.autofetch": true,
"files.autoSave": "onFocusChange",
"editor.formatOnSave": true,
"editor.suggest.snippetsPreventQuickSuggestions": false,
"explorer.autoReveal": true,
"resmon.show.cpufreq": false,
"dotnet.defaultSolution": "food-delivery.sln",
"dotnet.server.startTimeout": 60000,
"omnisharp.projectLoadTimeout": 60,
"workbench.colorTheme": "Visual Studio Light",
"workbench.iconTheme": "material-icon-theme",
"editor.minimap.enabled": false,
"editor.fontFamily": "'MesloLGM Nerd Font', 'Droid Sans Mono', 'monospace', 'Droid Sans Fallback', 'Consolas'",
"editor.fontSize": 14,
"explorer.confirmDelete": false,
"terminal.integrated.defaultProfile.windows": "PowerShell",
"terminal.integrated.defaultProfile.linux": "zsh",
"powershell.cwd": "~",
"terminal.external.windowsExec": "%LOCALAPPDATA%\\Microsoft\\WindowsApps\\pwsh.exe",
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"editor.smoothScrolling": true,
"editor.wordWrap": "on",
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.guides.bracketPairs": true,
"explorer.experimental.fileNesting.enabled": true
"git.autofetch": true,
"files.autoSave": "onFocusChange",
"editor.formatOnSave": true,
"editor.suggest.snippetsPreventQuickSuggestions": false,
"explorer.autoReveal": true,
"resmon.show.cpufreq": false,
"dotnet.defaultSolution": "Vertical.Slice.Template.sln",
"dotnet.server.startTimeout": 60000,
"omnisharp.projectLoadTimeout": 60,
"workbench.colorTheme": "Visual Studio Light",
"workbench.iconTheme": "material-icon-theme",
"editor.minimap.enabled": false,
"editor.fontFamily": "'MesloLGM Nerd Font', 'Droid Sans Mono', 'monospace', 'Droid Sans Fallback', 'Consolas'",
"editor.fontSize": 14,
"explorer.confirmDelete": false,
"terminal.integrated.defaultProfile.windows": "PowerShell",
"terminal.integrated.defaultProfile.linux": "zsh",
"powershell.cwd": "~",
"terminal.external.windowsExec": "%LOCALAPPDATA%\\Microsoft\\WindowsApps\\pwsh.exe",
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"editor.smoothScrolling": true,
"editor.wordWrap": "on",
"editor.guides.bracketPairs": true,
"explorer.experimental.fileNesting.enabled": true,
"[csharp]": {
"editor.defaultFormatter": "csharpier.csharpier-vscode",
"editor.formatOnSave": true
}
},
"extensions": [
"streetsidesoftware.code-spell-checker",
Expand All @@ -98,16 +93,17 @@
"PKief.material-icon-theme",
"EditorConfig.EditorConfig",
"DavidAnson.vscode-markdownlint",
"IBM.output-colorizer", // Colorize your output/test logs
"IBM.output-colorizer", // Colorize your output/test logs
"emmanuelbeziat.vscode-great-icons",
"esbenp.prettier-vscode",
"vscode-icons-team.vscode-icons",
"esbenp.prettier-vscode",
"csharpier.csharpier-vscode",
"vscode-icons-team.vscode-icons",
"redhat.vscode-yaml"
]
}
},
"hostRequirements": {
"cpus": 2,
"cpus": 4,
"memory": "8gb",
"storage": "32gb"
},
Expand Down
Empty file modified .devcontainer/scripts/post-create.sh
100644 → 100755
Empty file.
Empty file modified .devcontainer/scripts/update.sh
100644 → 100755
Empty file.
6 changes: 0 additions & 6 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@ on:
push:
branches:
- "main"
- "develop"
pull_request:
branches:
- "main"
- "develop"

env:
FEED_SOURCE: https://api.nuget.org/v3/index.json
Expand All @@ -29,7 +27,6 @@ jobs:
uses: actions/setup-dotnet@v3
with:
dotnet-version: "8.0.x"
dotnet-quality: "preview"

# https://github.com/joseftw/jos.enumeration/blob/main/.github/workflows/verify.yml
# https://github.com/dotnet/Nerdbank.GitVersioning
Expand Down Expand Up @@ -65,7 +62,6 @@ jobs:
uses: actions/setup-dotnet@v3
with:
dotnet-version: "8.0.x"
dotnet-quality: "preview"

- name: Cache NuGet Packages
uses: actions/cache@v3
Expand All @@ -84,7 +80,6 @@ jobs:
- name: Build Version ${{ steps.nbgv.outputs.nugetpackageversion }}
run: dotnet build Vertical.Slice.Template.sln -c Release --no-restore /p:Version=${{ steps.nbgv.outputs.AssemblyVersion }}


# https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-pack
- name: Pack NuGet Package Version ${{ steps.nbgv.outputs.nugetpackageversion }}
run: dotnet pack Vertical.Slice.Template.sln --no-build --no-restore -c Release --output ${{ env.NuGetDirectory }}
Expand Down Expand Up @@ -143,7 +138,6 @@ jobs:
uses: actions/setup-dotnet@v3
with:
dotnet-version: "8.0.x"
dotnet-quality: "preview"

# https://github.com/joseftw/jos.enumeration/blob/main/.github/workflows/verify.yml
# https://github.com/dotnet/Nerdbank.GitVersioning
Expand Down
10 changes: 5 additions & 5 deletions .template.config/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@
"datatype": "choice",
"enableQuotelessLiterals": true,
"choices": [
{
"choice": "net6.0",
"description": "Target net6.0"
},
{
"choice": "net7.0",
"description": "Target net7.0"
},
{
"choice": "net8.0",
"description": "Target net8.0"
}
],
"replaces": "{TargetFramework}",
"defaultValue": "net7.0"
"defaultValue": "net8.0"
},
"EnableSwagger": {
"type": "parameter",
Expand Down
33 changes: 33 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"git.autofetch": true,
"files.autoSave": "onFocusChange",
"editor.formatOnSave": true,
"editor.suggest.snippetsPreventQuickSuggestions": false,
"explorer.autoReveal": true,
"resmon.show.cpufreq": false,
"dotnet.defaultSolution": "Vertical.Slice.Template.sln",
"dotnet.server.startTimeout": 60000,
"omnisharp.projectLoadTimeout": 60,
"workbench.colorTheme": "Visual Studio Light",
"workbench.iconTheme": "material-icon-theme",
"editor.minimap.enabled": false,
"editor.fontFamily": "'MesloLGM Nerd Font', 'Droid Sans Mono', 'monospace', 'Droid Sans Fallback', 'Consolas'",
"editor.fontSize": 14,
"explorer.confirmDelete": false,
"terminal.integrated.defaultProfile.windows": "PowerShell",
"terminal.integrated.defaultProfile.linux": "zsh",
"powershell.cwd": "~",
"terminal.external.windowsExec": "%LOCALAPPDATA%\\Microsoft\\WindowsApps\\pwsh.exe",
"editor.defaultFormatter": "esbenp.prettier-vscode",
"explorer.experimental.fileNesting.enabled": true,
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"editor.smoothScrolling": true,
"editor.wordWrap": "on",
"editor.guides.bracketPairs": true,
"[csharp]": {
"editor.defaultFormatter": "ms-dotnettools.csharp",
"editor.formatOnSave": true
}
}
Binary file removed nbgv.exe
Binary file not shown.
2 changes: 2 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
[![CI-CD](https://img.shields.io/github/actions/workflow/status/mehdihadeli/vertical-slice-api-template/ci-cd.yml?label=Build%20Pipeline%20&logo=github&style=for-the-badge)](https://github.com/mehdihadeli/vertical-slice-api-template/actions/workflows/ci-cd.yml)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?logoColor=white&style=for-the-badge)](http://commitizen.github.io/cz-cli/)

[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/mehdihadeli/vertical-slice-api-template)

> This is a An Asp.Net Core `template` based on `Vertical Slice Architecture`, CQRS, Minimal APIs, API Versioning and Swagger. Create a new project based on this template by clicking the above **Use this template** button or by installing and running the associated NuGet package (see Getting Started for full details).
## Getting Started & Prerequisites
Expand Down
18 changes: 8 additions & 10 deletions src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Http" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Http.Polly" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Http.Polly" Version="8.0.7" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Options" Version="8.0.2" />
Expand All @@ -57,7 +57,7 @@
<PackageVersion Include="Open.ChannelExtensions" Version="8.4.3" />
<PackageVersion Include="Serilog.Exceptions.EntityFrameworkCore" Version="8.4.0" />
<PackageVersion Include="Serilog.Sinks.Grafana.Loki" Version="8.3.0" />
<PackageVersion Include="Serilog.Sinks.OpenTelemetry" Version="4.0.0-dev-00317" />
<PackageVersion Include="Serilog.Sinks.OpenTelemetry" Version="4.0.0-dev-00325" />
<PackageVersion Include="System.Threading.RateLimiting" Version="8.0.0" />
<PackageVersion Include="System.Net.Http.Json" Version="8.0.0" />
</ItemGroup>
Expand Down Expand Up @@ -87,7 +87,7 @@
<PackageVersion Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.4" />
</ItemGroup>
<ItemGroup>
<PackageVersion Include="Serilog" Version="4.0.0" />
<PackageVersion Include="Serilog" Version="4.0.1" />
<PackageVersion Include="Serilog.AspNetCore" Version="8.0.1" />
<PackageVersion Include="Serilog.Enrichers.CorrelationId" Version="3.0.1" />
<PackageVersion Include="Serilog.Enrichers.Environment" Version="3.0.1" />
Expand Down Expand Up @@ -126,7 +126,7 @@
</ItemGroup>
<ItemGroup>
<PackageVersion Include="AsyncFixer" Version="1.6.0" />
<PackageVersion Include="Meziantou.Analyzer" Version="2.0.161" />
<PackageVersion Include="Meziantou.Analyzer" Version="2.0.162" />
<PackageVersion Include="Roslynator.Analyzers" Version="4.12.4" />
<PackageVersion Include="Roslynator.CodeAnalysis.Analyzers" Version="4.12.4" />
<PackageVersion Include="Roslynator.Formatting.Analyzers" Version="4.12.4" />
Expand All @@ -149,10 +149,8 @@
<PackageVersion Include="Microsoft.AspNetCore.OpenApi" Version="8.0.7" />
</ItemGroup>
<ItemGroup>
<PackageVersion Include="AutoMapper" Version="12.0.1" />
<PackageVersion Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" />
<PackageVersion Include="MediatR" Version="11.0.0" />
<PackageVersion Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="11.1.0" />
<PackageVersion Include="AutoMapper" Version="13.0.1" />
<PackageVersion Include="MediatR" Version="12.4.0" />
</ItemGroup>
<ItemGroup>
<PackageVersion Include="Bogus" Version="35.5.1" />
Expand Down Expand Up @@ -188,8 +186,8 @@
<PackageVersion Include="Sieve" Version="2.5.5" />
<PackageVersion Include="System.Linq.Async" Version="6.0.1" />
<PackageVersion Include="System.Linq.Async.Queryable" Version="6.0.1" />
<PackageVersion Include="NSwag.ApiDescription.Client" Version="14.0.8" />
<PackageVersion Include="NSwag.MSBuild" Version="14.0.8" />
<PackageVersion Include="NSwag.ApiDescription.Client" Version="14.1.0" />
<PackageVersion Include="NSwag.MSBuild" Version="14.1.0" />
<PackageVersion Include="CorrelationId" Version="3.0.1" />
<PackageVersion Include="LinqKit.Core" Version="1.2.5" />
<PackageVersion Include="MassTransit.Abstractions" Version="8.2.3" />
Expand Down
4 changes: 2 additions & 2 deletions src/Vertical.Slice.Template.Api/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
using Vertical.Slice.Template.Shared.Web.Minimal.Extensions;

// https://github.com/serilog/serilog-aspnetcore#two-stage-initialization
Log.Logger = new LoggerConfiguration().MinimumLevel
.Override("Microsoft", LogEventLevel.Information)
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Override("Microsoft", LogEventLevel.Information)
.WriteTo.Console()
.CreateBootstrapLogger();

Expand Down
2 changes: 1 addition & 1 deletion src/Vertical.Slice.Template.Shared/Core/Domain/EntityId.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ public static implicit operator long(EntityId id)
return id.Value;
}

public new static EntityId CreateEntityId(long id) => new() { Value = id };
public static new EntityId CreateEntityId(long id) => new() { Value = id };
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@ IList<Assembly> assembliesToScan
{
var dbExecutors = assembliesToScan
.SelectMany(x => x.GetLoadableTypes())
.Where(
t =>
t!.IsClass
&& !t.IsAbstract
&& !t.IsGenericType
&& !t.IsInterface
&& t.GetConstructor(Type.EmptyTypes) != null
&& typeof(IDbExecutors).IsAssignableFrom(t)
.Where(t =>
t!.IsClass
&& !t.IsAbstract
&& !t.IsGenericType
&& !t.IsInterface
&& t.GetConstructor(Type.EmptyTypes) != null
&& typeof(IDbExecutors).IsAssignableFrom(t)
)
.ToList();

Expand Down
Loading

0 comments on commit c4a4456

Please sign in to comment.