feat: use cosmiconfig to load config#888
Open
pmcelhaney wants to merge 1 commit intocommitizen:masterfrom
Open
feat: use cosmiconfig to load config#888pmcelhaney wants to merge 1 commit intocommitizen:masterfrom
pmcelhaney wants to merge 1 commit intocommitizen:masterfrom
Conversation
it should now be able to find the config file from a subdirectory fixes commitizen#773
afb1a82 to
6ad54aa
Compare
pmcelhaney
commented
Jan 5, 2022
| var configs = ['.czrc', '.cz.json', 'package.json']; | ||
| async function load(config, cwd) { | ||
| const explorer = cosmiconfig("commitizen", { | ||
| packageProp: "config.commitizen", |
Contributor
Author
There was a problem hiding this comment.
Look for the config.commitizen property in package.json. Does it also need to look for a commitizen property at the root?
pmcelhaney
commented
Jan 5, 2022
| const explorer = cosmiconfig("commitizen", { | ||
| packageProp: "config.commitizen", | ||
| searchPlaces: [".czrc", ".cz.json", "package.json"], | ||
| searchFrom: cwd, |
Contributor
Author
There was a problem hiding this comment.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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