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.13k stars 201 forks source link

request: extract `setSharedDependencies` as a separate melos command #682

Closed xsahil03x closed 6 months ago

xsahil03x commented 6 months ago

Is there an existing feature request for this?

Command

No response

Description

We are currently using the Shared Dependencies feature of the melos bs command to update our flutter environment and common dependencies btw our packages and it works fine but, running bs in a big monorepo such as ours which contains almost 300+ packages takes time to complete. It would be easier if it can be extracted as a separate melos command.

I am open to implementing it and would love to hear your views on this.

Thanks for all the great work.

Reasoning

Running melos bs just for setting shared dependencies takes a huge amount of time in a big monorepo.

spydon commented 6 months ago

I think just adding a flag to the bootstrap command would make sense, like --ignore-shared-dependencies or something like that, but other than that it sounds like a good idea.

xsahil03x commented 6 months ago

Sure, can you also suggest some alternate names for the command? melos setSharedDependencies is a bit long and it does not convey that it also updates the environment.

spydon commented 6 months ago

I think you misunderstood me? It shouldn't be a separate command, it should be a flag to bootstrap.

xsahil03x commented 6 months ago

I understood your point and it's a nice addition to the melos bs command but, I don't want to skip it during the bs command but to run it as a standalone command as the time-consuming part in the bs command is running pub_get in all the packages.

As a user, my requirement is to just update the environment and common dependency in my monorepo not actually bootstrap and link all the local dependencies in the project.

spydon commented 6 months ago

Ah, I misunderstood your original request. I thought you meant that it took too long to update the common dependencies meanwhile running bootstrap. I would still make it a flag to bootstrap though, since it belongs to that section, so maybe --skip-linking or --only-update-shared-dependencies (way too long...)

xsahil03x commented 6 months ago

A flag to bootstrap can solve this request but then it will be against the primary function of the bootstrap command.

As stated in the documentation -

Bootstrap Command

This command initializes the workspace, links local packages together and installs remaining package dependencies.

Bootstrapping has two primary functions:

1. Installing all package dependencies (internally using pub get).
2. Locally linking any packages together via path dependency overrides without having to edit your pubspec.yaml.

That's why my original proposal was to extract it into a separate command.

spydon commented 6 months ago

The documentation can be updated, but I don't think the use-case is common enough that we'd want to add a new command for it, especially since it is bound to bootstrap in the config already.

xsahil03x commented 6 months ago

I will try to come up with a PR tomorrow, Thanks