invertase / melos

🌋 A tool for managing Dart projects with multiple packages. With IntelliJ and Vscode IDE support. Supports automated versioning, changelogs & publishing via Conventional Commits.
https://melos.invertase.dev/~melos-latest
Apache License 2.0
1.19k stars 206 forks source link

Does not work very well with git references #157

Closed danilofuchs closed 3 years ago

danilofuchs commented 3 years ago

Context

We are using Melos to organize our private Flutter components monorepo.

Dependant projects use git references to securely obtain the packages like this:

dependencies:
  my_private_package:
    git:
      url: git@github.my_org/my_monorepo.git
      path: packages/my_package
      ref: my_package-v1.0.0

Problem

When a package depends on another internal package, we cannot set a path reference as any external project which depends on the root package will not be able to resolve the paths.

So, we decided to set git references on all internal packages, expecting melos to correctly symlink the packages for us (as they do for pub.dev packages). This would make it transparent to both developers (library and app developers).

However, when we run melos bootstrap, melos replaces the git references in the pubspec.lock file with path references:

Screen Shot 2021-08-11 at 12 26 17

This works for the library developer, but breaks for the app developer.

Workaround

To avoid this issue, we are considering not commiting pubspec.lock on our packages, the app developers should lock their dependencies instead.

danilofuchs commented 3 years ago

I just read the documentation and Dart does not recommend commiting pubspec.lock for packages anyway, so this is a non-issue.

However, I do believe Melos should be aware that git references is an important thing for large organizations

Salakar commented 3 years ago

melos replaces the git references in the pubspec.lock file with path references:

This is because that package exists locally in your workspace - this is the core design of how melos functions. You may have some luck with melos bootstrap --ignore="ebanx_logger"