website/blog/2024-02-07_moon-v1.21.mdx
With this release, get ready for Deno tier 3 support, file group and task improvements, a new extension, and more.
<!--truncate-->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.
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.
unixShell and windowsShell task optionsWhen 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'
migrate-turborepo extensionIn 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:
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:
--bun flag.globalDotEnv, dotEnv, and outputMode.//#) through a root moon.yml, instead of logging a
warning.moon node run-script.:::info
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!
:::
View the official release for a full list of changes.
bun.inferTasksFromScripts setting to .moon/toolchain.yml, for compatibility with
Node.js.--quiet global argument, for hiding non-critical moon output.shell option, so that glob
expansion works correctly.