question-mark
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.

@lerna/conventional-commits unable to use conventional-changelog-conventionalcommits

See original GitHub issue

Expected Behavior

Should be able to run

$ lerna version prerelease`

with the config

{
  "command": {
    "version": {
      "conventionalCommits": true,
      "changelogPreset": "conventional-changelog-conventionalcommits",
    }
  }
}

successfully.

Current Behavior

It terminates without any error message:

[munif:/<dir>/<repo>] master ± lerna version prerelease --yes --loglevel=silly -m "chore: msg"
lerna sill argv { _: [ 'version' ],
lerna sill argv   yes: true,
lerna sill argv   y: true,
lerna sill argv   loglevel: 'silly',
lerna sill argv   m: 'chore: msg',
lerna sill argv   message: 'chore: msg',
lerna sill argv   lernaVersion: '3.13.4',
lerna sill argv   '$0': 'node_modules/.bin/lerna',
lerna sill argv   bump: 'prerelease' }
lerna notice cli v3.13.4
lerna verb rootPath /<dir>/<repo>
lerna info versioning independent
lerna sill isAnythingCommitted 
lerna verb isAnythingCommitted 1
lerna sill currentBranch 
lerna verb currentBranch master
lerna sill hasTags 
lerna verb hasTags false
lerna info Assuming all packages changed
lerna verb updated @<scope>/<pkg1>
lerna verb updated @<scope>/<pkg2>
lerna verb updated @<scope>/<pkg3>
lerna info version Skipping unversioned private package "@<scope>/<pkg3>"
lerna verb git-describe undefined => "5b18165"
lerna sill git-describe parsed => {"refCount":"7","sha":"5b18165","isDirty":false}
lerna sill batched [ PackageGraphNode {
lerna sill batched     name: '@<scope>/<pkg1>',
lerna sill batched     externalDependencies: Map { '<dep>' => [Object] },
lerna sill batched     localDependencies: Map {},
lerna sill batched     localDependents: Map { '@<scope>/<pkg2>' => [PackageGraphNode] } } ]
lerna sill batched [ PackageGraphNode {
lerna sill batched     name: '@<scope>/<pkg2>',
lerna sill batched     externalDependencies: Map {},
lerna sill batched     localDependencies: Map {},
lerna sill batched     localDependents: Map {} } ]

Changes:
 - @<scope>/<pkg1>: 0.0.0 => 0.0.1-alpha.0
 - @<scope>/<pkg2>: 0.0.0 => 0.0.1-alpha.0

lerna info auto-confirmed 
lerna info execute Skipping git push
lerna info execute Skipping GitHub releases
lerna sill lifecycle No script for "preversion" in "<repo>", continuing
lerna sill lifecycle No script for "preversion" in "@<scope>/<pkg1>", continuing
lerna sill lifecycle No script for "version" in "@<scope>/<pkg1>", continuing
lerna sill independent for @<scope>/<pkg1> at /<dir>/<repo>/packages/<pkg1>
lerna verb getChangelogConfig using preset "conventional-changelog-conventionalcommits"
lerna sill npa { type: 'tag',
lerna sill npa   registry: true,
lerna sill npa   where: undefined,
lerna sill npa   raw: 'conventional-changelog-conventionalcommits',
lerna sill npa   name: 'conventional-changelog-conventionalcommits',
lerna sill npa   escapedName: 'conventional-changelog-conventionalcommits',
lerna sill npa   scope: undefined,
lerna sill npa   rawSpec: '',
lerna sill npa   saveSpec: null,
lerna sill npa   fetchSpec: 'latest',
lerna sill npa   gitRange: undefined,
lerna sill npa   gitCommittish: undefined,
lerna sill npa   hosted: undefined }
lerna verb getChangelogConfig Attempting to resolve preset "conventional-changelog-conventionalcommits"
lerna info getChangelogConfig Successfully resolved preset "conventional-changelog-conventionalcommits"

It just bumps the version on package.json, does nothing else.

Possible Solution

Related to this commit: https://github.com/conventional-changelog/conventional-changelog/commit/f2fb240

Specially this file: https://github.com/conventional-changelog/conventional-changelog/commit/f2fb240#diff-b79ed7f48102a253b716fdde8b9fbcb7

It introduces some new logic to load the presets. But lerna probably uses it’s own custom implementation. 🤔

Context

Wanted to use conventional-changelog-conventionalcommits as command.version.changelogPreset.

Executable Version
lerna --version 3.13, 3.14, 3.15

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
jccrcommented, Feb 11, 2020

If I get rid of this:

https://github.com/lerna/lerna/blob/bb048cb306b5cfcb039aa98f667cf3751cf0ad20/core/conventional-commits/lib/update-changelog.js#L22

it makes it work. Why is lerna trying to ruin the config output by conventional-changelog itself?

It’s true… I’m not getting the expected output from the convetionalcommits preset until I force the "old" preset API branch to execute.

I’m getting some changelog output, but it’s not presented with the proper sections/headings. I’m not seeing ### ⚠ BREAKING CHANGES or ### Features or ### Bug Fixes or ### Code Refactoring. I’m just seeing a flat (naive) list of commits.

Read more comments on GitHub >

github_iconTop Results From Across the Web

@lerna/version - npm
When using conventional-commits , do not generate any CHANGELOG.md files. NOTE: When using this option, you cannot pass --create-release . --no-commit-hooks.
Read more >
Newest 'conventional-commits' Questions - Stack Overflow
When it comes to generate versions using conventional commits from a repo that contains ... one may conclude that: changelog version entry can't...
Read more >
JS monorepos in prod 3: commit enforcement and changelog ...
lerna version --conventional-commits info cli using local version of ... Commits](https://conventionalcommits.org) for commit guidelines.
Read more >
conventional-changelog-core | Yarn - Package Manager
conventional -changelog core ... Or use one of the plugins if you are already using the tool: ... See Conventional Commits for commit...
Read more >
How To Automatically Generate A Helpful Changelog From ...
Creating a changelog is a usual task if a new software version is going to be ... So I recommend writing commit messages...
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 Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found