multipack icon indicating copy to clipboard operation
multipack copied to clipboard

[discussion] Find a way to coordinate / share / merge with Melos

Open Salakar opened this issue 4 years ago • 13 comments
trafficstars

Hey 👋

I came across multipack today whilst searching on pub.dev for monorepo tools.

This is purely speculation, but I thought it might be worth at least discussing if you'd be interested in collaboration here; I'm the author of Melos and as far as I can see Melos mostly covers the design goals of multipack so this may be an opportunity to reduce maintenance burdens for both our projects by collaborating.

Thoughts? Happy to answer any questions, I'm also on the Discord server (Salakar#1337) should you wish to chat that way.

Salakar avatar Jan 28 '21 02:01 Salakar

Hey @Salakar!

I am more then happy to see multipack disappear. Especially if you can help us adopt melos.

That said, I am a bit worried about "Conventional Commits". I wonder if that's mandatory with melos.

klavs avatar Feb 12 '21 16:02 klavs

I am more then happy to see multipack disappear. Especially if you can help us adopt melos.

Happy to help

That said, I am a bit worried about "Conventional Commits". I wonder if that's mandatory with melos.

Nope it's not mandatory, only need to use it if you wanted automated version bumping and change logs.

Salakar avatar Feb 12 '21 16:02 Salakar

Let me play around with melos for a bit.

Meanwhile, you can see how we use multipack here:

  • https://github.com/gql-dart/gql/blob/master/.github/workflows/dart.yml
  • https://github.com/gql-dart/gql/blob/master/.github/workflows/publish_alpha.yml
  • https://github.com/gql-dart/ferry/blob/master/.github/workflows/dart.yml

klavs avatar Feb 12 '21 16:02 klavs

@Salakar I got stuck pretty early. https://github.com/gql-dart/gql/pull/192

melos bs returns

melos bootstrap
   └> /media/storage/WebstormProjects/klavs/gql

Running "pub get" in workspace packages...

Linking workspace packages...
  > SUCCESS

Generating IntelliJ IDE files...
  > SUCCESS

 -> 0 plugins bootstrapped

klavs avatar Feb 12 '21 17:02 klavs

Left a review comment on the PR, patterns needed tweaking slightly;

image

Salakar avatar Feb 12 '21 17:02 Salakar

Based on the readme also here's some quick info/points:


Link all local packages by running

multipack pubspec override

Get all packages by running

multipack pub get

Covered by melos bootstrap.


Clean up the pubspec file before publishing

multipack pubspec clean

Covered by melos clean, you could also add a postclean hook script definition to melos.yaml scripts that melos clean will automatically run after it's done it's own cleaning if you wanted to clean anything additional, e.g.: https://github.com/FirebaseExtended/flutterfire/blob/master/melos.yaml#L169-L171

Salakar avatar Feb 12 '21 17:02 Salakar

I'd also recommend committing this for any of the devs to this project using Vscode: https://github.com/FirebaseExtended/flutterfire/blob/master/.vscode/settings.json

And for IntelliJ, making sure you have these git ignores:

*.iml
.idea/

Salakar avatar Feb 12 '21 17:02 Salakar

Thanks!

One thing I had implemented in multipack was listing the packages as graphviz dotfile. https://github.com/gql-dart/multipack/blob/master/lib/commands/info.dart

It gives me a quick overview of the monorepo: https://github.com/gql-dart/gql/blob/master/docs/gql.svg It's not the prettiest, but it gets the job done.

The implementation is very simple. Are you open to adding it to melos, let's say, as melos list --gviz?

klavs avatar Feb 12 '21 18:02 klavs

The implementation is very simple. Are you open to adding it to melos, let's say, as melos list --gviz?

Yes definitely :)

Salakar avatar Feb 12 '21 18:02 Salakar

One of the design goals for multipack was not requiring flutter where possible.

With melos it seems that I have to do melos --scope $PACKAGE bootstrap where $PACKAGE is a dart package to avoid melos crashing because flutter is not available.

https://github.com/gql-dart/gql/pull/192/checks?check_run_id=1889415286

klavs avatar Feb 12 '21 18:02 klavs

One of the design goals for multipack was not requiring flutter where possible.

With melos it seems that I have to do melos --scope $PACKAGE bootstrap where $PACKAGE is a dart package to avoid melos crashing because flutter is not available.

Melos auto-detects if flutter is being depended on by any of your packages in the workspace, if any package does depend on it then it switches to to using flutter pub get for pub installs, I was under the impression if you depend on flutter packages you had to use flutter pub get instead - I could have made a wrong assumption or perhaps a broad one - not sure. If you need this to be more flexible then we can change this on Melos itself

Salakar avatar Feb 12 '21 21:02 Salakar

I was under the impression if you depend on flutter packages you had to use flutter pub get instead - I could have made a wrong assumption or perhaps a broad one - not sure.

Let me list some examples to consider.

We can take https://github.com/gql-dart/gql as en example. It consists of Dart packages and a single gql_example_flutter package which is there just as an example that shows how all the those packages can be used in flutter as well.

Additionally, contributors might have access to a device which for whatever reason does not have flutter installed. They should be able to contribute to the part of the monorepo which does not require flutter. (I actually had this play out when I wanted to code using a laptop I had available at the time. With limited connectivity, downloading dart is quicker than downloading flutter)

Another use case is actually a CI system which could get away with lighter google/dart:latest in some cases.

For multipack I created uni which can detect both system restrictions (available binaries) and package restrictions.

klavs avatar Feb 12 '21 22:02 klavs

I've migrated the ferry packages to use melos. So far, everything is working well.

smkhalsa avatar Mar 25 '21 10:03 smkhalsa