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

[Config loader] check if config key is in package.json before accepting it as a config file #975

Open
simrobin opened this issue Jun 12, 2023 · 1 comment · May be fixed by #987
Open

[Config loader] check if config key is in package.json before accepting it as a config file #975

simrobin opened this issue Jun 12, 2023 · 1 comment · May be fixed by #987

Comments

@simrobin
Copy link

Hello,

I'm working on a monorepo with backend and frontend and a .czrc at the directory's root to enforce commit rules with commitizen.

All frontend-related files are in a subdirectory, including the package.json file at different filesystem levels.

My issue: In a subdirectory with a package.json between pwd and git repository root, commitizen seems to acknowledge this file as a configuration file despite the lack of config.commitizen key.

Fix proposal: There seems to be a mechanism to check the package.json has a commitizen configuration, but it is commented:

findup(configs, { nocase: true, cwd: directory }, function (configPath) {
if (path.basename(configPath) === 'package.json') {
// return !!this.getContent(configPath);
}
return true;
})

I tried to uncomment it in a local version of commitizen, and it works as expected.
Would it be possible to uncomment it or does it have unwanted side effects?

@simrobin
Copy link
Author

For now, I'm bypassing this problem with a symlink of .czrc in my home directory, which prevails on repository config files:

ln -s /path/to/my/repository/.czrc ~/.czrc

But it's not perfect and it only works for me 🙂.

@levi2ki levi2ki linked a pull request Nov 7, 2023 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant