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

Fix: install peerDeps which is not optional on headless install #5243

Merged

Conversation

Shinyaigeek
Copy link
Member

Fixes: #5213

I investigated #5213, and I found headless install, which is the faster installation way with lock file, skips to install peerDependencies. This is caused by this change. I looked up the change and infered that the change seems to be applied to skip to install optional dependencies but peerDependencies is also skipped. I think the ideal behavior is to skip only peerDependencies which is optional, so I fixed so.

@welcome
Copy link

welcome bot commented Aug 22, 2022

💖 Thanks for opening this pull request! 💖
Please be patient and we will get back to you as soon as we can.

"name": "reinstall-peer-deps",
"version": "1.0.0",
"devDependencies": {
"eslint-config-standard": "17.0.0"
Copy link
Member Author

Choose a reason for hiding this comment

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

I don’t have confidence about how to write dependencies for the test, so if there is a better way, I would be happy if you point it out.

Copy link
Member

Choose a reason for hiding this comment

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

We use custom packages stored in https://github.com/pnpm/registry-mock for e2e. Those packages are small and faster to install, so tests are fast.

@@ -162,7 +162,7 @@ function pkgAllDeps (
...(opts.include.optionalDependencies ? pkgSnapshot.optionalDependencies : {}),
})
.map(([pkgName, ref]) => {
if (pkgSnapshot.peerDependencies?.[pkgName]) return null
if (pkgSnapshot.peerDependenciesMeta?.[pkgName]?.optional) return null
Copy link
Member

Choose a reason for hiding this comment

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

I honestly don't remember why this if statement is needed here. Maybe it should be removed.

@zkochan zkochan added this to the v7.9 milestone Aug 23, 2022
@zkochan zkochan merged commit 1beb1b4 into pnpm:main Aug 23, 2022
@welcome
Copy link

welcome bot commented Aug 23, 2022

Congrats on merging your first pull request! 🎉🎉🎉

This was referenced Aug 29, 2022
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.

pnpm not install peers on reinstall
2 participants