mirror of
https://github.com/pnpm/pnpm.git
synced 2026-04-28 02:53:15 -04:00
fix: only show save catalog skip warning when using pnpm add (#10041)
close #9662
This commit is contained in:
6
.changeset/three-islands-juggle.md
Normal file
6
.changeset/three-islands-juggle.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@pnpm/resolve-dependencies": patch
|
||||
pnpm: patch
|
||||
---
|
||||
|
||||
When using pnpm catalogs and running a normal `pnpm install`, pnpm produced false positive warnings for "_skip adding to the default catalog because it already exists_". This warning now only prints when using `pnpm add --save-catalog` as originally intended.
|
||||
@@ -245,6 +245,11 @@ export async function resolveDependencyTree<T> (
|
||||
for (const directDependencies of pkgAddressesByImporters) {
|
||||
for (const directDep of directDependencies as PkgAddress[]) {
|
||||
const { alias, normalizedBareSpecifier, version, saveCatalogName } = directDep
|
||||
|
||||
if (saveCatalogName == null) {
|
||||
continue
|
||||
}
|
||||
|
||||
const existingCatalog = opts.catalogs?.default?.[alias]
|
||||
if (existingCatalog != null) {
|
||||
if (existingCatalog !== normalizedBareSpecifier) {
|
||||
@@ -252,7 +257,7 @@ export async function resolveDependencyTree<T> (
|
||||
`Skip adding ${alias} to the default catalog because it already exists as ${existingCatalog}. Please use \`pnpm update\` to update the catalogs.`
|
||||
)
|
||||
}
|
||||
} else if (saveCatalogName != null && normalizedBareSpecifier != null && version != null) {
|
||||
} else if (normalizedBareSpecifier != null && version != null) {
|
||||
const userSpecifiedBareSpecifier = `catalog:${saveCatalogName === 'default' ? '' : saveCatalogName}`
|
||||
|
||||
// Attach metadata about how this new catalog dependency should be
|
||||
|
||||
Reference in New Issue
Block a user