moon v0.13 - Hashing and toolchain improvements
With this release, we've landed some improvements to our smart hashing, and paved the road for additional languages and tooling.
Node.js is now optional
Title may seem confusing at first, but don't worry, everything is fine! For some context, moon has
been designed to be language agnostic as we plan to support more than JavaScript in the future.
However, some aspects of the codebase were hard-coded for JavaScript and made the assumption that
JavaScript will always be used, with one such aspect being the node
setting in .moon/workspace.yml
.
We've reworked this setting to be optional, which allows a repository to opt out of JavaScript.
Right now, this basically does nothing as we do not support other languages yet, but we felt it
necessary to report it anyways! A side-effect of this change is that actions in the runner have been
renamed, for example, SetupToolchain
-> SetupNodeToolchain
.
Improved hashing accuracy
Our smart hashing layer is pretty powerful, but was not entirely
accurate. Up until now, when hashing a Node.js project, we'd include the dependencies
,
devDependencies
, and peerDependencies
versions located within the project's package.json
as
hash inputs. This was great, because if a dependency was explicitly upgraded in the package.json
,
it would invalidate the previous hashes as the version number changed.
However, what if the dependency was implicitly upgraded by another project, but the package.json
was not modified? These kind of transitive changes were currently ignored by moon, but no longer, as
moon will now resolve all package.json
dependencies to the resolved version found in the root
lockfile (package-lock.json
, yarn.lock
, etc)!
At moon, we believe in providing consumers with the ability to configure to their needs, and as
such, have added a new hasher
setting to
.moon/workspace.yml
. This setting will allow you to choose between the
2 hashing patterns above!
New moon check
command
If you're like us, you're constantly testing, linting, typechecking, so on and so forth, a project
while developing. This was rather cumbersome, as you either had to use separate run commands
(moon run project:test
, moon run project:lint
, etc), or use the multi-run approach
(moon run project:test project:lint
). Both approaches were not ideal for rapid development.
To simplify this process, we've added a new moon check
command, that
will automatically run all build and test tasks for a project (or many projects)! Local and non-CI
tasks will not be ran.
# Check project at current working directory
$ moon check
# Check project by name
$ moon check app
# Check multiple projects by name
$ moon check client server
New @moonrepo/types
package
We have many ideas for moon specific npm packages that we plan to release, but before we do that, we need to ensure all of them are built with the correct interfaces. To solve this, we are shipping a new package, @moonrepo/types, that simply publishes TypeScript declarations. It contains everything from project and task shapes, configuration structures, runner information, and more.
import type { ProjectConfig } from '@moonrepo/types';
Other changes
View the official release for a full list of changes.
- The runner will now fail with an error if a task has defined
outputs
but an output was not created after the task is executed. This change was made so that artifacts are deterministic. - The
actionRunner
setting in.moon/workspace.yml
was renamed torunner
.
What's next?
Expect the following in the v0.14 release!
- A
moon generate
command to generate new projects, files, scaffolding, and more from pre-defined templates. - Implicit dependency discovery. moon will now scan manifest files and determine project relationships.