mookme icon indicating copy to clipboard operation
mookme copied to clipboard

Custom filepath for `.mookme.json`

Open DatStorm opened this issue 1 year ago • 1 comments

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

DatStorm avatar May 02 '23 08:05 DatStorm

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/[email protected] run -t pre-commit --config-root ./packages

Missing elements:

  • The init command will not ask for this path yet, which means you will have to edit the invocation manually in your .git/hooks script files
  • This option expects a path to a folder holding the .mookme.json file, not the path of the .mookme.json file

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

LMaxence avatar May 07 '23 16:05 LMaxence