Skip to main content

moon v1.22 - Organizational settings, wildcard env var inputs, and Nx migration

· 3 min read
Miles Johnson

This release introduces new organizational settings for projects, a migrate from Nx extension, and more.

More organizational settings

One aspect of moon that sets us apart from other build systems and tools, is that we have built-in support for human-readable project and task metadata. This is extremely useful in organizing and managing large repositories, especially when ownership comes into play. This information is also used for categorization and filtering for MQL and our editor extensions/plugins.

To expand on this functionality even further, we're adding a few requests from the community, and they are:

  • New configuration and scaffolding variants for the project type setting in moon.yml. Perfect for contracts and templates.

    type: 'configuration'
  • New stack setting in moon.yml, for categorizing which tech stack the project belongs to. Supports frontend, backend, infrastructure, and systems.

    stack: 'frontend'
  • New description setting for tasks, that provides human-readable information.

    description: 'Builds the project using Vite'
    command: 'vite build'

New wildcard environment variable inputs

Task inputs have supported environment variables for quite a while now, but they are explicit, which can be tedious too manage when you have many environment variables. To make this easier, we've added support for wildcard environment variables, denoted by a *, which will match any environment variable with that pattern.

For example, say we want to track all Node.js and Vite environment variables that start with NODE_ and VITE_ respectively, we can simply do:

command: 'vite build'
- '$NODE_*'
- '$VITE_*'

Do note that this isn't a glob, and the * is merely a substitution for any character!

New migrate-nx extension

In our previous release, we added support for migrating from Turborepo, but what about Nx? Nx is a very popular build system with many users. A lot of our current moon users were former Nx users, but unfortunately, they had to go through the tedious process of migrating everything manually. We wanted to make this process easier for new users, so we created a new experimental extension to help with this process, migrate-nx.

$ moon ext migrate-nx

This extension was quite complicated to implement, as Nx has a ton of features. However, when the extension is executed, we'll convert the root nx.json and workspace.json files to .moon/workspace.yml and related top-level config files, and we'll also convert every project.json and package.json (with an nx block) into a moon.yml file.

Conversion is not a perfect 1:1, as moon and Nx are quite different. Please refer to the official documentation for a list of unsupported settings and features.


An awesome feature that didn't make it in time for this release, is an npm package for Nx compatiblity, that will allow Nx executors/plugins to be executed through moon, without the requirement of Nx itself. This will allow for a seamless transition from Nx to moon, without the need to change any of your existing Nx executors/plugins till later.

This functionality will be provided by our new @moonrepo/nx-compat package, which we hope to finish in the coming weeks.

Other changes

View the official release for a full list of changes.

  • Added an installArgs setting for bun/npm/pnpm/yarn in .moon/toolchain.yml, to customize the args used when installing dependencies.
  • Updated the envFile task option to support a list of file paths.