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.17k stars 206 forks source link

request: filter for supported platforms from pubspec #601

Open benthillerkus opened 12 months ago

benthillerkus commented 12 months ago

Is there an existing feature request for this?

Command

melos exec --supports-platform=""

Description

As a developer, I want to run melos scripts only on a subset of packages, maybe because I'm on a certain platform, or only want to test for a certain platform.

The way to support that would be through Melos filtering ability.

The --supports-platform filter would filter for packages that support the current platform melos is being invoked on. Additionally you can specify the platforms you require via a list like so: --supports-platform="macos, linux".

Which platform a package supports would be based on the platforms: field in pubspec.yaml. If the field is not set, it is assumed that the package supports all platforms.

Reasoning

In CI I want to run all tests on Linux, besides ones on packages that don't support Linux (or in my case specifically only support macos)

Additional context and comments

No response

Salakar commented 11 months ago

Flutter packages have a named platform folder convention already so you can already do this via --dir-exists, e.g.

melos list --dir-exists="macos" --dir-exists="linux"

This is what we do on the FlutterFire repository to filter platforms.