Switched to SimplePlugin plugin loader #16
@@ -1,10 +0,0 @@
|
|||||||
using MoonCore.PluginFramework;
|
|
||||||
using Moonlight.Api.Startup;
|
|
||||||
|
|
||||||
namespace Moonlight.Api.Host;
|
|
||||||
|
|
||||||
[PluginLoader]
|
|
||||||
public partial class AppStartupLoader : IAppStartup
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -7,8 +7,6 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="MoonCore.PluginFramework" Version="1.0.9"/>
|
|
||||||
<PackageReference Include="MoonCore.PluginFramework.Generator" Version="1.0.3"/>
|
|
||||||
|
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="10.0.1"/>
|
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="10.0.1"/>
|
||||||
|
|
||||||
@@ -16,6 +14,9 @@
|
|||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
|
||||||
|
<PackageReference Include="SimplePlugin" Version="1.0.2" />
|
||||||
|
<PackageReference Include="SimplePlugin.Abstractions" Version="1.0.2" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -1,17 +1,22 @@
|
|||||||
using Moonlight.Api.Host;
|
using Moonlight.Api.Startup;
|
||||||
|
using SimplePlugin.Generated;
|
||||||
|
|
||||||
var appLoader = new AppStartupLoader();
|
var modules = PluginRegistry.Modules
|
||||||
appLoader.Initialize();
|
.OfType<IAppStartup>()
|
||||||
|
.ToArray();
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
appLoader.PreBuild(builder);
|
foreach (var startup in modules)
|
||||||
|
startup.PreBuild(builder);
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
appLoader.PostBuild(app);
|
foreach (var startup in modules)
|
||||||
|
startup.PostBuild(app);
|
||||||
|
|
||||||
appLoader.PostMiddleware(app);
|
foreach (var startup in modules)
|
||||||
|
startup.PostMiddleware(app);
|
||||||
|
|
||||||
if (app.Environment.IsDevelopment())
|
if (app.Environment.IsDevelopment())
|
||||||
app.UseWebAssemblyDebugging();
|
app.UseWebAssemblyDebugging();
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
using MoonCore.PluginFramework;
|
|
||||||
using Moonlight.Frontend.Startup;
|
|
||||||
|
|
||||||
namespace Moonlight.Frontend.Host;
|
|
||||||
|
|
||||||
[PluginLoader]
|
|
||||||
public partial class AppStartupLoader : IAppStartup
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -14,8 +14,8 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="10.0.1"/>
|
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="10.0.1"/>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="10.0.1" PrivateAssets="all"/>
|
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="10.0.1" PrivateAssets="all"/>
|
||||||
<PackageReference Include="MoonCore.PluginFramework" Version="1.0.9"/>
|
<PackageReference Include="SimplePlugin" Version="1.0.2" />
|
||||||
<PackageReference Include="MoonCore.PluginFramework.Generator" Version="1.0.3"/>
|
<PackageReference Include="SimplePlugin.Abstractions" Version="1.0.2" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -1,15 +1,20 @@
|
|||||||
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
|
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
|
||||||
using Moonlight.Frontend.Host;
|
using Moonlight.Frontend.Startup;
|
||||||
|
using SimplePlugin.Generated;
|
||||||
|
|
||||||
var appLoader = new AppStartupLoader();
|
var modules = PluginRegistry
|
||||||
appLoader.Initialize();
|
.Modules
|
||||||
|
.OfType<IAppStartup>()
|
||||||
|
.ToArray();
|
||||||
|
|
||||||
var builder = WebAssemblyHostBuilder.CreateDefault(args);
|
var builder = WebAssemblyHostBuilder.CreateDefault(args);
|
||||||
|
|
||||||
appLoader.PreBuild(builder);
|
foreach (var startup in modules)
|
||||||
|
startup.PreBuild(builder);
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
appLoader.PostBuild(app);
|
foreach(var startup in modules)
|
||||||
|
startup.PostBuild(app);
|
||||||
|
|
||||||
await app.RunAsync();
|
await app.RunAsync();
|
||||||
@@ -30,6 +30,7 @@
|
|||||||
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="10.0.3" />
|
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="10.0.3" />
|
||||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="10.0.0"/>
|
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="10.0.0"/>
|
||||||
<PackageReference Include="Riok.Mapperly" Version="4.3.1-next.0"/>
|
<PackageReference Include="Riok.Mapperly" Version="4.3.1-next.0"/>
|
||||||
|
<PackageReference Include="SimplePlugin.Abstractions" Version="1.0.2" />
|
||||||
<PackageReference Include="VYaml" Version="1.2.0" />
|
<PackageReference Include="VYaml" Version="1.2.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
|
using SimplePlugin.Abstractions;
|
||||||
|
|
||||||
namespace Moonlight.Api.Startup;
|
namespace Moonlight.Api.Startup;
|
||||||
|
|
||||||
public interface IAppStartup
|
public interface IAppStartup : IPluginModule
|
||||||
{
|
{
|
||||||
public void PreBuild(WebApplicationBuilder builder);
|
public void PreBuild(WebApplicationBuilder builder);
|
||||||
public void PostBuild(WebApplication application);
|
public void PostBuild(WebApplication application);
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
|
using SimplePlugin.Abstractions;
|
||||||
|
|
||||||
namespace Moonlight.Api.Startup;
|
namespace Moonlight.Api.Startup;
|
||||||
|
|
||||||
|
[PluginModule]
|
||||||
public partial class Startup : IAppStartup
|
public partial class Startup : IAppStartup
|
||||||
{
|
{
|
||||||
public void PreBuild(WebApplicationBuilder builder)
|
public void PreBuild(WebApplicationBuilder builder)
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
<PackageReference Include="Riok.Mapperly" Version="4.3.1-next.0"/>
|
<PackageReference Include="Riok.Mapperly" Version="4.3.1-next.0"/>
|
||||||
<PackageReference Include="ShadcnBlazor" Version="1.0.11" />
|
<PackageReference Include="ShadcnBlazor" Version="1.0.11" />
|
||||||
<PackageReference Include="ShadcnBlazor.Extras" Version="1.0.11" />
|
<PackageReference Include="ShadcnBlazor.Extras" Version="1.0.11" />
|
||||||
|
<PackageReference Include="SimplePlugin.Abstractions" Version="1.0.2" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
|
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
|
||||||
|
using SimplePlugin.Abstractions;
|
||||||
|
|
||||||
namespace Moonlight.Frontend.Startup;
|
namespace Moonlight.Frontend.Startup;
|
||||||
|
|
||||||
public interface IAppStartup
|
public interface IAppStartup : IPluginModule
|
||||||
{
|
{
|
||||||
public void PreBuild(WebAssemblyHostBuilder builder);
|
public void PreBuild(WebAssemblyHostBuilder builder);
|
||||||
public void PostBuild(WebAssemblyHost application);
|
public void PostBuild(WebAssemblyHost application);
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
|
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
|
||||||
|
using SimplePlugin.Abstractions;
|
||||||
|
|
||||||
namespace Moonlight.Frontend.Startup;
|
namespace Moonlight.Frontend.Startup;
|
||||||
|
|
||||||
|
[PluginModule]
|
||||||
public partial class Startup : IAppStartup
|
public partial class Startup : IAppStartup
|
||||||
{
|
{
|
||||||
public void PreBuild(WebAssemblyHostBuilder builder)
|
public void PreBuild(WebAssemblyHostBuilder builder)
|
||||||
|
|||||||
Reference in New Issue
Block a user