Escape-Technologies / mookme

A pre-commit tool designed for monorepos.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Make maxDepth configurable

tiagodj opened this issue · comments

Hi,

My project folders in the monorepo sometimes are under 4 levels of directories, and because of that Mookme doesn't find them.

Would it be possible to make maxDepth parameter configurable?

extractPackagesPaths(depth = 0, maxDepth = 3, source?: string): string[] {

Thank you!

Sure ! It can be configurable, I would leave it as a configuration option (stored in the .mookme.json), and make it default to the current value :)

The recursive search is computationally expensive so I've set a hard limit on this, but I knew the time when I would be asked this would come 😅

If you're willing to contribute, this can be a good first issue, I'll provide a technical strategy asap !

Mookme v1.* worked like this, so it had the advantage you mention (it knows where to look packages for), but it had a few drawbacks:

The initialization was a lot worse than it is right now (there was a very looooooooong prompter-based form to let you enter relatively easily the folders that are supposed to hold the packages). You can try to install and init a project using mookme@1.something to see the difference between 1 & 2 ;)

Also, the behaviour was "configuration" based and not "reality" based which was a bit hard to debug sometimes.

These two are the major reasons that lead me to automatize this part of the execution

Hello @tiagodj !

I will leave this issue stalling, for the reason that I will implement the matching using glob-pattern matching. It will have the benefits that I don't have an algorithm to maintain for this, will work exponentially faster, and will be very unsensitive to the search depth.

I expect this change to solve your issue.