Skip to content

Commit 59667b3

Browse files
committed
refactor!: drop support for lerna v2
BREAKING CHANGE: remove lerna v2 support and tests
1 parent 3d4116d commit 59667b3

File tree

5 files changed

+28
-964
lines changed

5 files changed

+28
-964
lines changed

@commitlint/config-lerna-scopes/index.test.js

-29
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import {lerna} from '@commitlint/test';
22
import config from '.';
3-
import semver from 'semver';
43

54
test('exports rules key', () => {
65
expect(config).toHaveProperty('rules');
@@ -67,31 +66,3 @@ test('returns expected value for scoped lerna repository', async () => {
6766
const [, , value] = await fn({cwd});
6867
expect(value).toEqual(['a', 'b']);
6968
});
70-
71-
test('works with lerna version < 3', async () => {
72-
const {'scope-enum': fn} = config.rules;
73-
const cwd = await lerna.bootstrap('lerna-two', __dirname);
74-
const [, , value] = await fn({cwd});
75-
expect(value).toEqual(['a2', 'b2']);
76-
});
77-
78-
test('uses lerna version < 3 if installed', async () => {
79-
const semverLt = jest.spyOn(semver, 'lt');
80-
const cwd = await lerna.bootstrap('lerna-two', __dirname);
81-
const packages = await config.utils.getPackages({cwd});
82-
83-
expect(packages).toEqual(['a2', 'b2']);
84-
expect(semverLt).toHaveBeenLastCalledWith('2.11.0', '3.0.0');
85-
expect(semverLt).toHaveLastReturnedWith(true);
86-
});
87-
88-
test('uses lerna version >= 3 if installed', async () => {
89-
const semverLt = jest.spyOn(semver, 'lt');
90-
const cwd = await lerna.bootstrap('basic', __dirname);
91-
92-
const packages = await config.utils.getPackages({cwd});
93-
94-
expect(packages).toEqual(['a', 'b']);
95-
expect(semverLt).toHaveBeenLastCalledWith('3.20.2', '3.0.0');
96-
expect(semverLt).toHaveLastReturnedWith(false);
97-
});

@commitlint/config-lerna-scopes/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
},
2727
"homepage": "https://github.com/conventional-changelog/commitlint#readme",
2828
"peerDependencies": {
29-
"lerna": "^2.11.0 ^2.11.0"
29+
"lerna": "^3.22.1"
3030
},
3131
"engines": {
3232
"node": ">=v10.22.0"

@packages/test/src/lerna.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,18 @@ import fs from 'fs-extra';
33
import resolvePkg from 'resolve-pkg';
44
import * as fix from './fix';
55

6-
export type LernaFixture = 'basic' | 'empty' | 'lerna-two' | 'scoped';
6+
export type LernaFixture = 'basic' | 'empty' | 'scoped';
77

88
export async function bootstrap(
99
fixture: string,
1010
directory: string
1111
): Promise<string> {
1212
const cwd = await fix.bootstrap(`fixtures/${fixture}`, directory);
13-
const lerna = fixture === 'lerna-two' ? 'lerna-v2' : 'lerna-v3';
13+
// this used to test lerna v2 and v3
14+
// the v2 option is removed here, lerna version tests as well
15+
// all the code to test differnt version is still in place
16+
// cause i'm not sure how to remove this properly
17+
const lerna = 'lerna-v3';
1418
await fs.mkdirp(path.join(cwd, 'node_modules', '@lerna'));
1519
await fs.symlink(
1620
resolvePkg('@lerna/project')!,

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@
9090
"husky": "4.2.5",
9191
"jest": "25.1.0",
9292
"lerna": "^3.22.1",
93-
"lerna-v2": "npm:lerna@2",
9493
"lerna-v3": "npm:lerna@3",
9594
"lint-staged": "10.3.0",
9695
"prettier": "^2.0.5",

0 commit comments

Comments
 (0)