Back to Moon

moon v0.18 - Improved configuration and initialization flow

website/blog/2022-10-31_v0.18.mdx

2.2.43.0 KB
Original Source

import Image from '@site/src/components/Image';

Happy Halloween 🎃 👻! With this spooky release, we've focused heavily on our internals and benchmarking performance metrics, so it's rather light on new features, but we still have some to show!

<!--truncate-->

Improved projects configuration

When moon initially launched, it required defining all projects using a map. In v0.3, we added support for globs to ease the burden of defining many projects. At this point, you had to choose between the 2 patterns, which wasn't always ideal.

To improve upon this, you can now define a map and globs using a 3rd pattern, like so.

yaml
projects:
  globs:
    - 'apps/*'
    - 'packages/*'
  sources:
    www: 'www'

Improved moon init flow

The moon init command hasn't changed much since our v0.1 release, and with many new features and configurations over these last 18 releases, the initialization flow has fallen quite behind. We felt it was the perfect time to modernize this command a bit.

On top of automatically detecting settings from the environment, the command will also now prompt you with additional questions while configuring Node.js or TypeScript. Here's an example of this flow:

<Image src={require('./img/v0.18/init-flow.png')} width="80%" />

Furthermore, the command also supports enabling a new tool (appending configuration to .moon/workspace.yml) into an existing moon repository, by running moon init --tool <name>.

Customize node execution arguments

moon manages the Node.js binary in our toolchain, and runs all Node.js based tasks using this binary, instead of relying on the binary found in the developer's environment. Because of this, how node is executed is abstracted away from end users.

What if you wanted to use an experimental loader and execute TypeScript code at runtime? Or to preserve symlinks? Well, you couldn't... but no longer, as we've added a new setting, node.binExecArgs, that allows additional node CLI arguments to be defined, that will be passed to all executions.

yaml
node:
  binExecArgs:
    - '--loader'
    - '@boost/module/loader'

Learn more about the Boost module loader!

Other changes

View the official release for a full list of changes.

  • Default Node.js version has been updated to v18.12 (the new LTS) from v16.17.
  • Updated the moon check command to support an --all flag.
  • Improvements to how we store stdout/stderr logs for ran targets.
  • Work tree dirty checks when running migration commands.

What's next?

Expect the following in the v0.19 release!

  • Laying the groundwork for remote caching!
  • An in-repo secrets management layer.
  • Performance and affected improvements.