Skip to content

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

Closed
@silversonicaxel

Description

@silversonicaxel

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions