-
-
Notifications
You must be signed in to change notification settings - Fork 256
Make bit es 2019 compatible with further multi-tageting (#11391) #11392
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughUpdates CI workflows to use npm and target ES2019, refactors Web.JS build and output paths, introduces NuGet packaging of ES2019 JS via a transitive MSBuild targets file, shifts script references from _content to _framework, adjusts service workers to cache ES2019 scripts, and redistributes Bit.BlazorES2019 package references across projects. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant Browser
participant ServerApp as Server App (Razor)
participant SW as Service Worker
participant Framework as _framework (ES2019)
User->>Browser: Navigate to app
Browser->>ServerApp: Request page
ServerApp-->>Browser: HTML with <script src="_framework/blazor.web.es2019.js" autostart="false"> + bit-bswup.js
Browser->>Framework: Load blazor.web.es2019.js
Browser->>SW: Register/activate service worker
SW->>Framework: Cache external asset "_framework/blazor.web.es2019.js"
Browser->>Framework: Start Blazor (deferred by bit-bswup.js)
Framework-->>Browser: App bootstrapped
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the Bit.BlazorES2019 package to support multi-targeting by changing its distribution strategy from embedded content to direct framework file copies. The changes enable better compatibility with different deployment scenarios and simplify the integration process.
Key changes:
- Moved BlazorES2019 package references from client projects to server/host projects
- Updated script references to use framework paths instead of content paths
- Modified the package build system to copy files to framework directory
Reviewed Changes
Copilot reviewed 31 out of 33 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| Multiple App.razor files | Updated script references from _content/Bit.BlazorES2019/ to _framework/ paths |
| Server project files | Added Bit.BlazorES2019 package references |
| Client project files | Removed Bit.BlazorES2019 package references |
| Service worker files | Updated cached script paths and cleaned up exclusion patterns |
| Index.html files | Updated script references for WebAssembly and WebView scenarios |
| Bit.BlazorES2019.csproj | Changed from Razor SDK to standard SDK and updated content packaging |
| Build targets file | New MSBuild targets file for copying framework files |
| GitHub workflows | Updated build process for generating ES2019 scripts |
src/Websites/Sales/src/Bit.Websites.Sales.Server/Components/App.razor
Outdated
Show resolved
Hide resolved
src/Websites/Platform/src/Bit.Websites.Platform.Server/Components/App.razor
Outdated
Show resolved
Hide resolved
src/Websites/Careers/src/Bit.Websites.Careers.Server/Components/App.razor
Outdated
Show resolved
Hide resolved
...Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Web/Components/App.razor
Outdated
Show resolved
Hide resolved
src/BlazorUI/Demo/Bit.BlazorUI.Demo.Server/Components/App.razor
Outdated
Show resolved
Hide resolved
src/Websites/Careers/src/Bit.Websites.Careers.Client/wwwroot/service-worker.published.js
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 6
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
.github/workflows/prerelease.nuget.org.yml (1)
37-52: Harden and speed up the aspnetcore JS build step
- Shallow clone and shallow submodules to cut time/bandwidth.
- Fail fast with
set -euo pipefail.- Make the
sedpatch resilient to whitespace.Apply this diff:
- - name: Generate ES2019 based blazor.*.js files - run: | - git clone https://github.com/dotnet/aspnetcore.git - cd aspnetcore - git switch release/9.0 - git submodule update --init --recursive - sed -i 's/"target": "ES2022"/"target": "ES2019"/' src/Components/Shared.JS/tsconfig.json - npm install - npm run-script build - cd src/Components/Web.JS - npm install - npm run-script build:production - cd ../../../../ - mkdir -p src/BlazorES2019/wwwroot/ - cp aspnetcore/src/Components/Web.JS/dist/Release/blazor.*.js src/BlazorES2019/wwwroot/ - rm -rf aspnetcore + - name: Generate ES2019 based blazor.*.js files + run: | + set -euo pipefail + git clone --depth 1 --branch release/9.0 --single-branch https://github.com/dotnet/aspnetcore.git + cd aspnetcore + git submodule update --init --recursive --depth 1 + sed -i -E 's/"target":\s*"ES2022"/"target": "ES2019"/' src/Components/Shared.JS/tsconfig.json + npm install + npm run-script build + cd src/Components/Web.JS + npm install + npm run-script build:production + cd ../../../../ + mkdir -p src/BlazorES2019/wwwroot/ + cp aspnetcore/src/Components/Web.JS/dist/Release/blazor.*.js src/BlazorES2019/wwwroot/ + rm -rf aspnetcore
🧹 Nitpick comments (7)
src/Websites/Platform/src/Bit.Websites.Platform.Client/wwwroot/service-worker.published.js (1)
17-18: Keep key quoting consistentOther entries use quoted keys (
"url"); keep it consistent to reduce noise in diffs.- { - url: "_framework/blazor.web.es2019.js" + { + "url": "_framework/blazor.web.es2019.js" }src/Websites/Sales/src/Bit.Websites.Sales.Client/wwwroot/service-worker.published.js (1)
17-18: Consistent quoting for keysMatch surrounding entries by quoting
url.- { - url: "_framework/blazor.web.es2019.js" + { + "url": "_framework/blazor.web.es2019.js" }src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/Boilerplate.Client.Maui.csproj (1)
166-166: Pin or centrally manage Bit.BlazorES2019 versionSame as Windows project: confirm Central Package Management or add Version here.
Use the version audit script provided in the Windows project comment.
.github/workflows/prerelease.nuget.org.yml (2)
26-29: Make removal idempotent to avoid step failures
rmerrors if the file is absent. Use-f.Apply this diff:
- rm src/AssemblyOriginatorKeyFile.snk + rm -f src/AssemblyOriginatorKeyFile.snk
22-25: Use an LTS Node to reduce build breakage riskNode 23 (non‑LTS) is used in .github/workflows/prerelease.nuget.org.yml (lines 22–25) and across other workflows; switch to LTS to avoid unexpected JS/aspnetcore build breaks.
Apply this diff:
- - uses: actions/setup-node@v4 - with: - node-version: 23 + - uses: actions/setup-node@v4 + with: + node-version: lts/*Optionally enable npm cache after cloning aspnetcore (or add a second setup-node step post-clone) for faster builds.
.github/workflows/nuget.org.yml (1)
59-61: Harden the copy step and surface failures.Add -v and fail-fast; list artifacts for easier troubleshooting.
- mkdir -p src/BlazorES2019/wwwroot/ - cp aspnetcore/src/Components/Web.JS/dist/Release/blazor.*.js src/BlazorES2019/wwwroot/ + set -euo pipefail + mkdir -p src/BlazorES2019/wwwroot/ + ls -al aspnetcore/src/Components/Web.JS/dist/Release || true + cp -v aspnetcore/src/Components/Web.JS/dist/Release/blazor.*.js src/BlazorES2019/wwwroot/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Web/wwwroot/service-worker.published.js (1)
73-73: Use absolute path for robustness.Avoid scope-relative resolution by prefixing with “/”.
- url: "_framework/blazor.web.es2019.js" + url: "/_framework/blazor.web.es2019.js"
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting
📒 Files selected for processing (31)
.github/workflows/nuget.org.yml(1 hunks).github/workflows/prerelease.nuget.org.yml(1 hunks)src/BlazorES2019/Bit.BlazorES2019/Bit.BlazorES2019.csproj(2 hunks)src/BlazorES2019/Bit.BlazorES2019/buildTransitive/Bit.BlazorES2019.targets(1 hunks)src/BlazorUI/Demo/Bit.BlazorUI.Demo.Server/Bit.BlazorUI.Demo.Server.csproj(1 hunks)src/BlazorUI/Demo/Bit.BlazorUI.Demo.Server/Components/App.razor(1 hunks)src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Bit.BlazorUI.Demo.Client.Core.csproj(0 hunks)src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Maui/Bit.BlazorUI.Demo.Client.Maui.csproj(1 hunks)src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Maui/wwwroot/index.html(1 hunks)src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Web/wwwroot/service-worker.published.js(1 hunks)src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Windows/Bit.BlazorUI.Demo.Client.Windows.csproj(1 hunks)src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Boilerplate.Client.Core.csproj(0 hunks)src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/Boilerplate.Client.Maui.csproj(1 hunks)src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/wwwroot/index.html(1 hunks)src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Web/wwwroot/index.html(1 hunks)src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Web/wwwroot/service-worker.published.js(1 hunks)src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Windows/Boilerplate.Client.Windows.csproj(1 hunks)src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Web/Boilerplate.Server.Web.csproj(1 hunks)src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Web/Components/App.razor(1 hunks)src/Websites/Careers/src/Bit.Websites.Careers.Client/Bit.Websites.Careers.Client.csproj(0 hunks)src/Websites/Careers/src/Bit.Websites.Careers.Client/wwwroot/service-worker.published.js(1 hunks)src/Websites/Careers/src/Bit.Websites.Careers.Server/Bit.Websites.Careers.Server.csproj(1 hunks)src/Websites/Careers/src/Bit.Websites.Careers.Server/Components/App.razor(1 hunks)src/Websites/Platform/src/Bit.Websites.Platform.Client/Bit.Websites.Platform.Client.csproj(0 hunks)src/Websites/Platform/src/Bit.Websites.Platform.Client/wwwroot/service-worker.published.js(1 hunks)src/Websites/Platform/src/Bit.Websites.Platform.Server/Bit.Websites.Platform.Server.csproj(1 hunks)src/Websites/Platform/src/Bit.Websites.Platform.Server/Components/App.razor(1 hunks)src/Websites/Sales/src/Bit.Websites.Sales.Client/Bit.Websites.Sales.Client.csproj(0 hunks)src/Websites/Sales/src/Bit.Websites.Sales.Client/wwwroot/service-worker.published.js(1 hunks)src/Websites/Sales/src/Bit.Websites.Sales.Server/Bit.Websites.Sales.Server.csproj(1 hunks)src/Websites/Sales/src/Bit.Websites.Sales.Server/Components/App.razor(1 hunks)
💤 Files with no reviewable changes (5)
- src/Websites/Careers/src/Bit.Websites.Careers.Client/Bit.Websites.Careers.Client.csproj
- src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Bit.BlazorUI.Demo.Client.Core.csproj
- src/Websites/Platform/src/Bit.Websites.Platform.Client/Bit.Websites.Platform.Client.csproj
- src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Boilerplate.Client.Core.csproj
- src/Websites/Sales/src/Bit.Websites.Sales.Client/Bit.Websites.Sales.Client.csproj
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build and test
🔇 Additional comments (23)
src/Websites/Sales/src/Bit.Websites.Sales.Client/wwwroot/service-worker.published.js (1)
16-19: Same verification: ensure the cached bootstrap matches the client typeUse
_framework/blazor.webassembly.jsfor WASM,blazor.web.es2019.jsfor Server/Auto ES2019. Align SW with the app’s actual script.You can reuse the repo-wide script from the Platform SW comment above to detect mismatches.
src/BlazorUI/Demo/Bit.BlazorUI.Demo.Server/Bit.BlazorUI.Demo.Server.csproj (1)
13-13: LGTM; ensure version consistency across projectsThis pins 9.12.0-pre-01. Please align other Bit.BlazorES2019 references via CPM or pin them to the same version.
Run the version audit script from the Windows project comment to confirm uniformity.
src/BlazorUI/Demo/Bit.BlazorUI.Demo.Server/Components/App.razor (1)
56-58: Correct ES2019 bootstrap and BSWUP wiringSwitching to
_framework/blazor.web.es2019.jsand updatingblazorScriptis consistent with ES2019 multi-targeting.src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Web/wwwroot/index.html (1)
205-207: WASM bootstrap path update looks good; verify service worker externalAssetsLGTM. Optionally preload _framework/dotnet.js and _framework/blazor.boot.json to improve first paint.
<head> @@ - <meta name="description" content="The Boilerplate is built with ASP.NET Core, Identity, Web API, EF Core and Blazor."> + <meta name="description" content="The Boilerplate is built with ASP.NET Core, Identity, Web API, EF Core and Blazor."> + <link rel="preload" href="_framework/dotnet.js" as="script" type="text/javascript"> + <link rel="preload" href="_framework/blazor.boot.json" as="fetch" type="application/json"> @@ - <script src="_framework/blazor.webassembly.js" autostart="false"></script> + <script src="_framework/blazor.webassembly.js" autostart="false"></script> <script src="_content/Bit.Bswup/bit-bswup.js" blazorScript="_framework/blazor.webassembly.js"></script>Search produced no matches for _framework/blazor.webassembly.js; confirm the service worker's externalAssets includes '_framework/blazor.webassembly.js' or add it.
src/Websites/Platform/src/Bit.Websites.Platform.Client/wwwroot/service-worker.published.js (1)
16-19: Verify the bootstrap script aligns with the hosting modelIf this is a Blazor WebAssembly client, the service worker should cache _framework/blazor.webassembly.js (not _framework/blazor.web.es2019.js). If it’s Server/Auto (ES2019), blazor.web.es2019.js is correct. Confirm by checking the client .csproj Sdk (Microsoft.NET.Sdk.BlazorWebAssembly) or presence of wwwroot/index.html. Location: src/Websites/Platform/src/Bit.Websites.Platform.Client/wwwroot/service-worker.published.js (lines 16–19).
src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Windows/Boilerplate.Client.Windows.csproj (1)
39-39: Central package management in use — no change requiredBit.BlazorES2019 is pinned in src/Templates/Boilerplate/Bit.Boilerplate/src/Directory.Packages.props as Version="9.12.0-pre-01"; leaving the csproj PackageReference without a Version is correct.
src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/wwwroot/index.html (1)
151-151: ES2019 WebView script present — verify runtime presence on all targetsLocation: src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/wwwroot/index.html
<script src="_framework/blazor.webview.es2019.js" autostart="false"></script>Confirm that _framework/blazor.webview.es2019.js is included in the built/published _framework assets at runtime on Android, iOS, MacCatalyst, and Windows.
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Web/wwwroot/service-worker.published.js (1)
12-18: ES2019 loader added to offline cache — LGTMIncluding
_framework/blazor.web.es2019.jsinself.externalAssetsaligns the SW with the new boot script path.Please verify via DevTools (Application > Service Workers > Offline) that the new asset is pre-cached after a hard reload.
src/Websites/Platform/src/Bit.Websites.Platform.Server/Components/App.razor (1)
27-31: Switch to framework ES2019 loader + Bswup binding — looks good
autostart="false"and theblazorScriptattribute are consistent with Bswup expectations.src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Maui/wwwroot/index.html (1)
143-146: ES2019 WebView loader wired correctlyThe
_framework/blazor.webview.es2019.jsswap withautostart="false"is correct for hybrid.src/Websites/Sales/src/Bit.Websites.Sales.Server/Components/App.razor (1)
51-53: ES2019 loader + Bswup reference updated — LGTMsrc/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Web/Components/App.razor (1)
92-94: Template aligned to_framework/blazor.web.es2019.js— LGTMsrc/Websites/Careers/src/Bit.Websites.Careers.Server/Components/App.razor (1)
28-32: ES2019 loader + Bswup binding — LGTMsrc/Websites/Careers/src/Bit.Websites.Careers.Client/wwwroot/service-worker.published.js (2)
16-19: ES2019 loader added to externalAssets — LGTMBrings SW caching in line with the ES2019 boot script.
11-19: Typo in service-worker asset names — verify generated CSS filenamesFile: src/Websites/Careers/src/Bit.Websites.Careers.Client/wwwroot/service-worker.published.js (lines 12, 15). service-worker references "Bit.Websites.Carrers..." — I couldn't find generated CSS in the repo; confirm whether built assets are named "Careers..." and if so apply the diff below.
- "url": "Bit.Websites.Carrers.Server.styles.css" + "url": "Bit.Websites.Careers.Server.styles.css" @@ - "url": "Bit.Websites.Carrers.Client.bundle.scp.css" + "url": "Bit.Websites.Careers.Client.bundle.scp.css".github/workflows/prerelease.nuget.org.yml (1)
50-52: Confirm packaging picks new output path — csproj includes wwwroot but pack couldn't be run heresrc/BlazorES2019/Bit.BlazorES2019/Bit.BlazorES2019.csproj contains:
true
PreserveNewest
contentFiles\any\net9.0\wwwroot_framework%(Filename).es2019%(Extension)
Action: run dotnet pack (locally or in CI) and verify the produced .nupkg contains blazor.*.js from src/BlazorES2019/wwwroot/.
src/BlazorES2019/Bit.BlazorES2019/Bit.BlazorES2019.csproj (1)
1-1: SDK switch looks right for a packaging-only project.No Razor assets here; using Microsoft.NET.Sdk is appropriate.
src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Web/wwwroot/service-worker.published.js (1)
66-66: Flags exclude LGTM.Regex is precise enough for this asset family.
src/Websites/Sales/src/Bit.Websites.Sales.Server/Bit.Websites.Sales.Server.csproj (1)
17-17: Server now carries ES2019 runtime – good.Ensure App.razor or layout references _framework/blazor.web.es2019.js (looks aligned per PR).
src/Websites/Careers/src/Bit.Websites.Careers.Server/Bit.Websites.Careers.Server.csproj (1)
14-14: LGTM.Matches the server-side shift to _framework/blazor.web.es2019.js in App.razor.
src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Web/Boilerplate.Server.Web.csproj (1)
16-16: Resolved — Bit.BlazorES2019 is centrally pinned. Directory.Packages.props contains<PackageVersion Include="Bit.BlazorES2019" Version="9.12.0-pre-01" />, so leaving the PackageReference without a version is fine.src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Maui/Bit.BlazorUI.Demo.Client.Maui.csproj (1)
105-105: LGTM for MAUI — ES2019 WebView script present.
index.html contains <script src="_framework/blazor.webview.es2019.js" autostart="false"></script> (src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Maui/wwwroot/index.html:144).src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Windows/Bit.BlazorUI.Demo.Client.Windows.csproj (1)
32-32: Confirm blazor.webview.es2019.js is referenced in the Windows WebView index.Adding Bit.BlazorES2019 to the Windows client makes sense, but the search returned no matches for
blazor.webview(.es2019)?\.jsin the Windows project so the buildTransitive copy/reference couldn't be confirmed. Verify the Windows WebView index (e.g., wwwroot/index.html or platform-specific index) includes a reference to blazor.webview.es2019.js or that a fallback to blazor.webview.js exists.File: src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Windows/Bit.BlazorUI.Demo.Client.Windows.csproj (line 32)
<PackageReference Include="Bit.BlazorES2019" Version="9.12.0-pre-01" />
closes #11391
Summary by CodeRabbit
New Features
Refactor
Chores