Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
matrix:
template:
- working-dir: modulith
project: TestModulith.sln
project: TestModulith.slnx

name: 'Build project source: ${{ matrix.template.working-dir }}'
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion qodana.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ profile:
name: qodana.starter

dotnet:
solution: working/content/modulith/TestModulith.sln
solution: working/content/modulith/TestModulith.slnx
#Enable inspections
#include:
# - name: <SomeEnabledInspectionId>
Expand Down
4 changes: 2 additions & 2 deletions working/content/modulith/.template.config/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
}
],
"defaultValue": "solution",
"description": "The type of authentication to use"
"description": "The type of template to create"
},
"IsSolution": {
"type": "computed",
Expand Down Expand Up @@ -111,7 +111,7 @@
".gitignore",
"Directory.Build.props",
"Directory.Packages.props",
"Modulith.sln",
"Modulith.slnx",
"Shared/**/*"
],
"modifiers": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ namespace Modulith.DddModule.Tests;

public class DddModuleFixture : AppFixture<Program>
{
protected override async Task SetupAsync()
protected override async ValueTask SetupAsync()
{
Client = CreateClient();

await base.SetupAsync();
}

protected override async Task TearDownAsync()
protected override async ValueTask TearDownAsync()
{
Client.Dispose();
await base.TearDownAsync();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using ArchUnitNET.Domain;
using ArchUnitNET.Loader;
using ArchUnitNET.xUnit;
using ArchUnitNET.xUnitV3;
using static ArchUnitNET.Fluent.ArchRuleDefinition;

namespace Modulith.DddModule.Tests;
Expand All @@ -17,7 +17,7 @@ public void BeInternal()
{
var domainTypes = Types()
.That()
.ResideInNamespace("Modulith.DddModule.*", true)
.ResideInNamespaceMatching("Modulith.DddModule.*")
.And()
.AreNot([typeof(AssemblyInfo), typeof(DddModuleServiceRegistrar)])
.As("Module types");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using ArchUnitNET.Domain;
using ArchUnitNET.Fluent;
using ArchUnitNET.Loader;
using ArchUnitNET.xUnit;
using ArchUnitNET.xUnitV3;

namespace Modulith.DddModule.Tests;

Expand All @@ -17,14 +17,14 @@ public void NotDependOnApiTypes()
{
var domainTypes = ArchRuleDefinition.Types()
.That()
.ResideInNamespace("Modulith.DddModule.Domain.*", true)
.ResideInNamespaceMatching("Modulith.DddModule.Domain.*")
.And()
.AreNot([typeof(AssemblyInfo), typeof(DddModuleServiceRegistrar)])
.As("Domain types");

var apiTypes = ArchRuleDefinition.Types()
.That()
.ResideInNamespace("Modulith.DddModule.Api.*", true)
.ResideInNamespaceMatching("Modulith.DddModule.Api.*")
.As("Api types");

var rule = domainTypes.Should().NotDependOnAny(apiTypes);
Expand All @@ -37,14 +37,14 @@ public void NotDependOnInfraTypes()
{
var domainTypes = ArchRuleDefinition.Types()
.That()
.ResideInNamespace("Modulith.DddModule.Domain.*", true)
.ResideInNamespaceMatching("Modulith.DddModule.Domain.*")
.And()
.AreNot([typeof(AssemblyInfo), typeof(DddModuleServiceRegistrar)])
.As("Domain types");

var apiTypes = ArchRuleDefinition.Types()
.That()
.ResideInNamespace("Modulith.DddModule.Infrastructure.*", true)
.ResideInNamespaceMatching("Modulith.DddModule.Infrastructure.*")
.As("Api types");

var rule = domainTypes.Should().NotDependOnAny(apiTypes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
<ItemGroup>
<PackageReference Include="coverlet.collector"/>
<PackageReference Include="FastEndpoints.Testing"/>
<PackageReference Include="FluentAssertions"/>
<PackageReference Include="AwesomeAssertions"/>
<PackageReference Include="Microsoft.NET.Test.Sdk"/>
<PackageReference Include="xunit"/>
<PackageReference Include="xunit.v3"/>
<PackageReference Include="xunit.runner.visualstudio"/>
<PackageReference Include="tngtech.archunitnet.xunit"/>
<PackageReference Include="TngTech.ArchUnitNET.xUnitV3"/>
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using FastEndpoints;
using FastEndpoints.Testing;
using FluentAssertions;
using AwesomeAssertions;
using Modulith.DddModule.Api;

namespace Modulith.DddModule.Tests;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ public override async Task HandleAsync(CancellationToken ct)
"Warm", "Balmy", "Hot", "Sweltering", "Scorching"
];

var forecasts = weatherForecastService.GetWeatherForecast(summaries);

await SendOkAsync(forecasts, ct);
Response = weatherForecastService.GetWeatherForecast(summaries);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ public class DddModuleServiceRegistrar : IRegisterModuleServices
public static IServiceCollection ConfigureServices(IServiceCollection services, IConfiguration configuration)
{
var logger = GetLogger(services);
services.AddMediatR(
c => c.RegisterServicesFromAssemblies(typeof(AssemblyInfo).Assembly));

services.AddScoped<IWeatherForecastService, WeatherForecastService>();
services.AddScoped<ITemperatureService, FakeTemperatureService>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="MediatR"/>
<PackageReference Include="Mediator.Abstractions"/>
<PackageReference Include="FastEndpoints"/>
</ItemGroup>

Expand Down
67 changes: 31 additions & 36 deletions working/content/modulith/Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,37 +1,32 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>

<!-- Centralized Package Versions -->
<ItemGroup>
<!-- Web & API Packages -->
<PackageVersion Include="FastEndpoints" Version="5.30.0"/>
<PackageVersion Include="FastEndpoints.Security" Version="5.30.0"/>
<PackageVersion Include="FastEndpoints.Swagger" Version="5.30.0"/>
<PackageVersion Include="FastEndpoints.Testing" Version="5.30.0"/>
<PackageVersion Include="Microsoft.AspNetCore.OpenApi" Version="10.0.0-rc.2.25502.107"/>
<PackageVersion Include="Swashbuckle.AspNetCore" Version="7.2.0"/>

<!-- MediatR -->
<PackageVersion Include="MediatR" Version="12.4.1"/>

<!-- Blazor & UI Packages -->
<PackageVersion Include="Microsoft.AspNetCore.Components.Web" Version="10.0.0-rc.2.25502.107"/>
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly" Version="10.0.0-rc.2.25502.107"/>
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="10.0.0-rc.2.25502.107"/>
<PackageVersion Include="MudBlazor" Version="7.7.0"/>

<!-- Microsoft Extensions -->
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="10.0.0-rc.2.25502.107"/>
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.0-rc.2.25502.107"/>

<!-- Testing Packages -->
<PackageVersion Include="coverlet.collector" Version="6.0.2"/>
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.0"/>
<PackageVersion Include="xunit" Version="2.9.0"/>
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2"/>
<PackageVersion Include="tngtech.archunitnet.xunit" Version="0.11.0"/>
<PackageVersion Include="FluentAssertions" Version="6.12.1"/>
</ItemGroup>
</Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<!-- Centralized Package Versions -->
<ItemGroup>
<!-- Web & API Packages -->
<PackageVersion Include="FastEndpoints" Version="7.0.1" />
<PackageVersion Include="FastEndpoints.Security" Version="7.0.1" />
<PackageVersion Include="FastEndpoints.Swagger" Version="7.0.1" />
<PackageVersion Include="FastEndpoints.Testing" Version="7.0.1" />
<PackageVersion Include="Scalar.AspNetCore" Version="2.9.0" />
<!-- Mediator -->
<PackageVersion Include="Mediator.Abstractions" Version="3.0.1" />
<PackageVersion Include="Mediator.SourceGenerator" Version="3.0.1" />
<!-- Blazor & UI Packages -->
<PackageVersion Include="Microsoft.AspNetCore.Components.Web" Version="10.0.0-rc.2.25502.107" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly" Version="10.0.0-rc.2.25502.107" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="10.0.0-rc.2.25502.107" />
<PackageVersion Include="MudBlazor" Version="7.7.0" />
<!-- Microsoft Extensions -->
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="10.0.0-rc.2.25502.107" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.0-rc.2.25502.107" />
<!-- Testing Packages -->
<PackageVersion Include="coverlet.collector" Version="6.0.4" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.0" />
<PackageVersion Include="xunit.v3" Version="3.1.0" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.5" />
<PackageVersion Include="TngTech.ArchUnitNET.xUnitV3" Version="0.12.3" />
<PackageVersion Include="AwesomeAssertions" Version="9.2.1" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions working/content/modulith/Modulith.Web/Modulith.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
<ItemGroup>
<PackageReference Include="FastEndpoints.Security"/>
<PackageReference Include="FastEndpoints.Swagger"/>
<PackageReference Include="Microsoft.AspNetCore.OpenApi"/>
<PackageReference Include="Swashbuckle.AspNetCore"/>
<PackageReference Include="FastEndpoints"/>
<PackageReference Include="Mediator.Abstractions"/>
<PackageReference Include="Scalar.AspNetCore"/>
</ItemGroup>

<ItemGroup>
Expand Down
12 changes: 8 additions & 4 deletions working/content/modulith/Modulith.Web/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using FastEndpoints;
using FastEndpoints.Security;
using FastEndpoints.Swagger;
using Mediator;
using Scalar.AspNetCore;
#if (WithUi)
using Modulith.UI;
using MudBlazor.Services;
Expand All @@ -9,16 +11,15 @@

var builder = WebApplication.CreateBuilder(args);

// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();

// Call the method where you are registering services for each module:
// NewModuleModuleServiceRegistrar.ConfigureServices(builder.Services, builder.Configuration);

// Or use the discover method below to try and find the services for your modules`
builder.Services.DiscoverAndRegisterModules();

// TODO: Configure Mediator when handlers are implemented
// builder.Services.AddSingleton<IMediator, Mediator>();

#if (WithUi)
builder.Services.AddBlazorAssemblyDiscovery();
#endif
Expand Down Expand Up @@ -58,6 +59,9 @@
.UseFastEndpoints()
.UseSwaggerGen();

// Map Scalar API documentation
app.MapScalarApiReference();

#if (WithUi)
app.AddBlazorModulesAdditionalAssemblies();
#endif
Expand Down
56 changes: 0 additions & 56 deletions working/content/modulith/Modulith.sln

This file was deleted.

11 changes: 11 additions & 0 deletions working/content/modulith/Modulith.slnx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<Solution>
<Folder Name="/NewModule/">
<Project Path="NewModule/Modulith.NewModule.Contracts/Modulith.NewModule.Contracts.csproj" />
<Project Path="NewModule/Modulith.NewModule.Tests/Modulith.NewModule.Tests.csproj" />
<Project Path="NewModule/Modulith.NewModule/Modulith.NewModule.csproj" />
</Folder>
<Folder Name="/Shared/">
<Project Path="Shared/Modulith.SharedKernel/Modulith.SharedKernel.csproj" />
</Folder>
<Project Path="Modulith.Web/Modulith.Web.csproj" />
</Solution>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<PackageReference Include="MediatR"/>
<PackageReference Include="Mediator.Abstractions"/>
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
<ItemGroup>
<PackageReference Include="coverlet.collector"/>
<PackageReference Include="Microsoft.NET.Test.Sdk"/>
<PackageReference Include="xunit"/>
<PackageReference Include="xunit.v3"/>
<PackageReference Include="xunit.runner.visualstudio"/>
<PackageReference Include="tngtech.archunitnet.xunit"/>
<PackageReference Include="TngTech.ArchUnitNET.xUnitV3"/>
<PackageReference Include="FastEndpoints.Testing"/>
<PackageReference Include="FluentAssertions"/>
<PackageReference Include="AwesomeAssertions"/>
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using ArchUnitNET.Domain;
using ArchUnitNET.Loader;
using ArchUnitNET.xUnit;
using ArchUnitNET.xUnitV3;
using static ArchUnitNET.Fluent.ArchRuleDefinition;

namespace Modulith.NewModule.Tests;
Expand All @@ -17,7 +17,7 @@ public void BeInternal()
{
var domainTypes = Types()
.That()
.ResideInNamespace("Modulith.NewModule.*", true)
.ResideInNamespaceMatching("Modulith.NewModule.*")
.And()
.AreNot([typeof(AssemblyInfo), typeof(NewModuleModuleServiceRegistrar)])
.And()
Expand Down
Loading
Loading