Melos - now with pub workspaces

Hello folks,
if you’re using Melos, we would love to get some feedback on the new pre-release (v7.0.0-dev.3) which is using pub workspaces.

Migration instructions:
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 to 6.3.0 and earlier versions is that:

  1. There is no longer a melos.yaml file, only the root pubspec.yaml
  2. You now have to add resolution: workspace to all of your packages’ pubspec.yaml files.
  3. You now have to add a list of all your packages to the root pubspec.yaml file.

After the migration your root pubspec.yaml file would now look something like this:

name: my_workspace
publish_to: none
environment:
  sdk: ^3.6.0
workspace:
  - packages/helper
  - packages/client_package
  - packages/server_package
dev_dependencies:
  melos: ^7.0.0

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.6.0
resolution: workspace

[!NOTE]
You have to use Dart SDK 3.6.0 or newer to use pub workspaces.

4 Likes

Read more on that blog: Pub Workspaces

1 Like