Skip to main content

.moon/project.yml

The .moon/project.yml file configures file groups and tasks that are inherited by every project in the workspace. Projects can override or merge with these settings within their respective moon.yml.

extendsv0.4

string

Defines an external .moon/project.yml to extend and inherit settings from. Perfect for reusability and sharing configuration across repositories and projects. When defined, this setting must be an HTTPS URL or relative file system path that points to a valid YAML document!

.moon/workspace.yml
extends: 'https://raw.githubusercontent.com/organization/repository/master/.moon/project.yml'
caution

For map-based settings, fileGroups and tasks, entries from both the extended configuration and local configuration are merged into a new map, with the values of the local taking precedence. Map values are not deep merged!

fileGroups

Record<string, string[]>

For more information on file group configuration, refer to the fileGroups section in the moon.yml doc.

Defines file groups that will be inherited by all projects, and also enables enforcement of organizational patterns and file locations. For example, encourage all projects to place source files in a src folder, and all test files in tests.

.moon/project.yml
fileGroups:
configs:
- '*.config.{js,cjs,mjs}'
- '*.json'
sources:
- 'src/**/*'
- 'types/**/*'
tests:
- 'tests/**/*'
- '**/__tests__/**/*'
assets:
- 'assets/**/*'
- 'images/**/*'
- 'static/**/*'
- '**/*.{scss,css}'

File paths and globs used within a file group are relative from the inherited project's root, and not the workspace.

tasks

Record<string, TaskConfig>

For more information on task configuration, refer to the tasks section in the moon.yml doc.

As mentioned in the link above, tasks are actions that are ran within the context of a project, and commonly wrap an npm binary or system command. For most workspaces, every project should have linting, type-checking, testing, code formatting, so on and so forth. To reduce the amount of boilerplate that every project would require, this setting offers the ability to define tasks that are inherited by all projects within the workspace, but can also be overridden per project.

.moon/project.yml
tasks:
format:
command: 'prettier --check .'

lint:
command: 'eslint --no-error-on-unmatched-pattern .'

test:
command: 'jest --passWithNoTests'

typecheck:
command: 'tsc --build'

Relative file paths and globs used within a task are relative from the inherited project's root, and not the workspace.