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)
Thanks for raising this, will investigate right away.
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.
Changes I added on top of the fix via #89:
npm.bootstrap helper to init a temp git repo and install via npm if a package.json is found.notThrows with lerna 2.4 and 2.0 specificallycontext.cwd || process.cwd (not plugged into core!)Released the fix via 4.1.1. Thanks for your help!
Opened the follow-up to this at https://github.com/lerna/lerna/issues/1071