feat: add lerna workspace support to searchForWorkspaceRoot (#6270)

This commit is contained in:
Samuel Alev 2022-01-26 14:09:21 +01:00 committed by GitHub
parent 7329b24e03
commit 0e164f80ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 2 deletions

View File

@ -592,6 +592,7 @@ createServer()
- contains `workspaces` field in `package.json`
- contains one of the following file
- `lerna.json`
- `pnpm-workspace.yaml`
Accepts a path to specify the custom workspace root. Could be a absolute path or a path relative to [project root](/guide/#index-html-and-project-root). For example:

View File

@ -0,0 +1,3 @@
{
"private": true
}

View File

@ -2,6 +2,13 @@ import { searchForWorkspaceRoot } from '../searchRoot'
import { resolve } from 'path'
describe('searchForWorkspaceRoot', () => {
test('lerna', () => {
const resolved = searchForWorkspaceRoot(
resolve(__dirname, 'fixtures/lerna/nested')
)
expect(resolved).toBe(resolve(__dirname, 'fixtures/lerna'))
})
test('pnpm', () => {
const resolved = searchForWorkspaceRoot(
resolve(__dirname, 'fixtures/pnpm/nested')

View File

@ -8,14 +8,17 @@ const ROOT_FILES = [
// '.git',
// https://pnpm.js.org/workspaces/
'pnpm-workspace.yaml'
'pnpm-workspace.yaml',
// https://rushjs.io/pages/advanced/config_files/
// 'rush.json',
// https://nx.dev/latest/react/getting-started/nx-setup
// 'workspace.json',
// 'nx.json'
// 'nx.json',
// https://github.com/lerna/lerna#lernajson
'lerna.json'
]
// npm: https://docs.npmjs.com/cli/v7/using-npm/workspaces#installing-workspaces