moon v1.21 - Deno tier 3, file group improvements, task shells, and more!
With this release, get ready for Deno tier 3 support, file group and task improvements, a new extension, and more.
Deno tier 3 support
We've supported Deno tier 1 and 2 for almost a year now, but were hesitant to support tier 3 until
proto stabilizes further. Now that proto is almost at an official v1 release, and other
tools in the toolchain (like Node.js, Bun, and Rust) are powered by proto, we're confident in
supporting Deno tier 3. To make use of this, simply set the
deno.version
setting in
.moon/toolchain.yml
.
deno:
version: '1.40.0'
When enabled, moon will download and install that version of Deno in the background, and run all subsequent tasks with it. This is great for ensuring that your project is always using the same version of Deno, across all machines.
File groups now support environment variables
Task inputs
have supported environment variables for a while now,
but file groups have not. The main reason for this is that file groups were implemented far before
environment variables in task inputs! To bridge this gap, we've added support for environment
variables in file groups.
fileGroups:
vite:
- '...'
- '$VITE_SECRET_KEY'
- '$NODE_ENV'
tasks:
build:
command: 'vite build'
inputs:
- '@group(vite)'
Environment variables can be referenced using the
@group
token function, or the new
@envs
token function. The latter is only supported for inputs
and
will error for other locations, while the former is supported in args
, inputs
, and outputs
,
but will filter out environment variables when they are not supported.
New unixShell
and windowsShell
task options
When the shell
task option is enabled, we run the task within a
shell. However, the chosen shell was hard-coded to $SHELL
on Unix machines and PowerShell on
Windows, but what if you wanted to run it with a different shell? Or the same shell across all
operating systems? Well, you couldn't.
But not anymore! With this release, we're introducing unixShell
and windowsShell
task options. When paired with shell
, the
task will run in a shell of your choice. For example, why not Bash everywhere?
tasks:
build:
command: 'vite build'
options:
shell: true
unixShell: 'bash'
windowsShell: 'bash'
New migrate-turborepo
extension
In our previous release, we added support for extensions, a new kind of WASM plugin.
Since this is a new experimental feature, we really wanted to show off what it can do, and stress
test its boundaries. To do that, we chose to migrate the old moon migrate from-turborepo
command
into an extension
(source can be found here).
This is our most complex extension so far, as it:
- Loads and parses files on the file system.
- Reads and writes JSON and YAML files.
- Supports deserializing data into structs.
- Extracts project graph information by executing
moon project-graph
.
Do you currently have a Turborepo powered repository? And want to migrate to moon? Then simply execute the extension as such. View our guide for more information!
$ moon ext migrate-turborepo
As part of the migration from moon's Rust core into a WASM plugin, we've added support for the following new features:
- Added Bun support behind a new
--bun
flag. - Added support for Turbo's
globalDotEnv
,dotEnv
, andoutputMode
. - Added support for root-level tasks (
//#
) through a rootmoon.yml
, instead of logging a warning. - Updated migrated task commands to run through a package manager, instead of
moon node run-script
.
Based on the success of this extension, we plan to support a migrate-nx
extension in the future!
If you'd like to help in this endeavor, let us know!
Other changes
View the official release for a full list of changes.
- Added
bun.inferTasksFromScripts
setting to.moon/toolchain.yml
, for compatibility with Node.js. - Added a
--quiet
global argument, for hiding non-critical moon output. - Updated tasks with glob-like arguments to automatically enabled the
shell
option, so that glob expansion works correctly. - Implemented a new buffered console layer for writing to stdout/stderr.