Skip to main content

moon v1.3 - Advanced run targeting and an official proto plugin

· 3 min read
Miles Johnson
Founder, developer

After many months of design and development, we're finally introducing MQL, our own unique query language!

Run targets based on a query

Our moon run command is pretty powerful. It allows you to run targets in one, many, or all projects. It also supports running multiple targets in parallel. However, it wasn't powerful enough, as it couldn't run the following types of scenarios:

  • Run a target in projects of a specific language.
  • Run a target in libraries or applications.
  • Run a target based on project file system path.
  • Run a target in projects with a matching tag.
  • Run a target in projects that match a keyword.
  • Run a target in projects based on AND or OR conditions.
  • Or a combination of these.
  • And many more!

Supporting all of these scenarios through CLI arguments just feels like bad design, and would result in a poor developer experience. There had to be a better way to support this! So we set out to solve this problem, and after much thought, we're stoked to introduce MQL, a query language unique to moon.

With MQL, you can now run scenarios like "I want to build all Node.js libraries", or "I want to lint and test all Rust projects". Simply pass an unscoped target and a query to the run command:

$ moon run :build --query "taskPlatform=node && projectType=library"

$ moon run :lint :test --query "language=rust"

This is only the first iteration of MQL and it's already quite powerful. Expect additional fields, features, and functionality in the future!

Plugin support for proto

Earlier this week we announced plugin support for proto, starting with a TOML based plugin. This is great as it allows any kind of versioned tool to be managed in proto's toolchain, so why not moon? Starting with this release, you can now install and manage moon from proto, using our officially maintained TOML plugin.

In your .prototools or ~/.proto/config.toml file, add the following snippet:

.prototools
[plugins]
moon = "source:https://raw.githubusercontent.com/moonrepo/moon/master/proto-plugin.toml"

And as easy as that, you can now use moon as a tool within any proto command. For example:

$ proto install moon 1.3.0
$ proto list-remote moon
$ proto bin moon

Furthermore, with proto, we can now pin the version of moon on a per-project basis. Perfect for enforcing the same version for all developers on your team!

.prototools
moon = "1.3.0"

When using this approach, be sure ~/proto/.bin is in your PATH, and takes precedence over ~/.moon/bin.

Other changes

View the official release for a full list of changes.

  • Upgraded to proto v0.7.
  • Improved accuracy of our globbing utilities, especially around dotfiles/dotfolders.
  • Updated config loading to be strict and error on unknown fields for non-root fields.