After upgrading my project to use Lerna v4.0.0, I can no longer run commitlint.
Commit checks should run as usual when using Lerna v4.0.0
Commitlint blows up when running the commit hooks. The following error occurs in @commitlint\config-lerna-scopes\index.js:47:20 - "TypeError: Project is not a constructor".
Add another check for lerna version in the getPackages function:
const lernaVersion = getLernaVersion(cwd);
if (semver.lt(lernaVersion, '3.0.0')) {
const Repository = importFrom(cwd, 'lerna/lib/Repository');
const PackageUtilities = importFrom(cwd, 'lerna/lib/PackageUtilities');
const repository = new Repository(cwd);
return PackageUtilities.getPackages({
packageConfigs: repository.packageConfigs,
rootPath: cwd,
});
}
// New check for less than v4.0.0
if (semver.lt(lernaVersion, '4.0.0')) {
const Project = importFrom(cwd, '@lerna/project');
const project = new Project(cwd);
return project.getPackages();
}
const { getPackages } = importFrom(cwd, '@lerna/project');
return getPackages();
This issue prevents me from running pre-commit checks, so I can only commit code by skipping the checks with the --no-verify flag.
| Executable | Version |
| ---------------------: | :------ |
| commitlint --version | @commitlint/[email protected] |
| git --version | git version 2.29.2.windows.2 |
| node --version | v14.15.1 |
Thanks, lerna v4 just came out and we haven't added support yet.
@escapedcat this issue will be resolved with next release and can be now closed
Yup, thanks!
v12.1.0 is released under the next-tag. Please give it a try.
Works like a dream, great work everyone! 馃憤
Most helpful comment
Thanks, lerna v4 just came out and we haven't added support yet.