Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add warnings option for explain peer-requirements #6467

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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
23 changes: 23 additions & 0 deletions .yarn/versions/4e0a01ef.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
releases:
"@yarnpkg/cli": minor
"@yarnpkg/plugin-essentials": minor

declined:
- "@yarnpkg/plugin-compat"
- "@yarnpkg/plugin-constraints"
- "@yarnpkg/plugin-dlx"
- "@yarnpkg/plugin-init"
- "@yarnpkg/plugin-interactive-tools"
- "@yarnpkg/plugin-nm"
- "@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/core"
- "@yarnpkg/doctor"
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ export default class ExplainPeerRequirementsCommand extends BaseCommand {
]),
});

warnings = Option.Boolean(`--warnings`, {
description: `Only show umnet peer requirements.`,
required: false,
});

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 +60,7 @@ export default class ExplainPeerRequirementsCommand extends BaseCommand {
} else {
return await explainPeerRequirements(project, {
stdout: this.context.stdout,
onlyWarnings: this.warnings ?? false,
merceyz marked this conversation as resolved.
Show resolved Hide resolved
});
}
}
Expand Down Expand Up @@ -168,7 +174,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 +196,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
Loading