From a42c48b15f91bda9dd5ffc8fb6dcf16b5b6d2d3b Mon Sep 17 00:00:00 2001 From: Volodymyr Kolesnykov Date: Tue, 21 May 2024 21:00:35 +0300 Subject: [PATCH] fix(dev-env): plugin loading when using yarn to install VIP CLI --- src/lib/dev-environment/dev-environment-lando.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/lib/dev-environment/dev-environment-lando.ts b/src/lib/dev-environment/dev-environment-lando.ts index 5d9ac775c..c144124d0 100644 --- a/src/lib/dev-environment/dev-environment-lando.ts +++ b/src/lib/dev-environment/dev-environment-lando.ts @@ -8,7 +8,7 @@ import landoBuildTask from 'lando/plugins/lando-tooling/lib/build'; import { lookup } from 'node:dns/promises'; import { mkdir, rename } from 'node:fs/promises'; import { tmpdir } from 'node:os'; -import path from 'node:path'; +import path, { dirname } from 'node:path'; import xdgBasedir from 'xdg-basedir'; import { @@ -33,9 +33,10 @@ const debug = debugLib( DEBUG_KEY ); * @return {Promise} Lando configuration */ async function getLandoConfig(): Promise< LandoConfig > { - const nodeModulesPath = path.join( __dirname, '..', '..', '..', 'node_modules' ); - const landoPath = path.join( nodeModulesPath, 'lando' ); - const atLandoPath = path.join( nodeModulesPath, '@lando' ); + // The path will be smth like `yarn/global/node_modules/lando/lib/lando.js`; we need the path up to `lando` (inclusive) + const landoPath = dirname( dirname( require.resolve( 'lando' ) ) ); + // The path will be smth like `yarn/global/node_modules/@lando/compose/index.js`; we need the path up to `@lando` (inclusive) + const atLandoPath = dirname( dirname( require.resolve( '@lando/compose' ) ) ); debug( `Getting Lando config, using paths '${ landoPath }' and '${ atLandoPath }' for plugins` );