Skip to main content

moon v0.15 - Enhanced Docker support and 1,000 stars!

· 4 min read
Miles Johnson
Founder, developer

With this release, we've focused heavily on Docker integration and enhancing the Dockerfile workflow, as well as some minor quality of life improvements for template files and run reports.

1,000 ⭐️🌟⭐️!

Before we dive into the release, we want to thank everyone for the initial support, as we passed 1,000 stars on GitHub earlier this week! moon was announced back in June, and to reach this milestone in roughly 3 months is very exciting. We greatly appreciate the support, and to everyone that is using moon and providing feedback, we thank you from the bottom of our hearts!

We have a very long roadmap ahead of us, but are very excited to bring all of these features to you, and to improve the overall developer experience for your monorepos! Here's to 10,000 stars!

First-class Docker support

Docker is a very popular tool that is typically a part of a developers workflow, but is also a very tedious one, as Dockerfiles have to be manually curated for every project. We aim to mitigate this problem by supporting Docker as a first-class feature, and by introducing 2 new commands, moon docker scaffold and moon docker prune.

These commands will automate a Dockerfile as much as possible to effectively take advantage of Docker's layer caching, multi-staged builds, to reduce the amount of manual COPY commands, to reduce the overall size of the container or image, and much more. To demonstrate this, compare the before and after Dockerfiles below!

FROM node:latest

WORKDIR /app

# Install moon binary
RUN npm install -g @moonrepo/cli

# Copy moon files
COPY ./.moon ./.moon

# Copy all package.json's and lockfiles
COPY ./packages/cli/package.json ./packages/cli/package.json
COPY ./packages/core-linux-arm64-gnu/package.json ./packages/core-linux-arm64-gnu/package.json
COPY ./packages/core-linux-arm64-musl/package.json ./packages/core-linux-arm64-musl/package.json
COPY ./packages/core-linux-x64-gnu/package.json ./packages/core-linux-x64-gnu/package.json
COPY ./packages/core-linux-x64-musl/package.json ./packages/core-linux-x64-musl/package.json
COPY ./packages/core-macos-arm64/package.json ./packages/core-macos-arm64/package.json
COPY ./packages/core-macos-x64/package.json ./packages/core-macos-x64/package.json
COPY ./packages/core-windows-x64-msvc/package.json ./packages/core-windows-x64-msvc/package.json
COPY ./packages/runtime/package.json ./packages/runtime/package.json
COPY ./packages/types/package.json ./packages/types/package.json
COPY ./package.json ./package.json
COPY ./yarn.lock ./yarn.lock
COPY ./.yarn ./.yarn
COPY ./.yarnrc.yml ./yarnrc.yml

# Install toolchain and dependencies
RUN moon setup

# Copy project and required files
COPY ./packages/types ./packages/types
COPY ./packages/runtime ./packages/runtime
# COPY . .

# Build the target
RUN moon run runtime:build

View the official Docker usage guide for an in-depth walkthrough of all these new features!

Frontmatter for template files

We released templates and the generator in v0.14 for quick and easy code generation. Since it was the initial release, it provided the bare minimum of features for common workflows. We'll continually improve this system over each release, and have done just that for this release, as all template files now support frontmatter! Frontmatter is a mechanism for declaring per-file configuration, and is denoted by --- delimiters at the top of the file.

This allows you to do some really cool stuff, like overriding the destination path of the file using the to field, as well as taking full advantage of Tera's filters and conditional rendering!

templates/react/components/base.tsx
{% set component_name = name | pascal_case %}

---
to: components/{{ component_name }}.tsx
---

export function {{ component_name }}() {
return <div />;
}

Other changes

View the official release for a full list of changes.

  • Run reports (via --report) now include additional information, like the total duration, and estimated time savings.
  • Improved pnpm integration for Go/Rust binaries shipped in node modules.

What's next?

Expect the following in the v0.16 release!

  • Quality of life improvements for TypeScript.
  • Per-project overrides for language/tool versions.