Consider using npm module name instead of relative path in adapter config generated by commitizen init
See original GitHub issueThe setup instructions in the readme use the module name of the adapter (i.e. cz-conventional-changelog
), but the actual config generated by commitizen init
uses a relative path to the module:
According to the readme:
commitizen.path is resolved via require.resolve and supports
- npm modules
- directories relative to process.cwd() containing an index.js file
- file base names relative to process.cwd() with js extension
- full relative file names
- absolute paths.
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:
Error: Could not resolve /Users/mickdekkers/Projects/foo/node_modules/cz-conventional-changelog.
Cannot find module '/Users/mickdekkers/Projects/foo/node_modules/cz-conventional-changelog'
This change should fix the issue, although I’m not sure whether it would be considered breaking:
let commitizenAdapterConfig = {
config: {
commitizen: {
- path: `./node_modules/${adapterNpmName}`
+ path: adapterNpmName
}
}
};
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:6 (4 by maintainers)
Top Results From Across the Web
my-commitizen - npm Package Health Analysis - Snyk
This just tells Commitizen which adapter we actually want our contributors to use when they try to commit to this repo. commitizen.path is ......
Read more >Integrate Commitizen with your node.js project
Installs the cz-conventional-changelog adapter npm module; Saves it to package.json's dependencies or devDependenciesAdds; The config.commitizen ...
Read more >CZ-cli: The Commitizen Command Line Utility - Morioh
Installs the cz-conventional-changelog adapter npm module ... names relative to process.cwd() with .js extension; full relative file names; absolute paths.
Read more >How to Migrate from Backbone to React, using Nodejs ...
Our plan is to create a temp app with allhe React app template code, then e'll copyover the package.json settings and load the...
Read more >npm ERR! code UNABLE_TO_GET_ISSUER_CERT_LOCALLY
A quick solution from the internet search was npm config set strict-ssl false , luckily it worked. But as a part of my...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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.
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?
https://github.com/commitizen/cz-cli/blob/07b92bcc9f1e82fcbd8226184ded771762af86da/src/commitizen/adapter.js#L38