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

Error when linting with config-lerna-scopes #87

Closed
QuentinRoy opened this issue Oct 9, 2017 · 5 comments
Closed

Error when linting with config-lerna-scopes #87

QuentinRoy opened this issue Oct 9, 2017 · 5 comments
Labels

Comments

@QuentinRoy
Copy link
Contributor

QuentinRoy commented Oct 9, 2017

When trying to lint a message with config-lerna-scopes, the following error is issued:

$ echo "chore(api): fix something in api's build" | npx commitlint
/Users/quentinroy/Workspace/reacolo/node_modules/@commitlint/cli/cli.js:130
		throw err;
		^

TypeError: Cannot read property 'map' of undefined
    at getPackages (/Users/quentinroy/Workspace/reacolo/node_modules/@commitlint/config-lerna-scopes/index.js:13:3)
    at scope-enum (/Users/quentinroy/Workspace/reacolo/node_modules/@commitlint/config-lerna-scopes/index.js:6:37)
    at /Users/quentinroy/Workspace/reacolo/node_modules/@commitlint/core/lib/library/execute-rule.js:23:28
    at Promise (<anonymous>)
    at /Users/quentinroy/Workspace/reacolo/node_modules/@commitlint/core/lib/library/execute-rule.js:21:26
    at Promise (<anonymous>)
    at exports.default (/Users/quentinroy/Workspace/reacolo/node_modules/@commitlint/core/lib/library/execute-rule.js:14:9)
    at /Users/quentinroy/Workspace/reacolo/node_modules/@commitlint/core/lib/load.js:109:44
    at Array.map (<anonymous>)
    at /Users/quentinroy/Workspace/reacolo/node_modules/@commitlint/core/lib/load.js:108:79

After investigation, it seems the plugin relies on lerna/lib/Repository#packages which does not exist anymore (at least with lerna 2.4.0)

@QuentinRoy QuentinRoy changed the title config-lerna-scopes is broken Error when linting with config-lerna-scopes Oct 9, 2017
@marionebl
Copy link
Contributor

Thanks for raising this, will investigate right away.

@QuentinRoy
Copy link
Contributor Author

You may want to have a look at #88 which seems to solve the issue for me. Not sure how to thoroughly test it though.

@marionebl
Copy link
Contributor

Changes I added on top of the fix via #89:

  • move test-git to distinct package for reuse in config-lerna, core, potentially others
  • add npm.bootstrap helper to init a temp git repo and install via npm if a package.json is found
  • rewrite parts of config-lerna to allow for testing
  • unit test some config-lerna assumptions
  • test for .notThrows with lerna 2.4 and 2.0 specifically
  • load lerna from context.cwd || process.cwd (not plugged into core!)

@marionebl
Copy link
Contributor

Released the fix via 4.1.1. Thanks for your help!

@marionebl
Copy link
Contributor

marionebl commented Oct 11, 2017

Opened the follow-up to this at lerna/lerna#1071

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