Conversation

pmcelhaney

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",
Copy link
Contributor Author

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,
Copy link
Contributor Author

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.

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

Successfully merging this pull request may close these issues.

Use cosmiconfig so users can use whatever config file extension they want
@pmcelhaney