Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .yarn/versions/4e0a01ef.yml
Original file line number Diff line number Diff line change
@@ -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"
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -55,6 +59,7 @@ export default class ExplainPeerRequirementsCommand extends BaseCommand {
} else {
return await explainPeerRequirements(project, {
stdout: this.context.stdout,
onlyWarnings: this.warnings,
});
}
}
Expand Down Expand Up @@ -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,
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion packages/yarnpkg-core/sources/Project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.`);
}
}