Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: make run script use melos_packages env variable scope #640

Conversation

Pavel-Sulimau
Copy link
Contributor

@Pavel-Sulimau Pavel-Sulimau commented Jan 29, 2024

Description

There are 2 key changes here:

  • melos run command now also takes MELOS_PACKAGES value into account.
  • MELOS_PACKAGES is not used instead of filters, but it adds or replaces the scope in the PackageFilters.

Considering the current definition of MELOS_PACKAGES that says 'This bypasses all filtering flags if defined.' the current change looks like a breaking change to me.

A bit more context:
We have quite a big monorepo (100+ packages) on my current project. In our CI pipeline, we trigger the CI checks for certain subfolders/packages (based on which areas are affected by a PR).
We already have this kind of setup running with Melos 2.9, but it was achieved by different means, and we'd love to migrate to the latest version of Melos.
With Melos 4.0 it looks like the proposed change to MELOS_PACKAGES is the easiest way to achieve the granularity desired in our case.

Type of Change

  • feat -- New feature (non-breaking change which adds functionality)
  • 🛠️ fix -- Bug fix (non-breaking change which fixes an issue)
  • ! -- Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 refactor -- Code refactor
  • ci -- Build configuration change
  • 📝 docs -- Documentation
  • 🗑️ chore -- Chore

@CLAassistant
Copy link

CLAassistant commented Jan 29, 2024

CLA assistant check
All committers have signed the CLA.

@Pavel-Sulimau Pavel-Sulimau marked this pull request as ready for review January 29, 2024 19:52
@Pavel-Sulimau
Copy link
Contributor Author

Hey @Salakar, @spydon,
looking forward to your feedback on the current suggestion.

Copy link
Collaborator

@spydon spydon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall it looks good to me, I've never used that way of filtering though so I might have overlooked something

packages/melos/lib/src/commands/run.dart Outdated Show resolved Hide resolved
packages/melos/lib/src/commands/runner.dart Outdated Show resolved Hide resolved
packages/melos/lib/src/package.dart Outdated Show resolved Hide resolved
Copy link
Collaborator

@spydon spydon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm! The only thing missing is an update about this behaviour in the docs

@Pavel-Sulimau
Copy link
Contributor Author

Pavel-Sulimau commented Feb 4, 2024

Lgtm! The only thing missing is an update about this behaviour in the docs

Thanks for the feedback, I gave this an update as well!
I couldn't preview the change locally though because of invertase/docs.page#262, but I believe we should be good as the doc change was a tiny one and as it should be previewable in the PR itself.

I'm not sure If I should also update https://melos.invertase.dev/guides/migrations section and if it should be part of this PR.

@spydon, let me know please, if there is anything else preventing the PR from being merged.

@spydon
Copy link
Collaborator

spydon commented Feb 5, 2024

@spydon, let me know please, if there is anything else preventing the PR from being merged.

Just checking if there is anyone else that would like to review this, otherwise I'll merge it tonight. :)

@spydon spydon merged commit e12ff57 into invertase:main Feb 6, 2024
11 checks passed
@spydon
Copy link
Collaborator

spydon commented Feb 6, 2024

@Pavel-Sulimau thanks for your contribution, it's now released in Melos 4.1.0 :)

@xsahil03x
Copy link
Contributor

Hey @Pavel-Sulimau, can you share your approach for solving your use-case that you mentioned above? We also have the same use-case. Are you using --diff for achieving it? In our case it's not working correctly anymore due to this issue #557

Thanks

@Pavel-Sulimau
Copy link
Contributor Author

Hey @xsahil03x, sorry for the late response.
We're using a customized way (some scripting in Github Actions) to detect which packages (and their dependencies) are affected by changes in a Pull Request, then we set a list of names of the affected packages to MELOS_PACKAGES env variable to scope the CI checks.
But we're going to migrate from that solution to using the melos-dff!
I'm also happy to see the diff functionality was recently fixed/improved.

@Pavel-Sulimau Pavel-Sulimau deleted the feature/make-run-script-use-melos_packages-env-variable-scope branch April 19, 2024 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants