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

fix: angular conventional-changelog-angular depdendency in @commitlint/parse/package.json #3698

Closed
1 of 4 tasks
silversonicaxel opened this issue Oct 19, 2023 · 7 comments
Closed
1 of 4 tasks
Labels

Comments

@silversonicaxel
Copy link
Contributor

silversonicaxel commented Oct 19, 2023

Expected Behavior

conventional-changelog-angular version is up to date to the 7.0

Current Behavior

Currently I am using https://github.com/release-it/conventional-changelog, package based on https://github.com/conventional-changelog.

Right now there is an issue release-it/conventional-changelog#70 with this following configuration, using the conventional-changelog-angular package:

plugins:
  '@release-it/conventional-changelog':
    preset:
      name: angular

This is happening because of the following code of conventional-changelog-preset-loader package receives a pending promise instead of a function:

file: https://github.com/conventional-changelog/conventional-changelog/blob/master/packages/conventional-changelog-preset-loader/index.js
line: https://github.com/conventional-changelog/conventional-changelog/blob/eb3ab7bcd2266cd751e94c583510c8a85216a027/packages/conventional-changelog-preset-loader/index.js#L113

    if (typeof createPreset !== 'function') {
      throw Error(`The "${preset}" preset does not export a function. Maybe you are using an old version of the preset. Please upgrade.`)
    }

Apparently in my node_modules folder I've conventional-changelog-angular version 6.0:

'use strict'
const conventionalChangelog = require('./conventional-changelog')
const parserOpts = require('./parser-opts')
const recommendedBumpOpts = require('./conventional-recommended-bump')
const writerOpts = require('./writer-opts')

module.exports = Promise.all([conventionalChangelog, parserOpts, recommendedBumpOpts, writerOpts])
  .then(([conventionalChangelog, parserOpts, recommendedBumpOpts, writerOpts]) => ({
    conventionalChangelog,
    parserOpts,
    recommendedBumpOpts,
    writerOpts
  }))

Instead of version 7.0

'use strict'

const { createParserOpts } = require('./parserOpts')
const { createWriterOpts } = require('./writerOpts')
const { createConventionalChangelogOpts } = require('./conventionalChangelog')
const { createConventionalRecommendedBumpOpts } = require('./conventionalRecommendedBump')

async function createPreset () {
  const parserOpts = createParserOpts()
  const writerOpts = await createWriterOpts()
  const recommendedBumpOpts = createConventionalRecommendedBumpOpts(parserOpts)
  const conventionalChangelog = createConventionalChangelogOpts(parserOpts, writerOpts)
  return {
    parserOpts,
    writerOpts,
    recommendedBumpOpts,
    conventionalChangelog
  }
}

module.exports = createPreset

It seems that the reason why is an old depencency of conventional-changelog-angular: https://github.com/conventional-changelog/commitlint/blob/master/%40commitlint/parse/package.json at line

"conventional-changelog-angular": "^6.0.0",

that has set still version 6.0.

In fact in my package-lock.json of my project, the only dependeny of conventional-changelog-angular referring to version 6.0 comes from @commitlint:

    "node_modules/@commitlint/parse": {
      "version": "17.7.0",
      "resolved": "https://registry.npmjs.org/@commitlint/parse/-/parse-17.7.0.tgz",
      "integrity": "sha512-dIvFNUMCUHqq5Abv80mIEjLVfw8QNuA4DS7OWip4pcK/3h5wggmjVnlwGCDvDChkw2TjK1K6O+tAEV78oxjxag==",
      "dev": true,
      "dependencies": {
        "@commitlint/types": "^17.4.4",
        "conventional-changelog-angular": "^6.0.0",
        "conventional-commits-parser": "^4.0.0"
      },
      "engines": {
        "node": ">=v14"
      }
    },

Does is make sense to upgrade this dependency?

Thanks

As a reference, previous issue conventional-changelog/conventional-changelog#1154

Affected packages

  • cli
  • core
  • prompt
  • config-angular

Possible Solution

Upgrade dependency at line

"conventional-changelog-angular": "^6.0.0",
to version 7.0

Steps to Reproduce

1. Install this set of packages of conventional-changelog

    "@commitlint/cli": "^17.7.2",
    "@commitlint/config-conventional": "^17.7.0",
    "@commitlint/cz-commitlint": "^17.8.0",
    "@commitlint/types": "^17.4.4",
    "@release-it/conventional-changelog": "^7.0.2",
  1. Use agnular preset

  2. This error will occur

ERROR The "angular" preset does not export a function. Maybe you are using an old version of the preset. Please upgrade.



### Context

My context is the release command, making use of this package for CHANGELOG management.

### commitlint --version

@commitlint/cli: ^17.7.2

### git --version

2.39.2 (Apple Git-143)

### node --version

v18.12.1
@silversonicaxel silversonicaxel changed the title fix: angular conventional-changelog-angular depdendeny in @commitlint/parse/package.json fix: angular conventional-changelog-angular depdendency in @commitlint/parse/package.json Oct 19, 2023
@escapedcat
Copy link
Member

escapedcat commented Oct 19, 2023

Update to v7 is at least blocked by a new major version for commitlint.
v7 requires node v16 which is EOL.
There might be more issues or changes need to be done to support v7.

Happy for a PR.

So because this is actually a new major version I would consider this as a feature not bug. Wdyt?

@escapedcat
Copy link
Member

New major is released. Tests for v7 are failing.

@silversonicaxel
Copy link
Contributor Author

I guess if new features will be introduced, beside bugfixes, then indeed it will be a new feature.
You @escapedcat mentioned, "happy for a PR".

Isn't this alreaady the initial state of the PR that would solve my issue? #3690

@escapedcat
Copy link
Member

I guess if new features will be introduced, beside bugfixes, then indeed it will be a new feature.

Supporting a new version is more a feature than a bug I'm trying to say I guess.

You @escapedcat mentioned, "happy for a PR".
Isn't this alreaady the initial state of the PR that would solve my issue? #3690

Yes, but checks are failing and these need to be fixed or updated ;)

@silversonicaxel
Copy link
Contributor Author

Let's see if I will be able to give a hand. Keep you posted.

@silversonicaxel
Copy link
Contributor Author

@escapedcat a small improvement #3725

@silversonicaxel
Copy link
Contributor Author

Fixed with release https://github.com/conventional-changelog/commitlint/releases/tag/v18.4.3

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

No branches or pull requests

2 participants