mirror of
https://github.com/pnpm/pnpm.git
synced 2026-05-31 03:58:11 -04:00
fix: clarify non-root resolutions warning (#11912)
This commit is contained in:
5
.changeset/clear-resolutions-warning.md
Normal file
5
.changeset/clear-resolutions-warning.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@pnpm/workspace.projects-reader": patch
|
||||
---
|
||||
|
||||
Clarify that non-root `resolutions` does not take effect and dependency overrides should be configured with `overrides` in `pnpm-workspace.yaml`.
|
||||
@@ -71,8 +71,12 @@ function checkNonRootProjectManifest ({ manifest, rootDir }: Project): void {
|
||||
}
|
||||
|
||||
function printNonRootFieldWarning (prefix: string, propertyPath: string): void {
|
||||
const message = propertyPath === 'resolutions'
|
||||
? `The field "${propertyPath}" was found in ${prefix}/package.json. This will not take effect. Configure dependency overrides in pnpm-workspace.yaml using the "overrides" field instead.`
|
||||
: `The field "${propertyPath}" was found in ${prefix}/package.json. This will not take effect. You should configure "${propertyPath}" at the root of the workspace instead.`
|
||||
|
||||
logger.warn({
|
||||
message: `The field "${propertyPath}" was found in ${prefix}/package.json. This will not take effect. You should configure "${propertyPath}" at the root of the workspace instead.`,
|
||||
message,
|
||||
prefix,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -49,6 +49,6 @@ test('findWorkspaceProjects() outputs warnings for non-root workspace project',
|
||||
jest.mocked(logger.warn).mock.calls
|
||||
.sort((a, b) => JSON.stringify(a).localeCompare(JSON.stringify(b)))
|
||||
).toStrictEqual([
|
||||
[{ prefix: barPath, message: `The field "resolutions" was found in ${barPath}/package.json. This will not take effect. You should configure "resolutions" at the root of the workspace instead.` }],
|
||||
[{ prefix: barPath, message: `The field "resolutions" was found in ${barPath}/package.json. This will not take effect. Configure dependency overrides in pnpm-workspace.yaml using the "overrides" field instead.` }],
|
||||
])
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user