Escape-Technologies / mookme

A pre-commit tool designed for monorepos.
MIT License
102 stars 13 forks source link

Custom filepath for `.mookme.json` #109

Open DatStorm opened 1 year ago

DatStorm commented 1 year ago

Hey.

First of all thanks for a great tool!

We would at our project like to keep the root of the monorepo clean s.t. the .mookme.json is not stored in the root.

An idea to quickly solve this is to add another option to the run command that specifies the path instead of the git.rootDir as shown in the code:

https://github.com/Escape-Technologies/mookme/blob/3be637d6a5d6d9338a45d09e0cec10965fb63306/packages/mookme/src/commands/run.ts#L35

Like:

--path=tools/mookme/.mookme.json

https://github.com/Escape-Technologies/mookme/blob/3be637d6a5d6d9338a45d09e0cec10965fb63306/packages/mookme/src/commands/run.ts#L25-L33

LMaxence commented 1 year ago

Hello ! Many thanks for the feedback :)

I added an option providing a similar option as you requested, with a single difference is that instead of providing the path to the .mookme.json file, you have to provide the path to the folder where the .mookme.json file lives in.

The reason for this change is that the current configuration system leverages the folder path instead of the config path, and I did not want to change that system too deeply. If it remains a problem, let me know I'll do the necessary.

Here is the PR: https://github.com/Escape-Technologies/mookme/pull/110

You can also already give it a try leveraging the 2.4.0 beta release:

# An example where the config is at path <monorepo-root-dir>/packages/.mookme.json
# It should probably work with an absolute path as well
npx @escape.tech/mookme@2.4.0-beta.1 run -t pre-commit --config-root ./packages

Missing elements:

Let me know if you need me to add anything, I'll merge the MR soon so that the beta documentation features this option well, and I'll publish the 2.4.0 version next week