Skip to main content

moon v1.16 - Bun support, Rust improvements, and more!

· 3 min read
Miles Johnson
Founder, developer

With this release, we've focused on requests from the community, instead of internal migration work or new features.

Bun as a package manager

Now that Bun v1 has officially released and our bun-plugin for proto has stabilized, we can start slowly integrating Bun support into moon. The first step in this series is adding Bun as a supported package manager for Node.js. Seems odd as they are conflicting runtimes... right? While true, a lot of users are interested in using Bun purely as a package manager, as it can install dependencies incredibly fast. So why not support it?

In this release, you can now install dependencies with Bun by configuring node.packageManager and node.bun in your toolchain.

.moon/toolchain.yml
node:
packageManager: 'bun'
bun:
version: '1.0.0'

Additionally, you can now execute Bun commands within tasks! However, ensure the task's platform is still set to node though, as this is using Bun as a package manager within Node.js, not as a separate runtime.

moon.yml
tasks:
test:
command: 'bun test'
platform: 'node'

When using Bun, the following integrations are applied:

  • Will automatically download and install Bun for the configured version.
  • Will install dependencies using bun install (deduping currently not supported).
  • Will parse bun.lockb for dependency resolution and task hashing.
  • Will use bunx instead of npx for one-off package executions.
  • Can execute bun commands within tasks.

This change only adds support for Bun as a package manager for Node.js. It does not add Bun as a supported language/platform in the toolchain, but it does pave the way for this to happen! Also note that Bun is not supported on Windows!

Configure Rust components and targets

We've had Rust tier 2 and 3 support for quite a while now, but there was a big missing piece: the ability to configure and install additional components and targets for the current toolchain. In this release, we've added support for both!

Simply configure the rust.components or rust.targets settings in .moon/toolchain.yml, and moon will automatically install them when the pipeline is ran. This functionality uses the same hashing implementation as rust.bins, so will only install the first time, and again if the configuration changes (or the cache is removed).

.moon/toolchain.yml
rust:
version: '1.73.0'
components:
- 'clippy'
- 'rust-analyzer'
targets:
- 'wasm32-wasi'

Force toolchain to use global binaries

Our toolchain is great for local development, as it ensures all developers and machines are running the exact versions of tools required for the workspace. However, it becomes overkill for other environments like CI and Docker where the environment has been pre-configured.

To avoid the unnecessary overhead of download and installing tools in the toolchain, we're introducing the MOON_TOOLCHAIN_FORCE_GLOBALS environment variable. When provided, this will:

  • Disable downloading and installing tools (will still download the WASM plugins).
  • Execute all tool commands using the global binary available on PATH.
MOON_TOOLCHAIN_FORCE_GLOBALS=true moon ci

We're looking into ways to automate this process, but for now, this is the best solution.

Other changes

View the official release for a full list of changes.

  • Added an improved task inheritance chain resolver. To fallback to the previous behavior, set experiments.interweavedTaskInheritance: false in .moon/workspace.yml.
  • Added a new project type automation, for projects like E2E and integration testing.
  • Updated action graph cycle detection to list all nodes in the cycle (when detectable).
  • Updated all npx calls to use a package manager equivalent. For example: yarn dlx, pnpm dlx, bunx.
  • Updated to support Yarn v4.