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

conventional-changelog-preset-loader dependency issue for yarn 2 and up #1223

Open
rickh18 opened this issue Apr 12, 2024 · 5 comments
Open
Assignees

Comments

@rickh18
Copy link

rickh18 commented Apr 12, 2024

The conventional-changelog-preset-loader has the conventional-changelog-conventionalcommits set under devDependencies

This breaks in yarn V2 and above.

ERROR Unable to load the "conventionalcommits" preset. Please make sure it's installed.

The conventionalcommits preset cannot be loaded. To fix this issue I've added a packageExtension in the yarnrc file:

.yarnrc.yml

packageExtensions:
  "conventional-changelog-preset-loader@^4.1.0":
    dependencies:
      conventional-changelog-conventionalcommits: ^7.0.2

After adding this all works as expected.

I think that adding it as an optional peer dependency would fix this. Then the conventionalcommits package can be added on an as needed basis. Alternatively, the package should be included as a dependency.

I assume that the same issue persist for the conventional-changelog-angular package.

I'm using this package through @release-it/conventional-changelog.

release-it.js

{
plugins: {
  '@release-it/conventional-changelog': {
    path: '.',
    infile: 'CHANGELOG.md',
    preset: {
      name: 'conventionalcommits',
      types: [
        { type: 'feat', section: 'Features' },
        { type: 'fix', section: 'Bug Fixes' },
      ],
    },
    gitRawCommitsOpts: {
      path: '.',
    },
  },
},
}
@dangreen
Copy link
Member

@rickh18 Hi. Did you install conventional-changelog-conventionalcommits as dependency of your project?

@dangreen
Copy link
Member

@rickh18 ping

@rickh18
Copy link
Author

rickh18 commented Apr 18, 2024

Hi @dangreen ,

Thank you for your response. installing conventional-changelog-conventionalcommits as a dependency does not resolve the issue. In yarn berry implicit imports does not work.

With these dependencies:

	"devDependencies": {
		"@commitlint/config-conventional": "^19.1.0",
		"@release-it/conventional-changelog": "8.0.1",
		"conventional-changelog-conventionalcommits": "^7.0.2",
		"release-it": "17.2.0"
	}

I still get the same error:

ERROR Unable to load the "conventionalcommits" preset. Please make sure it's installed.

Yarn calls this a ghost dependency.

I would suggest to at it as a peer dependency with peerDependencyMeta
as optional so that the user still has the choice between conventionalcommits and angular

@dangreen dangreen self-assigned this Apr 18, 2024
@dangreen
Copy link
Member

@rickh18 Please provide minimal reproduction. You can provide repo, or sandbox in codesandbox or in stackblitz

@dangreen
Copy link
Member

dangreen commented May 9, 2024

@rickh18 ?

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

No branches or pull requests

2 participants