-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fixing dependencies to support yarn2 strict mode #6942
Conversation
Signed-off-by: Dmitry Zelenetskiy <[email protected]>
2145fe5
to
6a9d2e1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! I've left some initial remarks 👇
"@loopback/core": "^2.13.1" | ||
}, | ||
"dependencies": { | ||
"@loopback/repository": "^3.3.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would Yarn2 PnP be satisfied with it being referenced as a peerDependency
instead?
The reason for peerDependency
is so that only a single version of the package is used across the project and its dependencies (See #5959). Adding @loopback/repository
as a hard dependency would break this paradigm.
Though it got me curious if there's any other LB4 packages that have the same issue.
We also probably should update our CI pipeline to test with Yarn2 PnP.
"@loopback/core": "^2.13.1" | |
}, | |
"dependencies": { | |
"@loopback/repository": "^3.3.0", | |
"@loopback/core": "^2.13.1" | |
"@loopback/repository": "^3.3.0" | |
}, | |
"dependencies": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-1. Our extensions are intentionally using peer dependencies for @loopback/repository
, as explained in the comment above.
To fix the problem you are observing with Yarn2 PnP, we should find the place that's depending on @loopback/openapi-v3
but not fulfilling it's peer dependency on @loopback/repository
. I think we need to add @loopback/repository
to peerDependencies
of @loopback/rest
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also probably should update our CI pipeline to test with Yarn2 PnP.
That's a great idea 👍 Would you @achrinza mind opening a new GH issue for that?
@@ -10,6 +10,7 @@ | |||
"access": "public" | |||
}, | |||
"dependencies": { | |||
"@apidevtools/swagger-parser": "^10.0.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason/benefit for the switch? AFAIK, both are actively maintained as aliases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not mix multiple kinds of changes in a single pull request please.
Either switch the swagger parser implementation, or fix dependencies to enable yarn2, but don't do both.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If adding support for yarn2/pnp, we should probably be diligent and also consider updating the travis configuration to support yarn2-based installations in addition to the current npm ci
install.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @zemd for the pull request. I agree we should support Yarn2 strict mode 👍
I find several aspects of your proposal problematic, please take a look at my comments below 👇🏻
@@ -38,3 +38,6 @@ benchmark/dist | |||
# Docs preview | |||
docs/_loopback.io/ | |||
docs/_preview/ | |||
|
|||
# IDE files | |||
/.idea |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we are intentionally not listing .idea files in .gitignore
, advising users to setup a global ignore rule instead.
If you think it's time to change that, then please open a new pull request where we can discuss the change on it's own, independently on feature/bug fix work.
@@ -10,6 +10,7 @@ | |||
"access": "public" | |||
}, | |||
"dependencies": { | |||
"@apidevtools/swagger-parser": "^10.0.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not mix multiple kinds of changes in a single pull request please.
Either switch the swagger parser implementation, or fix dependencies to enable yarn2, but don't do both.
"@loopback/core": "^2.13.1" | ||
}, | ||
"dependencies": { | ||
"@loopback/repository": "^3.3.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-1. Our extensions are intentionally using peer dependencies for @loopback/repository
, as explained in the comment above.
To fix the problem you are observing with Yarn2 PnP, we should find the place that's depending on @loopback/openapi-v3
but not fulfilling it's peer dependency on @loopback/repository
. I think we need to add @loopback/repository
to peerDependencies
of @loopback/rest
.
"@loopback/core": "^2.13.1" | ||
}, | ||
"dependencies": { | ||
"@loopback/repository": "^3.3.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also probably should update our CI pipeline to test with Yarn2 PnP.
That's a great idea 👍 Would you @achrinza mind opening a new GH issue for that?
This pull request has been marked stale because it has not seen activity within two months. It will be closed within 14 days of being stale unless there is new activity. |
This pull request has been closed due to continued inactivity. If you are interested in finishing the proposed changes, then feel free to re-open this pull request or open a new one. |
Yarn2 PnP strict mode requires that dependencies were strictly defined within packages which use them and yarn2 throw an exception during the project launch.
Checklist
npm test
passes on your machinepackages/cli
were updatedexamples/*
were updated👉 Check out how to submit a PR 👈