diff --git a/@commitlint/config-lerna-scopes/fixtures/basic/package.json b/@commitlint/config-lerna-scopes/fixtures/basic/package.json index 06aff06a63..85a312021c 100644 --- a/@commitlint/config-lerna-scopes/fixtures/basic/package.json +++ b/@commitlint/config-lerna-scopes/fixtures/basic/package.json @@ -2,6 +2,7 @@ "name": "basic", "version": "1.0.0", "devDependencies": { - "lerna": "^4.0.0" + "lerna": "^4.0.0", + "@lerna/project": "^4.0.0" } } diff --git a/@commitlint/config-lerna-scopes/fixtures/empty/package.json b/@commitlint/config-lerna-scopes/fixtures/empty/package.json index 00bf9d1213..345438e0ac 100644 --- a/@commitlint/config-lerna-scopes/fixtures/empty/package.json +++ b/@commitlint/config-lerna-scopes/fixtures/empty/package.json @@ -2,6 +2,7 @@ "name": "empty", "version": "1.0.0", "devDependencies": { - "lerna": "^4.0.0" + "lerna": "^4.0.0", + "@lerna/project": "^4.0.0" } } diff --git a/@commitlint/config-lerna-scopes/fixtures/lerna-two/lerna.json b/@commitlint/config-lerna-scopes/fixtures/lerna-two/lerna.json deleted file mode 100644 index 41c31e2033..0000000000 --- a/@commitlint/config-lerna-scopes/fixtures/lerna-two/lerna.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "lerna": "4", - "version": "1.0.0", - "packages": ["packages/*"] -} diff --git a/@commitlint/config-lerna-scopes/fixtures/lerna-two/package.json b/@commitlint/config-lerna-scopes/fixtures/lerna-two/package.json deleted file mode 100644 index db55d4fad3..0000000000 --- a/@commitlint/config-lerna-scopes/fixtures/lerna-two/package.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "version-mismatch", - "version": "1.0.0", - "devDependencies": { - "lerna": "^4.0.0" - } -} diff --git a/@commitlint/config-lerna-scopes/fixtures/lerna-two/packages/a2/package.json b/@commitlint/config-lerna-scopes/fixtures/lerna-two/packages/a2/package.json deleted file mode 100644 index caecf1e4fb..0000000000 --- a/@commitlint/config-lerna-scopes/fixtures/lerna-two/packages/a2/package.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "a2", - "version": "1.0.0" -} diff --git a/@commitlint/config-lerna-scopes/fixtures/lerna-two/packages/b2/package.json b/@commitlint/config-lerna-scopes/fixtures/lerna-two/packages/b2/package.json deleted file mode 100644 index cb876f041e..0000000000 --- a/@commitlint/config-lerna-scopes/fixtures/lerna-two/packages/b2/package.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "b2", - "version": "1.0.0" -} diff --git a/@commitlint/config-lerna-scopes/fixtures/modules/package.json b/@commitlint/config-lerna-scopes/fixtures/modules/package.json index 06aff06a63..85a312021c 100644 --- a/@commitlint/config-lerna-scopes/fixtures/modules/package.json +++ b/@commitlint/config-lerna-scopes/fixtures/modules/package.json @@ -2,6 +2,7 @@ "name": "basic", "version": "1.0.0", "devDependencies": { - "lerna": "^4.0.0" + "lerna": "^4.0.0", + "@lerna/project": "^4.0.0" } } diff --git a/@commitlint/config-lerna-scopes/fixtures/scoped/package.json b/@commitlint/config-lerna-scopes/fixtures/scoped/package.json index 0761bd7b18..5ede29c62c 100644 --- a/@commitlint/config-lerna-scopes/fixtures/scoped/package.json +++ b/@commitlint/config-lerna-scopes/fixtures/scoped/package.json @@ -2,6 +2,7 @@ "name": "scoped", "version": "1.0.0", "devDependencies": { - "lerna": "^4.0.0" + "lerna": "^4.0.0", + "@lerna/project": "^4.0.0" } } diff --git a/@commitlint/config-lerna-scopes/fixtures/yarn/package.json b/@commitlint/config-lerna-scopes/fixtures/yarn/package.json index 40f5ac83a8..086ff7756b 100644 --- a/@commitlint/config-lerna-scopes/fixtures/yarn/package.json +++ b/@commitlint/config-lerna-scopes/fixtures/yarn/package.json @@ -2,7 +2,8 @@ "name": "yarn", "version": "1.0.0", "devDependencies": { - "lerna": "^4.0.0" + "lerna": "^4.0.0", + "@lerna/project": "^4.0.0" }, "workspaces": [ "@packages/*" diff --git a/@commitlint/config-lerna-scopes/index.test.js b/@commitlint/config-lerna-scopes/index.test.js index 052260ef5c..2028fc6f8c 100644 --- a/@commitlint/config-lerna-scopes/index.test.js +++ b/@commitlint/config-lerna-scopes/index.test.js @@ -1,5 +1,5 @@ import Path from 'path'; -import {lerna} from '@commitlint/test'; +import {npm} from '@commitlint/test'; import config from '.'; test('exports rules key', () => { @@ -47,14 +47,14 @@ test('scope-enum has expected modifier', async () => { test('returns empty value for empty lerna repository', async () => { const {'scope-enum': fn} = config.rules; - const cwd = await lerna.bootstrap('empty', __dirname); + const cwd = await npm.bootstrap('fixtures/empty', __dirname); const [, , value] = await fn({cwd}); expect(value).toEqual([]); }); test('returns expected value for basic lerna repository', async () => { const {'scope-enum': fn} = config.rules; - const cwd = await lerna.bootstrap('basic', __dirname); + const cwd = await npm.bootstrap('fixtures/basic', __dirname); const [, , value] = await fn({cwd}); expect(value).toEqual(['a', 'b']); @@ -62,7 +62,7 @@ test('returns expected value for basic lerna repository', async () => { test('returns expected value for lerna repository containing modules', async () => { const {'scope-enum': fn} = config.rules; - const cwd = await lerna.bootstrap('modules', __dirname); + const cwd = await npm.bootstrap('fixtures/modules', __dirname); const [, , value] = await fn({cwd}); expect(value).toEqual(['a']); @@ -70,7 +70,7 @@ test('returns expected value for lerna repository containing modules', async () test('returns expected value for scoped lerna repository', async () => { const {'scope-enum': fn} = config.rules; - const cwd = await lerna.bootstrap('scoped', __dirname); + const cwd = await npm.bootstrap('fixtures/scoped', __dirname); const [, , value] = await fn({cwd}); expect(value).toEqual(['a', 'b']); diff --git a/@packages/test/src/index.ts b/@packages/test/src/index.ts index 4c28118d53..2825fd2120 100644 --- a/@packages/test/src/index.ts +++ b/@packages/test/src/index.ts @@ -1,6 +1,5 @@ import * as fix from './fix'; import * as git from './git'; -import * as lerna from './lerna'; import * as npm from './npm'; -export {fix, git, lerna, npm}; +export {fix, git, npm}; diff --git a/@packages/test/src/lerna.ts b/@packages/test/src/lerna.ts deleted file mode 100644 index a6d7325da0..0000000000 --- a/@packages/test/src/lerna.ts +++ /dev/null @@ -1,21 +0,0 @@ -import fs from 'fs-extra'; -import path from 'path'; -import resolvePkg from 'resolve-pkg'; -import * as fix from './fix'; - -export type LernaFixture = 'basic' | 'empty' | 'scoped'; - -export async function bootstrap( - fixture: string, - directory: string -): Promise { - const cwd = await fix.bootstrap(`fixtures/${fixture}`, directory); - const lerna = 'lerna'; - await fs.mkdirp(path.join(cwd, 'node_modules', '@lerna')); - await fs.symlink( - resolvePkg('@lerna/project')!, - path.join(cwd, 'node_modules', '@lerna', 'project') - ); - await fs.symlink(resolvePkg(lerna)!, path.join(cwd, 'node_modules', 'lerna')); - return cwd; -}