Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom filepath for .mookme.json #109

Open
DatStorm opened this issue May 2, 2023 · 1 comment
Open

Custom filepath for .mookme.json #109

DatStorm opened this issue May 2, 2023 · 1 comment

Comments

@DatStorm
Copy link

DatStorm commented May 2, 2023

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:

const config = new Config(git.rootDir);

Like:

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

)
.option('-a, --all', 'Run hooks for all packages', '')
.option('--from <from>', 'Starting git reference used to evaluate hooks to run', '')
.option('--to <to>', 'Ending git reference used to evaluate hooks to run', '')
.option('--args <args>', 'The arguments being passed to the hooks', '')
.action(async (opts: RunOptions) => {
debug('Running run command with options', opts);
const git = new GitToolkit();

@DatStorm DatStorm changed the title Custom filepath for .mook.json Custom filepath for .mookme.json May 3, 2023
@LMaxence
Copy link
Member

LMaxence commented May 7, 2023

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: #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:

  • 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants