mateodelnorte / meta

tool for turning many repos into a meta repo. why choose many repos or a monolithic repo, when you can have both with a meta repo?
MIT License
2.03k stars 95 forks source link

Allow semi-permanent selection of a subset of projects #282

Open klarkent opened 2 years ago

klarkent commented 2 years ago

🚀 Feature Proposal

Add the possibility to select a subset of the projects defined in .meta so that commands executed have an effect only on those.

Motivation

As a maintainer/developer of 50+ microservices, I have frequently the need to select and work only on a subset of those based on criteria X. This is a temporary filter that lasts only for the time needed to implement a feature, for example.

Example

In a meta-repository, the user could create a .meta-filter file that contains the projects to work on, either separated by a comma or new-line. Once this file is present, meta will apply all commands issued only to this subset of projects so that, for example, I can run npm install --save my-updated-library@new-version only in the projects I know need that update. Then I can commit and open a Merge Request via other commands for those repositories only. Once I am done I can remove the file and meta behaves normally.

patrickleet commented 2 years ago

We've talked about something similar a few times.

I have frequently the need to select and work only on a subset of those based on criteria X. This is a temporary filter that lasts only for the time needed to implement a feature, for example.

FWIW, this can be accomplished with an environment variable in a single shell

export PROJECTS=one,two,three
meta git status --include-only=$PROJECTS

If you're ok with changing the .meta file with current projects (which would be committed to git) may I suggest a workaround that you can use to accomplish this today?

Makefile
PROJECTS?=one,two,three
COMMAND?=git status

meta:
    meta $(COMMAND) --include-only=$(PROJECTS)
> COMMAND="exec pwd" make meta 
# command that's run: meta exec pwd --include-only=one,two,three

or

PROJECTS=one COMMAND="exec pwd" make meta

And when you want to change the default set you could update that in the Makefile.

I agree the syntax could be nicer by including it in meta, but I think it probably accomplishes the task.

patrickleet commented 2 years ago

you can also execute things inline

meta exec "npm install --save my-updated-library@new-version" --include-only=$(sh get-node-projects.sh)

I've done something like this in the past - created a script that returns each folder name that contains package.json - you could even grep for a particular package.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

alajmo commented 2 years ago

I did some similar work for https://github.com/alajmo/mani, allowing me to filter on tags, paths, and current working directory, so perhaps you add tags to each project to allow really granular selections.

patrickleet commented 2 years ago

yea I think tags would be a good solution as well

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.