Skip to content

Commit

Permalink
Merge pull request #1840 from Automattic/fix/yarn
Browse files Browse the repository at this point in the history
fix(dev-env): plugin loading when using yarn to install VIP CLI
  • Loading branch information
sjinks authored May 21, 2024
2 parents 1523dfd + a42c48b commit 58881aa
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/lib/dev-environment/dev-environment-lando.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -33,9 +33,10 @@ const debug = debugLib( DEBUG_KEY );
* @return {Promise<LandoConfig>} 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` );

Expand Down

0 comments on commit 58881aa

Please sign in to comment.