Skip to content

fix(core): warn for workspace dev peer fallbacks#7142

Open
puneetdixit200 wants to merge 3 commits into
yarnpkg:masterfrom
puneetdixit200:fix-dev-peer-fallback-warning
Open

fix(core): warn for workspace dev peer fallbacks#7142
puneetdixit200 wants to merge 3 commits into
yarnpkg:masterfrom
puneetdixit200:fix-dev-peer-fallback-warning

Conversation

@puneetdixit200

Copy link
Copy Markdown

Summary

  • add a dedicated peer warning when a workspace peer is only satisfied by a devDependency
  • cover both requester-local devDependency fallbacks and parent workspace devDependencies
  • update yarn explain peer-requirements output for the new case

Fixes #7139.

Testing

  • git diff --check
  • corepack yarn typecheck:all
  • corepack yarn workspace @yarnpkg/cli build:cli --no-git-hash
  • corepack yarn test:integration pkg-tests-specs/sources/features/peerDependenciesMeta.test.ts -t "workspace peer dependency is satisfied" --runInBand

@StantonMatt

Copy link
Copy Markdown
Contributor

I took a pass at this against the current tree since it has been sitting for a bit.

On PR head debcf090, I rebuilt @yarnpkg/cli and ran the focused peerDependenciesMeta.test.ts integration file (9/9), touched-file ESLint, yarn typecheck:all, and git diff --check origin/master...HEAD.

I also merged it into current origin/master (878edb3c) in a scratch worktree, rebuilt the bundle as 4.16.0, and reran the same focused integration file (9/9), touched-file ESLint, yarn typecheck:all, and diff check. The two cases from #7139 both emit YN0093, and yarn explain peer-requirements distinguishes the requester-devDependency fallback from the parent-devDependency case.

One caveat: all visible GitHub Actions jobs are green, with only the expected big-endian skip, but the Netlify deploy-preview context is still red (state: error on deploy 6a0c7b0e8960990008e32aa5). I couldn't see public build messages for that deploy, so it likely needs a maintainer-side rerun or Netlify-side check before merge.

@clemyan clemyan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. There needs to be an additional criterion to trigger the new warnings: that the workspace-workspace dependency must not be dev-only
  2. If a dev-dependency fallback forwards the peer request anyway, I think the "dev-only fallback" case can be handled as a "peer not provided" warning?

Comment thread .yarn/versions/7139-dev-peer-fallback.yml Outdated
Comment thread packages/yarnpkg-core/sources/MessageName.ts
Comment thread packages/yarnpkg-core/sources/Project.ts Outdated
Comment thread packages/yarnpkg-core/sources/Project.ts Outdated
Comment thread packages/yarnpkg-core/sources/Project.ts Outdated
Comment thread packages/plugin-essentials/sources/commands/explain/peerRequirements.ts Outdated
Comment thread packages/plugin-essentials/sources/commands/explain/peerRequirements.ts Outdated
Comment thread packages/yarnpkg-core/sources/Project.ts Outdated
@puneetdixit200

Copy link
Copy Markdown
Author

Updated in 351158b2.

What changed:

  • added the @yarnpkg/cli release entry
  • documented YN0093 in the error-code docs
  • removed the root-workspace exception for devDependency fallback warnings
  • adjusted the warning text/requester selection for devDependency fallbacks
  • added acceptance coverage for root-workspace fallback and the updated warning text

Verification:

  • yarn build:cli
  • yarn workspace acceptance-tests test:integration pkg-tests-specs/sources/features/peerDependenciesMeta.test.ts --runInBand
  • yarn typecheck:all
  • PATH="$HOME/.nvm/versions/node/v22.22.3/bin:$PATH" yarn test:lint
  • yarn version check
  • yarn constraints
  • yarn install --immutable
  • git diff --check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug?]: Missing peer dependency warning is masked by workspace devDependency fallback

3 participants