Skip to content

Commit

Permalink
Add WebAssembly project and package
Browse files Browse the repository at this point in the history
  • Loading branch information
rockfordlhotka committed Sep 10, 2024
1 parent 65c1a5a commit a856c05
Show file tree
Hide file tree
Showing 11 changed files with 109 additions and 30 deletions.
27 changes: 27 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<Project>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>preview</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
</PropertyGroup>

<!-- Common Package Settings -->
<PropertyGroup>
<Version>1.0.2.0</Version>
<RepositoryType>GitHub</RepositoryType>
<Company>Marimer LLC</Company>
<Product>Blazor Render Mode Detection</Product>
<Copyright>Copyright © 2002-$([System.DateTime]::Now.ToString('yyyy')) Marimer LLC</Copyright>
<Authors>Marimer LLC</Authors>
<Title>Blazor Render Mode Detection</Title>
<PackageProjectUrl>https://github.com/MarimerLLC/Marimer.Blazor.RenderMode</PackageProjectUrl>
<PackageReadmeFile>../readme.md</PackageReadmeFile>
<RepositoryUrl>https://github.com/MarimerLLC/Marimer.Blazor.RenderMode</RepositoryUrl>
<PackageTags>aspnetcore;blazor</PackageTags>
<PackageLicenseExpression> MIT</PackageLicenseExpression>
<IncludeSymbols>True</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>
</Project>
29 changes: 29 additions & 0 deletions Marimer.Blazor.RenderMode.WebAssembly/ConfigurationExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//-----------------------------------------------------------------------
// <copyright file="ConfigurationExtensions.cs" company="Marimer LLC">
// Copyright (c) Marimer LLC. All rights reserved.
// Website: https://cslanet.com
// </copyright>
// <summary>Extension methods for the RenderMode enum</summary>
//-----------------------------------------------------------------------
using Microsoft.Extensions.DependencyInjection;

namespace Marimer.Blazor.RenderMode.WebAssembly
{
/// <summary>
/// Extension methods for the RenderMode enum
/// </summary>
public static class ConfigurationExtensions
{
/// <summary>
/// Adds services required for render mode detection
/// </summary>
/// <param name="services">IServiceCollection instance</param>
/// <returns></returns>
public static IServiceCollection AddRenderModeDetection(this IServiceCollection services)
{
services.AddTransient<RenderModeProvider>();
services.AddScoped<ActiveCircuitState>();
return services;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<PackageReadmeFile>readme.md</PackageReadmeFile>
</PropertyGroup>
<ItemGroup>
<None Include="..\readme.md">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
</ItemGroup>
<ItemGroup>
<SupportedPlatform Include="browser" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components" Version="8.0.8" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.8" />
</ItemGroup>

<ItemGroup>
<None Update="readme.md">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
</ItemGroup>
</Project>
File renamed without changes.
1 change: 1 addition & 0 deletions Marimer.Blazor.RenderMode.WebAssembly/_Imports.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@using Microsoft.AspNetCore.Components.Web
8 changes: 8 additions & 0 deletions Marimer.Blazor.RenderMode.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Marimer.Blazor.RenderMode",
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{2A7372E0-B9B2-457A-B50C-687FF9D0BD00}"
ProjectSection(SolutionItems) = preProject
Directory.Build.props = Directory.Build.props
global.json = global.json
push.ps1 = push.ps1
readme.md = readme.md
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Marimer.Blazor.RenderMode.WebAssembly", "Marimer.Blazor.RenderMode.WebAssembly\Marimer.Blazor.RenderMode.WebAssembly.csproj", "{2C0CBC7A-F04A-438C-8009-A8205D0D13BF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -21,6 +25,10 @@ Global
{D5B205FB-A8CE-49A2-9AED-1A0300AE81A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D5B205FB-A8CE-49A2-9AED-1A0300AE81A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D5B205FB-A8CE-49A2-9AED-1A0300AE81A1}.Release|Any CPU.Build.0 = Release|Any CPU
{2C0CBC7A-F04A-438C-8009-A8205D0D13BF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2C0CBC7A-F04A-438C-8009-A8205D0D13BF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2C0CBC7A-F04A-438C-8009-A8205D0D13BF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2C0CBC7A-F04A-438C-8009-A8205D0D13BF}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
6 changes: 1 addition & 5 deletions Marimer.Blazor.RenderMode/ConfigurationExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,7 @@ public static IServiceCollection AddRenderModeDetection(this IServiceCollection
{
services.AddTransient<RenderModeProvider>();
services.AddScoped<ActiveCircuitState>();
var isBrowser = OperatingSystem.IsBrowser();
if (!isBrowser)
{
services.AddScoped(typeof(CircuitHandler), typeof(ActiveCircuitHandler));
}
services.AddScoped(typeof(CircuitHandler), typeof(ActiveCircuitHandler));
return services;
}
}
Expand Down
34 changes: 9 additions & 25 deletions Marimer.Blazor.RenderMode/Marimer.Blazor.RenderMode.csproj
Original file line number Diff line number Diff line change
@@ -1,39 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Title>Blazor Render Mode Detection</Title>
<Copyright>Copyright (c) Marimer LLC</Copyright>
<PackageProjectUrl>https://github.com/MarimerLLC/Marimer.Blazor.RenderMode</PackageProjectUrl>
<PackageReadmeFile>readme.md</PackageReadmeFile>
<RepositoryUrl>https://github.com/MarimerLLC/Marimer.Blazor.RenderMode</RepositoryUrl>
<PackageTags>aspnetcore;blazor</PackageTags>
<PackageLicenseExpression> MIT</PackageLicenseExpression>
<IncludeSymbols>True</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<AssemblyVersion>1.0.1.0</AssemblyVersion>
<FileVersion>1.0.1.0</FileVersion>
</PropertyGroup>

<ItemGroup>
<None Include="..\readme.md">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
</ItemGroup>


<ItemGroup>
<SupportedPlatform Include="browser" />
</ItemGroup>

<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" Version="8.0.8" />
<None Include="..\readme.md">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
<PackageReference Include="Microsoft.AspNetCore.Components" Version="8.0.8" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.8" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.8" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Marimer.Blazor.RenderMode.WebAssembly\Marimer.Blazor.RenderMode.WebAssembly.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down
8 changes: 8 additions & 0 deletions push.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
param(
[Parameter(Mandatory=$True, Position=0, ValueFromPipeline=$false)]
[System.String]
$apiKey
)

dotnet nuget push .\Marimer.Blazor.RenderMode\bin\Release\Marimer.Blazor.RenderMode.1.0.2.nupkg --source https://api.nuget.org/v3/index.json --api-key $apiKey
dotnet nuget push .\Marimer.Blazor.RenderMode.WebAssembly\bin\Release\Marimer.Blazor.RenderMode.WebAssembly.1.0.2.nupkg --source https://api.nuget.org/v3/index.json --api-key $apiKey

0 comments on commit a856c05

Please sign in to comment.