Skip to content

Conversation

@maxkatz6
Copy link
Member

@maxkatz6 maxkatz6 commented Dec 9, 2025

What does the pull request do?

Currently, both Avalonia.Browser and Avalonia.DesignerSupport assume node.js and npm are preinstalled on the current machine. It comes as an unexpected dependency, that we can't enforce.

Just as an experiment, I tried to use Bun packaged as a .NET 10 tool and see how well it works.

How was the solution implemented (if it's not obvious)?

Bun is a lightweight and performant JS runtime, popular as a replacement for node.js.
Since it's just 20-30mb per each platform, I was able to pack it as a .NET 10 native tool and upload to nuget - Bun.Unofficial.Tool (with RID specific packages win-x64, linux-x64, osx-arm64, osx-x64).

Said tool is then used with dnx ToolName arguments command syntax, new .NET 10 mechanism to run tool without explicitly installing it globally (it's still downloaded in nuget cache and reused). See Running one-off .NET tools with dnx for more details.
IMO, this approach is much easier to maintain than local .NET tools Microsoft recommended before.

Biggest part of git diffs is replacement of package.lock.json with bun.lock files. Technically, lock files are optional, but we used them before - so I kept new lock files in place too.

Additionally, Avalonia.DesignerSupport is not anymore built by Nuke script, but instead by MSBuild target. Same with Avalonia.DesignerSupport.Tests (although, these are still executed by nuke)

Breaking changes

None. List of dependencies is exactly the same, no JS package versions were updated. TS code is compiled and bundled with the same compiler, just different runtime to run JS tooling.

Fixed issues

Addresses one of the inconveniences in #19391

@maxkatz6 maxkatz6 added area-infrastructure Issues related to CI/tooling infrastructur os-browser labels Dec 9, 2025
@avaloniaui-bot
Copy link

You can test this PR using the following package version. 12.0.999-cibuild0060685-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@maxkatz6 maxkatz6 added this pull request to the merge queue Dec 9, 2025
Merged via the queue into master with commit 09fefed Dec 9, 2025
11 checks passed
@maxkatz6 maxkatz6 deleted the bun-instead-of-nodejs branch December 9, 2025 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-infrastructure Issues related to CI/tooling infrastructur os-browser

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants