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

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

Closed
4 tasks
drewbrend opened this issue Mar 6, 2024 · 11 comments
Closed
4 tasks

Comments

@drewbrend
Copy link

drewbrend commented Mar 6, 2024

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

@escapedcat
Copy link
Member

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

@dargmuesli
Copy link
Contributor

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.

@JounQin
Copy link
Contributor

JounQin commented Mar 8, 2024

@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.

@escapedcat
Copy link
Member

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

@JounQin
Copy link
Contributor

JounQin commented Mar 8, 2024

@escapedcat It needs to be fixed on v18 only.

@escapedcat
Copy link
Member

Is updating to v19 an option?

@JounQin
Copy link
Contributor

JounQin commented Mar 8, 2024

Is updating to v19 an option?

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

@drewbrend
Copy link
Author

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.

@escapedcat
Copy link
Member

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

JounQin added a commit to JounQin/commitlint that referenced this issue Mar 10, 2024
escapedcat pushed a commit that referenced this issue Mar 11, 2024
@JounQin
Copy link
Contributor

JounQin commented Mar 11, 2024

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

@escapedcat
Copy link
Member

🤷‍♂️ not sure

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

No branches or pull requests

4 participants