melos.yaml
Every project requires a melos.yaml
project in the root. The below outlines
all of the specific fields and their purpose.
name
The name of this project, using for display purposes within IO environments and IDEs.
name: My Awesome Project
repository
The URL of where the git repository, which contains this project, is centraly hosted.
Supported hosts:
- GitHub
repository: https://github.com/invertase/melos
packages
A list of local packages Melos will use to execute commands against. The list can be of specific paths or a glob pattern expansion format.
packages:
- packages/**
- ext/some_other_package
If you only have a single package, that you want to use Melos for and melos.yaml
is at the root of
that package, use the single directory glob pattern (the quotes are important):
packages:
- '*'
scripts
A list of scripts, that can be executed with melos run
or will be executed before/after some
specific melos commands.
With the simple syntax, only the name of the srcript and the command to execute needs to be specified:
scripts:
hello: echo 'Hello World'
The extends syntax allows for a more complex configuration of a script:
scripts:
hello:
name: hey
description: 'Greet the world'
run: echo '$GREETING World'
env:
GREETING: 'Hey'
Hooks
Certain Melos commands support running scripts before and after the command is executed.
Before hooks have the same name as the command. Post hooks have the name of the command prefixed with post
:
scripts:
bootstrap: echo `bootstrap command is running...`
postbootstrap: echo `bootstrap command is done`
Currently, the following Melos commands support hooks:
bootstrap
clean
version
scripts/*/select-package
The melos exec
command allows you to execute a command for multiple packages. When used
in a script, you can declare filter options in the select-packages
section.
The hello_flutter
script below is only executed in Flutter packages:
scripts:
hello_flutter:
run: melos exec -- "echo 'Hello $(dirname $PWD)'"
select-package:
flutter: true
See the global options for a list of supported filters.
command/version/message
A template for the commit message, that is generated by melos version
.
Templates must use mustache syntax and have the following variables available:
new_package_versions
: A list of the versioned packages and their new versions.
The default is:
chore(release): publish packages
{new_package_versions}
command:
version:
message: |
chore: cut package releases 🎉
{new_package_versions}
command/version/linkToCommits
Whether to add links to commits in the CHANGELOG.md, that is generated by melos version
.
Enabling this option, requries repository
to be specified.
command:
version:
linkToCommits: true