fix(hoist): don't print a warning on skipped optional deps (#3454)

close #2798
This commit is contained in:
Zoltan Kochan
2021-05-15 21:27:05 +03:00
committed by GitHub
parent 0332c8e6a3
commit 0560ca63fb
2 changed files with 10 additions and 3 deletions

View File

@@ -0,0 +1,5 @@
---
"@pnpm/hoist": patch
---
Do not print a warning if a skipped optional dependency cannot be hoisted.

View File

@@ -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