-
Notifications
You must be signed in to change notification settings - Fork 554
Consider using npm module name instead of relative path in adapter config generated by commitizen init #469
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
Comments
Yeah, I found this to be quite confusing myself, PR welcome 👍 |
This change would be breaking. With that said I think we can support this by first checking if the path exists and if not then we see if the npm module exists in either the deps or dev deps. If it does then we can install it as a transient dependency first before running commit. @mickdekkers @LinusU Does that sound right? |
@jimthedev sounds interesting, what do you mean by "install it as a transient dependency"? |
@mickdekkers I mean we would run One tricky thing is that npm changed from --save being implied at a certain version of npm so we might have to detect their npm version. |
We are only talking about the generated config here, right? So I'm not sure if it would be considered breaking? I also don't think we would need to install any dependencies automatically? Although that would potentially also be nice! edit: We are only talking about changing this line, right? cz-cli/src/commitizen/adapter.js Line 38 in 07b92bc
|
@LinusU yeah, that's my proposed solution. I think you may be right; since it only applies to initialization and doesn't affect existing projects, it shouldn't be a breaking change. |
The setup instructions in the readme use the module name of the adapter (i.e.
cz-conventional-changelog
), but the actual config generated bycommitizen init
uses a relative path to the module:cz-cli/src/commitizen/adapter.js
Lines 35 to 41 in d5e2424
According to the readme:
One downside of using a relative path is that developers cannot use their global commitizen install to create a commit if they have not yet run
npm install
in the repo, because this results in an error:This change should fix the issue, although I'm not sure whether it would be considered breaking:
The text was updated successfully, but these errors were encountered: