Melos
🌋 A tool for managing Dart projects with multiple packages. With IntelliJ and Vscode IDE support. Supports automated versioning, changelogs & publishing via Conventional Commits.
Install / Use
/learn @invertase/MelosREADME
About
Splitting up large code bases into separate independently versioned packages is extremely useful for code sharing. However, making changes across many repositories is messy and difficult to track, and testing across repositories gets complicated really fast.
To solve these (and many other) problems, some projects will organize their code bases into multi-package repositories (sometimes called monorepos)
Melos is a tool that optimizes the workflow around managing multi-package repositories with git and Pub.
Migrate to Melos 7.x.x
Since the pub workspaces feature has
been released, Melos has been updated to rely on that, instead of creating
pubspec_overrides.yaml files and thus some migration is needed.
The main difference for migration is that the melos.yaml file no longer
exists, only the root pubspec.yaml file.
To migrate to Melos 7.x.x a few steps are needed:
- Start with running
melos cleanto remove all thepubspec_overrides.yamlentries and then continue with moving all your content. - Add
resolution: workspaceto all of your packages'pubspec.yamlfiles. - Add a list of all your packages to the root
pubspec.yamlfile, under theworkspacekey. - Move all the content from your
melos.yamlfile to the rootpubspec.yamlfile, under themeloskey. (Note that thepackageslist is no longer needed as it is replaced with theworkspacelist.)
[!NOTE] The
workspacelist doesn't support globs yet, so you have to list all your packages manually. Give a thumbs up here so that the team can prioritize this feature.
[!NOTE] Root packages migration: If your existing project uses the repository root as a package, you can enable
useRootAsPackage: truein the melos configuration to maintain this behavior, or restructure your project to move the main application to a subdirectory. See the Configuration Overview for details.
After the migration, your root pubspec.yaml file would now look something
like this:
name: my_workspace
publish_to: none
environment:
sdk: ^3.9.0
workspace:
- packages/helper
- packages/client_package
- packages/server_package
dev_dependencies:
melos: ^7.0.0-dev.9
melos:
# All of the content of your previous melos.yaml file
# (Except for the packages and name)
And this is what the pubspec.yaml file of a package would look like:
name: my_package
environment:
sdk: ^3.9.0
resolution: workspace
[!NOTE] You have to use Dart SDK 3.6.0 or newer to use pub workspaces.
Github Action
If you're planning on using Melos in your GitHub Actions workflows, you can use the Melos Action to run Melos commands, this action also supports automatic versioning and publishing directly from your workflows.
What does a Melos workspace look like?
A default file structure looks something like this:
my-melos-repo/
pubspec.yaml
packages/
package-1/
pubspec.yaml
package-2/
pubspec.yaml
The location of your packages needs be configured via the workspace
section in your root pubspec.yaml file, see the
pub workspaces documentation for more
information.
What can Melos do?
- 🔗 Link local packages in your workspace together without adding dependency overrides (achieved by pub workspaces).
- 📦 Automatically version, create changelogs and publish your packages using Conventional Commits.
- 📜 Pre-define advanced custom scripts for your workspace in your root
pubspec.yamlconfiguration to use viamelos run [scriptName]. Anyone contributing to your workspace can just runmelos runto be prompted to select a script from a list with descriptions of each script.- Scripts can even prompt to select a package to run against with pre-defined filters.
- ⚡ Execute commands across your packages easily with
melos exec -- <command here>with additional concurrency and fail-fast options.- Environment variables containing various information about the current package and the workspace are available in each execution.
- Can be combined with all package filters.
- 🎯 Many advanced package filtering options allowing you to target specific
packages or groups of packages in your workspace.
--no-private- Exclude private packages (
publish_to: none).
- Exclude private packages (
--[no-]published- Filter packages where the current local package version exists on pub.dev. Or "-no-published" to filter packages that have not had their current version published yet.
--[no-]nullsafety- Filter packages where the current local version uses a "nullsafety" prerelease preid. Or "-no-nullsafety" to filter packages where their current version does not have a "nullsafety" preid.
--[no-]flutter- Filter packages where the package depends on the Flutter SDK. Or "-no-flutter" to filter packages that do not depend on the Flutter SDK.
--scope=<glob>- Include only packages with names matching the given glob.
--ignore=<glob>- Exclude packages with names matching the given glob.
--diff=<ref>- Only include packages that have been changed since the specified
ref, e.g. a commit sha or git tag.
- Only include packages that have been changed since the specified
--dir-exists=<dirRelativeToPackageRoot>- Include only packages where a specific directory exists inside the package.
--file-exists=<fileRelativeToPackageRoot>- Include only packages where a specific file exists in the package.
--depends-on=<dependantPackageName>- Include only packages that depend on a specific package.
--no-depends-on=<noDependantPackageName>- Include only packages that don't depend on a specific package.
--include-dependencies- Expands the filtered list of packages to include those packages' transitive dependencies (ignoring filters).
--include-dependents- Expands the filtered list of packages to include those packages' transitive dependents (ignoring filters).
- ♨️ Advanced support for IntelliJ IDEs with automatic creation of
run configurations for workspace defined scripts and more
on workspace bootstrap.
- Integration with VS Code through an [extension][melos-code].
Getting Started
Go to the Getting Started page of the documentation to start using Melos.
Who is using Melos?
The following projects are using Melos:
- firebase/flutterfire
- Flame-Engine/Flame
- fluttercommunity/plus_plugins
- GetStream/stream-chat-flutter
- canonical/ubuntu-desktop-provision
- ubuntu/app-center
- 4itworks/opensource_qwkin_dart
- gql-dart/ferry
- cbl-dart/cbl-dart
- ema987/paddinger
- flutter-stripe/flutter_stripe
- danvick/flutter_form_builder
- kmartins/groveman
- flutternetwork/WiFiFlutter
- iapicca/yak_packages
- atsign-foundation/at_app
- sub6resources/flutter_html
- ferraridamiano/ConverterNOW
- rrifafauzikomara/youtube_video
- mobxjs/mobx.dart
- NetGlade/auto_mappr
- myConsciousness/atproto.dart
- GrowERP Flutter ERP
- mrverdant13/coverde
- ThexXTURBOXx/flutter_web_auth_2
- woltapp/wolt_modal_sheet
- [cfug/dio](https://gi
Related Skills
openhue
342.0kControl Philips Hue lights and scenes via the OpenHue CLI.
sag
342.0kElevenLabs text-to-speech with mac-style say UX.
weather
342.0kGet current weather and forecasts via wttr.in or Open-Meteo
tweakcc
1.5kCustomize Claude Code's system prompts, create custom toolsets, input pattern highlighters, themes/thinking verbs/spinners, customize input box & user message styling, support AGENTS.md, unlock private/unreleased features, and much more. Supports both native/npm installs on all platforms.
