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/build-branch-for-web.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ jobs:
with:
name: Z2Randomizer-${{ inputs.version }}-${{ matrix.platform.name }}
path: |
CrossPlatformUI.Browser/bin/Release/net10.0-browser/browser-wasm/AppBundle/
CrossPlatformUI.Browser/bin/Release/net10.0-browser/publish
!**/*.pdb

4 changes: 4 additions & 0 deletions CrossPlatformUI.Browser/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
wwwroot/Asm
wwwroot/js65
wwwroot/Sprites
wwwroot/ips-manifest.txt
wwwroot/PalaceRooms.json
48 changes: 36 additions & 12 deletions CrossPlatformUI.Browser/CrossPlatformUI.Browser.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk.WebAssembly">
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Problem exists between line 1 and line 2

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0-browser</TargetFramework>
Expand All @@ -17,8 +17,11 @@
<Configurations>Debug;Release;Unsafe Debug</Configurations>

<Platforms>AnyCPU</Platforms>
<!-- <TrimMode>partial</TrimMode>-->
<TrimMode>partial</TrimMode>
<!-- <GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>-->

<CompressionEnabled>false</CompressionEnabled>
<BlazorEnableCompression>false</BlazorEnableCompression>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Release'">
Expand All @@ -44,27 +47,52 @@
<ItemGroup>
<WasmExtraFilesToDeploy Include="wwwroot\**" />
</ItemGroup>
<ItemGroup>
<WasmExtraFilesToDeploy Include="..\RandomizerCore\Sprites\**" TargetPath="Sprites\%(Filename)%(Extension)" />
<WasmExtraFilesToDeploy Include="..\RandomizerCore\PalaceRooms.json" />
<WasmExtraFilesToDeploy Include="..\RandomizerCore\Asm\**" TargetPath="Asm\%(RecursiveDir)\%(Filename)%(Extension)" />
</ItemGroup>
<Target Name="CopyAssetsToLocalWwwRoot" BeforeTargets="BeforeBuild;AssignTargetPaths">
<ItemGroup>
<!-- Define the external source items -->
<ExternalSprites Include="..\RandomizerCore\Sprites\**" />
<ExternalJson Include="..\RandomizerCore\PalaceRooms.json" />
<ExternalAsm Include="..\RandomizerCore\Asm\**" />

<!-- Tell Visual Studio to watch them for changes -->
<UpToDateCheckInput Include="@(ExternalSprites);@(ExternalJson);@(ExternalAsm)" />
</ItemGroup>

<Copy SourceFiles="@(ExternalSprites)"
DestinationFiles="@(ExternalSprites -> 'wwwroot\Sprites\%(RecursiveDir)%(Filename)%(Extension)')"
SkipUnchangedFiles="true" />
<Copy SourceFiles="@(ExternalJson)"
DestinationFiles="wwwroot\PalaceRooms.json"
SkipUnchangedFiles="true" />
<Copy SourceFiles="@(ExternalAsm)"
DestinationFiles="@(ExternalAsm -> 'wwwroot\Asm\%(RecursiveDir)%(Filename)%(Extension)')"
SkipUnchangedFiles="true" />
</Target>

<ItemGroup>
<IpsFiles Include="..\RandomizerCore\Sprites\*.ips" />
</ItemGroup>
<ItemGroup>
<None Remove="wwwroot\index.html" />
</ItemGroup>

<Target Name="GenerateIpsManifest" AfterTargets="Build">
<WriteLinesToFile
File="wwwroot\ips-manifest.txt"
Lines="@(IpsFiles->'%(Filename)%(Extension)')"
Overwrite="true" />
</Target>

<Target Name="CopyJs65Assets" AfterTargets="ResolvePackageAssets">
<ItemGroup>
<Js65Files Include="$(Pkgjs65_browser)\assets\js65\**\*.*" />
</ItemGroup>
<Copy SourceFiles="@(Js65Files)" DestinationFolder="$(MSBuildProjectDirectory)\wwwroot\js65\%(RecursiveDir)" SkipUnchangedFiles="true" />
</Target>

<ItemGroup>
<PackageReference Include="Avalonia.Browser" Version="$(AvaloniaVersion)" />
<PackageReference Include="js65.browser" Version="$(Js65Version)" />
<PackageReference Include="js65.browser" Version="$(Js65Version)" GeneratePathProperty="true" />
</ItemGroup>

<ItemGroup>
Expand All @@ -74,8 +102,4 @@
<ItemGroup>
<ProjectReference Include="..\CrossPlatformUI\CrossPlatformUI.csproj" />
</ItemGroup>

<!-- <ItemGroup>-->
<!-- <TrimmerRootAssembly Include="RandomizerCore" />-->
<!-- </ItemGroup>-->
</Project>
6 changes: 6 additions & 0 deletions CrossPlatformUI.Browser/wwwroot/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ function showError(msg) {
// identify runtime/assembly payloads
const isBootResource = (url, res) => {
const u = (typeof url === "string" ? url : url.url || "").toLowerCase();

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not too sure, but after getting publish working regular Visual Studio launched builds wouldn't work. Gemini suggested this and it fixed it.

// Skip hot reload endpoints entirely
if (u.includes("hotreload")) {
return false;
}

const ext = /\.(wasm|dll|pdb|dat|gz|br|json|blat|bundle)$/.test(u);
const frameworkPath = u.includes("/_framework/") || u.includes("dotnet.") || u.includes("icudt");
const ct = res?.headers?.get("content-type") || "";
Expand Down
Loading