feat: use cosmiconfig to load config by pmcelhaney · Pull Request #888 · commitizen/cz-cli
In theory with this change commitizen will work when it's run from a subdirectory.
I haven't fully tested yet but I want to get the WIP out there and get some eyes on it.
fixes #773
it should now be able to find the config file from a subdirectory fixes commitizen#773
| var configs = ['.czrc', '.cz.json', 'package.json']; | ||
| async function load(config, cwd) { | ||
| const explorer = cosmiconfig("commitizen", { | ||
| packageProp: "config.commitizen", |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look for the config.commitizen property in package.json. Does it also need to look for a commitizen property at the root?
| const explorer = cosmiconfig("commitizen", { | ||
| packageProp: "config.commitizen", | ||
| searchPlaces: [".czrc", ".cz.json", "package.json"], | ||
| searchFrom: cwd, |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By default, this is the current working directory. Not sure what the cwd argument represents here (maybe it's just for tests?) so I made this option explicit just in case.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters