diff --git a/.yarn/versions/4e0a01ef.yml b/.yarn/versions/4e0a01ef.yml new file mode 100644 index 000000000000..b3aacffd1f6d --- /dev/null +++ b/.yarn/versions/4e0a01ef.yml @@ -0,0 +1,34 @@ +releases: + "@yarnpkg/cli": minor + "@yarnpkg/core": minor + "@yarnpkg/plugin-essentials": minor + +declined: + - "@yarnpkg/plugin-compat" + - "@yarnpkg/plugin-constraints" + - "@yarnpkg/plugin-dlx" + - "@yarnpkg/plugin-exec" + - "@yarnpkg/plugin-file" + - "@yarnpkg/plugin-git" + - "@yarnpkg/plugin-github" + - "@yarnpkg/plugin-http" + - "@yarnpkg/plugin-init" + - "@yarnpkg/plugin-interactive-tools" + - "@yarnpkg/plugin-link" + - "@yarnpkg/plugin-nm" + - "@yarnpkg/plugin-npm" + - "@yarnpkg/plugin-npm-cli" + - "@yarnpkg/plugin-pack" + - "@yarnpkg/plugin-patch" + - "@yarnpkg/plugin-pnp" + - "@yarnpkg/plugin-pnpm" + - "@yarnpkg/plugin-stage" + - "@yarnpkg/plugin-typescript" + - "@yarnpkg/plugin-version" + - "@yarnpkg/plugin-workspace-tools" + - "@yarnpkg/builder" + - "@yarnpkg/doctor" + - "@yarnpkg/extensions" + - "@yarnpkg/nm" + - "@yarnpkg/pnpify" + - "@yarnpkg/sdks" diff --git a/packages/plugin-essentials/sources/commands/explain/peerRequirements.ts b/packages/plugin-essentials/sources/commands/explain/peerRequirements.ts index 6455d31ad924..b2b6c39c0dc7 100644 --- a/packages/plugin-essentials/sources/commands/explain/peerRequirements.ts +++ b/packages/plugin-essentials/sources/commands/explain/peerRequirements.ts @@ -38,6 +38,10 @@ export default class ExplainPeerRequirementsCommand extends BaseCommand { ]), }); + warnings = Option.Boolean(`--warnings`, false, { + description: `Only show umnet peer requirements.`, + }); + async execute() { const configuration = await Configuration.find(this.context.cwd, this.context.plugins); const {project} = await Project.find(configuration, this.context.cwd); @@ -55,6 +59,7 @@ export default class ExplainPeerRequirementsCommand extends BaseCommand { } else { return await explainPeerRequirements(project, { stdout: this.context.stdout, + onlyWarnings: this.warnings, }); } } @@ -168,7 +173,7 @@ export async function explainPeerRequirement(peerRequirementsHash: string, proje return report.exitCode(); } -export async function explainPeerRequirements(project: Project, opts: {stdout: Writable}) { +export async function explainPeerRequirements(project: Project, opts: {stdout: Writable, onlyWarnings: boolean}) { const report = await StreamReport.start({ configuration: project.configuration, stdout: opts.stdout, @@ -190,6 +195,8 @@ export async function explainPeerRequirements(project: Project, opts: {stdout: W return warning.hash === peerRequirement.hash; }); + if (!warning && opts.onlyWarnings) continue; + const allRequests = [...structUtils.allPeerRequests(peerRequirement)]; let andOthers; if (allRequests.length > 2) diff --git a/packages/yarnpkg-core/sources/Project.ts b/packages/yarnpkg-core/sources/Project.ts index 0cdeed944125..f2061c1f5057 100644 --- a/packages/yarnpkg-core/sources/Project.ts +++ b/packages/yarnpkg-core/sources/Project.ts @@ -2779,6 +2779,6 @@ function emitPeerDependencyWarnings(project: Project, report: Report) { }); if (hasTransitiveWarnings) { - report.reportWarning(MessageName.EXPLAIN_PEER_DEPENDENCIES_CTA, `Some peer dependencies are incorrectly met by dependencies; run ${formatUtils.pretty(project.configuration, `yarn explain peer-requirements`, formatUtils.Type.CODE)} for details.`); + report.reportWarning(MessageName.EXPLAIN_PEER_DEPENDENCIES_CTA, `Some peer dependencies are incorrectly met by dependencies; run ${formatUtils.pretty(project.configuration, `yarn explain peer-requirements --warnings`, formatUtils.Type.CODE)} for details.`); } }