Skip to content
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

Changelog preset is not correctly picked up #1896

Closed
sebald opened this issue Jan 28, 2019 · 5 comments
Closed

Changelog preset is not correctly picked up #1896

sebald opened this issue Jan 28, 2019 · 5 comments

Comments

@sebald
Copy link

sebald commented Jan 28, 2019

Expected Behavior

Calling lerna version --conventional-commits --changelog-preset <preset> should use the given preset.

In my case conventional-changelog-emojis

EDIT: I found the issue, but I am not sure this is an issue with lerna or conventional-changelog-core. Since both syntax (see "Possible Solution") seem to be supported when using the conventional-changelog-cli.

Please just close this, if you want. Sorry for bothering!

Current Behavior

The preset is picked up correctly:

lerna info getChangelogConfig Auto-prefixing conventional-commits preset 'emojis'

But the printed changelog does not use the chosen (or any preset) and prints like this:

# Change Log

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## 0.1.0 (2019-01-28)

- ✨ Feat 1 ([<sha>](<url>))
- 🛠 Config ([<sha>](<url>))

Using conventional changelog directly works, tough. Running conventional-changelog -p emojis -i CHANGELOG.md -s -r 0 will generate the correct changelog (in the root directory).

Possible Solution

Digged into get-changelog-config.js but debugging is kinda hard, because of conventional-changelog only passing a function. But the transform function of the custom preset is never called.

Seems like lerna "can not" resolve the "bloody Q.all".

Basically it is this syntax (e.g. ember preset):
https://github.com/conventional-changelog/conventional-changelog/blob/943542f3b2342bb5933d84847fb19b727c607df0/packages/conventional-changelog-ember/index.js#L10-L15

Versus this syntax (angular preset):
https://github.com/conventional-changelog/conventional-changelog/blob/943542f3b2342bb5933d84847fb19b727c607df0/packages/conventional-changelog-angular/index.js#L8-L11

The angular preset syntax works with lerna! 🙂

Steps to Reproduce (for bugs)

  1. Setup monorepo with lerna
  2. Change a file and add commit \w message "✨ Feat 1"
  3. Change a file and add commit \w message "🛠 Config"
  4. lerna version --conventional-commits --changelog-preset emojis
lerna.json

{
  "version": "0.1.0",
  "npmClient": "yarn",
  "useWorkspaces": true,
  "command": {
    "version": {
      "conventionalCommits": true,
      "changelogPreset": "emojis",
      "exact": true,
      "message": "🔖 %s"
    }
  }
}
<!-- Please paste your `lerna.json` here -->

Context

Your Environment

Executable Version
lerna --version 3.10.7
npm --version 6.4.1
yarn --version 1.12.3
node --version 10.13.0
OS Version
NAME VERSION
macOS Sierra 10.14.2
@evocateur
Copy link
Member

Oh geez, sorry about that. I coulda sworn all the presets used the same patterns for their default export...

We probably need to do something like this, from core.

@sebald
Copy link
Author

sebald commented Feb 1, 2019

Thanks!

PS: I honestly was startled when I looked at conventional-changelog source and that it still uses q 😔

@evocateur
Copy link
Member

Published in v3.10.8

@hutson
Copy link

hutson commented Feb 12, 2019

PS: I honestly was startled when I looked at conventional-changelog source and that it still uses q

Well, I believe it was written when Q was the best way to add promises, and it really hasn't been updated since Promises became native to Node. 🤷‍♂️

We do accept pull requests to upgrade that code base 😅

Eventually, we'll get around to updating it, as it's still actively maintained by the @conventional-changelog team. 👍

@sebald
Copy link
Author

sebald commented Feb 13, 2019

@hutson Sorry, I didn't want to offend anyone. When I first digged into the codebase I was confused that it still uses q, because the project is so widely used 🙂

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

No branches or pull requests

3 participants