fix: report an info log instead of a warning on binary conflicts

Yarn and npm are not printing any info in such cases,
when several dependencies try to create the same binary.
It is better if pnpm will print an info message, not a warning.

close #2823
PR  #2843
This commit is contained in:
Zoltan Kochan
2020-09-10 11:46:59 +03:00
committed by GitHub
parent 09b42d3ab0
commit 968c26470c
6 changed files with 14 additions and 6 deletions

View File

@@ -0,0 +1,8 @@
---
"@pnpm/headless": patch
"@pnpm/hoist": patch
"@pnpm/plugin-commands-rebuild": patch
"supi": patch
---
Report an info log instead of a warning when some binaries cannot be linked.

View File

@@ -234,7 +234,7 @@ export default async (opts: HeadlessOptions) => {
})
function warn (message: string) {
logger.warn({
logger.info({
message,
prefix: lockfileDir,
})
@@ -369,7 +369,7 @@ function linkBinsOfImporter (
rootDir: string
}
) {
const warn = (message: string) => logger.warn({ message, prefix: rootDir })
const warn = (message: string) => logger.info({ message, prefix: rootDir })
return linkBins(modulesDir, binsDir, {
allowExoticManifests: true,
warn,

View File

@@ -89,7 +89,7 @@ async function linkAllBins (modulesDir: string) {
const bin = path.join(modulesDir, '.bin')
const warn: WarnFunction = (message, code) => {
if (code === 'BINARIES_CONFLICT') return
logger.warn({ message, prefix: path.join(modulesDir, '../..') })
logger.info({ message, prefix: path.join(modulesDir, '../..') })
}
try {
await linkBins(modulesDir, bin, { allowExoticManifests: true, warn })

View File

@@ -259,7 +259,7 @@ async function _rebuild (
groups: [nodesToBuildAndTransitiveArray],
})
const chunks = graphSequencerResult.chunks as string[][]
const warn = (message: string) => logger.warn({ message, prefix: opts.dir })
const warn = (message: string) => logger.info({ message, prefix: opts.dir })
const groups = chunks.map((chunk) => chunk.filter((depPath) => ctx.pkgsToRebuild.has(depPath)).map((depPath) =>
async () => {
const pkgSnapshot = pkgSnapshots[depPath]

View File

@@ -840,7 +840,7 @@ function prefIsLocalTarball (pref: string) {
const limitLinking = pLimit(16)
function linkBinsOfImporter ({ modulesDir, binsDir, rootDir }: ImporterToResolve) {
const warn = (message: string) => logger.warn({ message, prefix: rootDir })
const warn = (message: string) => logger.info({ message, prefix: rootDir })
return linkBins(modulesDir, binsDir, { allowExoticManifests: true, warn })
}

View File

@@ -141,7 +141,7 @@ export default async function link (
const linkToBin = maybeOpts?.linkToBin ?? path.join(destModules, '.bin')
await linkBinsOfPackages(linkedPkgs.map((p) => ({ manifest: p.manifest, location: p.path })), linkToBin, {
warn: (message: string) => logger.warn({ message, prefix: opts.dir }),
warn: (message: string) => logger.info({ message, prefix: opts.dir }),
})
let newPkg!: ProjectManifest