Skip to content

Commit dd18eaa

Browse files
backflipmarionebl
authored andcommitted
chore: update lerna to v3.0.0-rc.0
1 parent 031ab00 commit dd18eaa

File tree

20 files changed

+859
-303
lines changed

20 files changed

+859
-303
lines changed

@commitlint/config-lerna-scopes/fixtures/basic/lerna.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"lerna": "2.0.0",
2+
"lerna": "3.0.0",
33
"version": "1.0.0",
44
"packages": [
55
"packages/*"

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
"name": "basic",
33
"version": "1.0.0",
44
"devDependencies": {
5-
"lerna": "2.9.0"
5+
"lerna": "3.0.0-rc.0"
66
}
77
}

@commitlint/config-lerna-scopes/fixtures/empty/lerna.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"lerna": "2.0.0",
2+
"lerna": "3.0.0",
33
"version": "1.0.0",
44
"packages": [
55
"packages/*"

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
"name": "empty",
33
"version": "1.0.0",
44
"devDependencies": {
5-
"lerna": "2.9.0"
5+
"lerna": "3.0.0-rc.0"
66
}
77
}

@commitlint/config-lerna-scopes/fixtures/lerna-2.0/lerna.json

-7
This file was deleted.

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

-7
This file was deleted.

@commitlint/config-lerna-scopes/fixtures/lerna-2.0/packages/a/package.json

-4
This file was deleted.

@commitlint/config-lerna-scopes/fixtures/lerna-2.0/packages/b/package.json

-4
This file was deleted.

@commitlint/config-lerna-scopes/fixtures/lerna-2.4/lerna.json

-7
This file was deleted.

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

-7
This file was deleted.

@commitlint/config-lerna-scopes/fixtures/lerna-2.4/packages/a/package.json

-4
This file was deleted.

@commitlint/config-lerna-scopes/fixtures/lerna-2.4/packages/b/package.json

-4
This file was deleted.

@commitlint/config-lerna-scopes/fixtures/scoped/lerna.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"lerna": "2.0.0",
2+
"lerna": "3.0.0",
33
"version": "1.0.0",
44
"packages": [
55
"@packages/*"

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
"name": "scoped",
33
"version": "1.0.0",
44
"devDependencies": {
5-
"lerna": "2.9.0"
5+
"lerna": "3.0.0-rc.0"
66
}
77
}

@commitlint/config-lerna-scopes/fixtures/version-mismatch/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
"name": "version-mismatch",
33
"version": "1.0.0",
44
"devDependencies": {
5-
"lerna": "2.9.0"
5+
"lerna": "3.0.0-rc.0"
66
}
77
}

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

+5-9
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,18 @@ const importFrom = require('import-from');
33
module.exports = {
44
utils: {getPackages},
55
rules: {
6-
'scope-enum': ctx => [2, 'always', getPackages(ctx)]
6+
'scope-enum': async ctx => [2, 'always', await getPackages(ctx)]
77
}
88
};
99

10-
function getPackages(context) {
10+
async function getPackages(context) {
1111
const ctx = context || {};
1212
const cwd = ctx.cwd || process.cwd();
1313

14-
const Repository = importFrom(cwd, 'lerna/lib/Repository');
15-
const PackageUtilities = importFrom(cwd, 'lerna/lib/PackageUtilities');
14+
const Project = importFrom(cwd, '@lerna/project');
1615

17-
const repository = new Repository(cwd);
18-
const packages = PackageUtilities.getPackages({
19-
packageConfigs: repository.packageConfigs,
20-
rootPath: cwd
21-
});
16+
const project = new Project(cwd);
17+
const packages = await project.getPackages();
2218

2319
return packages
2420
.map(pkg => pkg.name)

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"homepage": "https://github.com/marionebl/commitlint#readme",
4242
"dependencies": {
4343
"import-from": "2.1.0",
44-
"lerna": "2.9.0"
44+
"lerna": "3.0.0-rc.0"
4545
},
4646
"devDependencies": {
4747
"@commitlint/test": "^7.0.0",

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

+10-24
Original file line numberDiff line numberDiff line change
@@ -19,34 +19,34 @@ test('scope-enum is function', t => {
1919
t.is(typeof fn, 'function');
2020
});
2121

22-
test('scope-enum does not throw for missing context', t => {
22+
test('scope-enum does not throw for missing context', async t => {
2323
const {'scope-enum': fn} = config.rules;
24-
t.notThrows(() => fn());
24+
await t.notThrows(async () => fn());
2525
});
2626

27-
test('scope-enum has expected severity', t => {
27+
test('scope-enum has expected severity', async t => {
2828
const {'scope-enum': fn} = config.rules;
29-
const [severity] = fn();
29+
const [severity] = await fn();
3030
t.is(severity, 2);
3131
});
3232

33-
test('scope-enum has expected modifier', t => {
33+
test('scope-enum has expected modifier', async t => {
3434
const {'scope-enum': fn} = config.rules;
35-
const [, modifier] = fn();
35+
const [, modifier] = await fn();
3636
t.is(modifier, 'always');
3737
});
3838

3939
test('returns empty value for empty lerna repository', async t => {
4040
const {'scope-enum': fn} = config.rules;
4141
const cwd = await npm.bootstrap('fixtures/empty');
42-
const [, , value] = fn({cwd});
42+
const [, , value] = await fn({cwd});
4343
t.deepEqual(value, []);
4444
});
4545

4646
test('returns expected value for basic lerna repository', async t => {
4747
const {'scope-enum': fn} = config.rules;
4848
const cwd = await npm.bootstrap('fixtures/basic');
49-
const [, , value] = fn({cwd});
49+
const [, , value] = await fn({cwd});
5050
t.deepEqual(value, ['a', 'b']);
5151
});
5252

@@ -55,27 +55,13 @@ test.failing(
5555
async t => {
5656
const {'scope-enum': fn} = config.rules;
5757
const cwd = await npm.bootstrap('fixtures/version-mismatch');
58-
await t.throws(() => fn({cwd}));
58+
await t.throws(async () => fn({cwd}));
5959
}
6060
);
6161

6262
test('returns expected value for scoped lerna repository', async t => {
6363
const {'scope-enum': fn} = config.rules;
6464
const cwd = await npm.bootstrap('fixtures/scoped');
65-
const [, , value] = fn({cwd});
66-
t.deepEqual(value, ['a', 'b']);
67-
});
68-
69-
test('works with lerna 2.0', async t => {
70-
const {'scope-enum': fn} = config.rules;
71-
const cwd = await npm.bootstrap('fixtures/lerna-2.4');
72-
const [, , value] = fn({cwd});
73-
t.deepEqual(value, ['a', 'b']);
74-
});
75-
76-
test('works with lerna 2.4', async t => {
77-
const {'scope-enum': fn} = config.rules;
78-
const cwd = await npm.bootstrap('fixtures/lerna-2.4');
79-
const [, , value] = fn({cwd});
65+
const [, , value] = await fn({cwd});
8066
t.deepEqual(value, ['a', 'b']);
8167
});

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
"eslint": "4.18.1",
9797
"eslint-config-prettier": "2.9.0",
9898
"husky": "0.14.3",
99-
"lerna": "2.9.0",
99+
"lerna": "3.0.0-rc.0",
100100
"lint-staged": "6.1.1",
101101
"npx": "9.7.1",
102102
"prettier": "1.10.2",

0 commit comments

Comments
 (0)