Skip to main content

moon v1.14 - Improvements to running targets and toolchain versions

· 3 min read
Miles Johnson
Founder, developer

In this release, we've focused on loosening restrictions to improve the overall developer experience.

Shorthand for moon run

This has been a long requested feature and we're happy to finally deliver it! You can now omit the "run" keyword for the moon run command, just so long as the first non-option argument is a target (must contain a :).

# v1.13
$ moon run app:build

# v1.14+
$ moon app:build

Choose targets for moon ci

When we initially built moon ci, we wanted a solution that simply ran everything in CI that should be ran, taking care of all the complicated logic to determine affected tasks, comparing Git branches, gathering targets, partitioning across jobs, etc... And it does just that, and it does it well!

However, one major caveat to using moon ci is that it runs every task in the workspace (assuming they're affected). This has been quite a blocker for adoption as teams may want fine-grained control of their CI. For example, running build tasks in one job, lint tasks in another, so on and so forth.

In this release, we've made the necessary changes to allow these workflows, by supporting a list of targets for moon ci, similar to how moon run works. If no targets are provide, the existing "run everything" logic will be used.

# v1.13
$ moon ci

# v1.14+
$ moon ci :build :lint :etc

Splitting targets across jobs is demonstrated with the following GitHub Action workflow:

.github/workflows/ci.yml
name: 'CI'
on:
push:
branches:
- 'master'
pull_request:
jobs:
build:
name: 'Build'
runs-on: 'ubuntu-latest'
steps:
- uses: 'actions/checkout@v4'
with:
fetch-depth: 0
- uses: 'moonrepo/setup-moon-action@v1'
- run: 'moon ci :build'
format-lint:
name: 'Format + Lint'
runs-on: 'ubuntu-latest'
steps:
- uses: 'actions/checkout@v4'
with:
fetch-depth: 0
- uses: 'moonrepo/setup-moon-action@v1'
- run: 'moon ci :format :lint'
test:
name: 'Test'
runs-on: 'ubuntu-latest'
steps:
- uses: 'actions/checkout@v4'
with:
fetch-depth: 0
- uses: 'moonrepo/setup-moon-action@v1'
- run: 'moon ci :test'

Configure partial toolchain versions

Since moon's inception, our integrated toolchain required fully qualified semantic versions (major.minor.patch) for tools. This was by design to ensure that we could provide a consistent, reliable, and deterministic experience for all users. This solved the problem of "Is X using the correct version of Y?".

However, this also meant that we were unable to support partial versions (major.minor) of tools, which is a common use case and request for many users. Over the last few months, we've made immense progress in proto on how it parses, resolves, and evaluates versions, known as the version specification.

We felt the time was right to pull these changes into moon, and as such, all version fields in .moon/toolchain.yml now support partial versions, version requirements/ranges, and even aliases!

.moon/toolchain.yml
node:
version: '20.7' # ~20.7
npm:
version: '^9'

rust:
version: 'stable'
info

Learn more about how this works under the hood in the official version specification documentation.

Other changes

View the official release for a full list of changes.

  • Added packemon, sveltekit, vite, vitest to moonrepo/moon-configs.
  • Updated .moon/tasks to support nested folders, for better organization of task files.
  • Improved handling of certificates and proxies.
  • Updated to proto v0.18.