Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Consider using npm module name instead of relative path in adapter config generated by commitizen init

See original GitHub issue

The 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:open
  • Created 6 years ago
  • Reactions:1
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

mickdekkerscommented, Mar 5, 2018

@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.

LinusUcommented, Mar 2, 2018

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!


We are only talking about changing this line, right?

Read more comments on GitHub >

github_iconTop 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 >
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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found