From 0560ca63fb05d219fa5fca2dd9b6b6f4aff536fb Mon Sep 17 00:00:00 2001 From: Zoltan Kochan Date: Sat, 15 May 2021 21:27:05 +0300 Subject: [PATCH] fix(hoist): don't print a warning on skipped optional deps (#3454) close #2798 --- .changeset/tiny-foxes-roll.md | 5 +++++ packages/hoist/src/index.ts | 8 +++++--- 2 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 .changeset/tiny-foxes-roll.md diff --git a/.changeset/tiny-foxes-roll.md b/.changeset/tiny-foxes-roll.md new file mode 100644 index 0000000000..16a706ea5d --- /dev/null +++ b/.changeset/tiny-foxes-roll.md @@ -0,0 +1,5 @@ +--- +"@pnpm/hoist": patch +--- + +Do not print a warning if a skipped optional dependency cannot be hoisted. diff --git a/packages/hoist/src/index.ts b/packages/hoist/src/index.ts index e1c64eeb91..1456bbdfa8 100644 --- a/packages/hoist/src/index.ts +++ b/packages/hoist/src/index.ts @@ -6,13 +6,15 @@ import { nameVerFromPkgSnapshot, } from '@pnpm/lockfile-utils' import lockfileWalker, { LockfileWalkerStep } from '@pnpm/lockfile-walker' -import logger, { globalWarn } from '@pnpm/logger' +import logger from '@pnpm/logger' import matcher from '@pnpm/matcher' import symlinkDependency from '@pnpm/symlink-dependency' import { HoistedDependencies } from '@pnpm/types' import * as dp from 'dependency-path' import * as R from 'ramda' +const hoistLogger = logger('hoist') + export default async function hoistByLockfile ( opts: { lockfile: Lockfile @@ -194,8 +196,8 @@ async function symlinkHoistedDependencies ( .map(async ([depPath, pkgAliases]) => { const pkgSnapshot = opts.lockfile.packages![depPath] if (!pkgSnapshot) { - globalWarn(`Failed to find "${depPath}" in lockfile during hoisting. ` + - `Next aliases will not be hoisted: ${Object.keys(pkgAliases).join(', ')}`) + // This dependency is probably a skipped optional dependency. + hoistLogger.debug({ hoistFailedFor: depPath }) return } const pkgName = nameVerFromPkgSnapshot(depPath, pkgSnapshot).name