conventional-changelog / commitlint

📓 Lint commit messages

Home Page:https://commitlint.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

wrapper.mjs is not included in published @commitlint/config-conventional package

drewbrend opened this issue · comments

Steps to Reproduce

I have some custom scripting, which accesses one of the @commitlint/config-conventional rules to do something with.

It gets this by doing:

import commitLintConfig from '@commitlint/config-conventional';

This works fine in v18.6.0. Dependabot recently opened a PR to upgrade to latest and we started hitting this issue.

Current Behavior

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/Users/drewb/workspace/alloy-react/node_modules/@commitlint/config-conventional/wrapper.mjs' imported from /Users/drewb/workspace/alloy-react/scripts/verifyCommits.js
Did you mean to import @commitlint/config-conventional/lib/index.js?

Expected Behavior

Config can be imported and used

Affected packages

  • cli
  • core
  • prompt
  • config-angular

Possible Solution

Include ./wrapper.mjs in the files property of the package.json

Context

This looks like it was introduced in #3911, which added wrapper.mjs, however it is not being included in the built/published package.

https://unpkg.com/browse/@commitlint/config-conventional@18.6.2/

commitlint --version

@commitlint/cli@18.6.1 @commitlint/config-conventional@18.6.2

git --version

git version 2.39.2 (Apple Git-143)

node --version

v20.9.0

/cc @dargmuesli do you have time to look into this?

Mmh, no, but I did anyway. Commit 3423735 removed the wrapper script, so it would be better to tag JounQin / marcalexiei. But most sense would make to share the contents of alloy-react/scripts/verifyCommits.js @drewbrend so others could see why the wrapper is needed. All packages have been migrated to pure ESM so there is no wrapper script provided by commitlint anymore. Most likely you'd have to adapt or stay at the version currently in use.

@dargmuesli

wrapper.mjs is removed in v19, not v18.

https://unpkg.com/browse/@commitlint/config-conventional@18.6.2/

It's indeed a valid issue.

To fix it, @escapedcat we need to create a branch like release-v18 from v18 tag.

Not sure I can follow. Would this be a fix for the previous v18? Does this work in v19?

@escapedcat It needs to be fixed on v18 only.

Is updating to v19 an option?

Is updating to v19 an option?

Not for those who're not ready for pure ESM yet? It depends on the users like @drewbrend .

Updating to pure ESM isn't on the table at the moment for us, I'm a maintainer of a large internal library used by many different projects so we have to plan these things carefully. We will get there and upgrade to v19 at that time.

We can stay on an older version, this patch upgrade isn't important to us. Dependabot found it and I figured you'd want to fix this so the latest v18 continues to work for everyone.

To fix it, @escapedcat we need to create a branch like release-v18 from v18 tag.

Here you go: https://github.com/conventional-changelog/commitlint/tree/release-v18

Why this issue is not automatically closed by GitHub with #3966?

🤷‍♂️ not sure