Thinkmill / manypkg

☔️ An umbrella for your monorepo
MIT License
884 stars 48 forks source link

[`run` command] Add a way to differentiate between packages when one package name is a substring of another #82

Closed with-heart closed 3 years ago

with-heart commented 3 years ago

Hi there! Thanks for the great tool. We're using it as part of our tools for managing https://github.com/chakra-ui/chakra-ui to great effect!

One of the problems we've run into is that we have packages where one package name is a substring of another, and as far as I can tell, there isn't a way to force manypkg to target the substring name. The packages are named @chakra-ui/theme and @chakra-ui/theme-tools, so we're stuck without a way to target @chakra-ui/theme.

The README notes that this can be the case with an example of the pkg and package directories not being unique, but in this case, the only way around this would be for us to rename one of the packages, since we end up with the same issue in their directory names: packages/theme/packages/theme-tools.

My first thought was to treat the "partial package name or directory" argument as a regex string, where we'd compare the package name/directory using match instead of includes. This should allow users to continue using run as they did previously, but would also allow us to do something like manypkg run theme$ to target only @chakra-ui/theme.

emmatown commented 3 years ago

I think the ideal thing to do would be to treat exact matches as unambiguous, happy to accept a PR for that. I think regexes could get confusing and strange because of having to escape things.