feat: add support for pnpm workspace (#1027)
* Add pnpm workspace support * Update comments * chore: correct filename for pnpm lockfile * chore: correct filename for pnpm lockfile --------- Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
This commit is contained in:
Родитель
28714f9bcb
Коммит
38dcca2379
|
@ -69,12 +69,12 @@ export async function searchForNodeModules(cwd: string, rootPath?: string): Prom
|
|||
|
||||
/**
|
||||
* Determine the root directory of a given project, by looking for a directory with an
|
||||
* NPM or yarn lockfile.
|
||||
* NPM or yarn lockfile or pnpm lockfile.
|
||||
*
|
||||
* @param cwd the initial directory to traverse
|
||||
*/
|
||||
export async function getProjectRootPath(cwd: string): Promise<string> {
|
||||
for (const lockFilename of ['yarn.lock', 'package-lock.json']) {
|
||||
for (const lockFilename of ['yarn.lock', 'package-lock.json', 'pnpm-lock.yaml']) {
|
||||
const pathGenerator: PathGeneratorFunction = (traversedPath) => path.join(traversedPath, lockFilename);
|
||||
const lockPaths = await traverseAncestorDirectories(cwd, pathGenerator, undefined, 1)
|
||||
if (lockPaths.length > 0) {
|
||||
|
|
|
@ -18,7 +18,7 @@ async function removeTempDir(): Promise<void> {
|
|||
describe('search-module', () => {
|
||||
describe('getProjectRootPath', () => {
|
||||
describe('multi-level workspace', () => {
|
||||
for (const lockFile of ['yarn.lock', 'package-lock.json']) {
|
||||
for (const lockFile of ['yarn.lock', 'package-lock.json', 'pnpm-lock.yaml']) {
|
||||
describe(lockFile, () => {
|
||||
before(async () => {
|
||||
await createTempDir();
|
||||
|
|
Загрузка…
Ссылка в новой задаче