Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 contribution! It should be a
peerDependencies
instead. Can you please make the change?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.
Hi @Feiyang1 , thanks for the comment!
I have one question regarding this change:
So from my understanding, marking this as a
peerDependency
tells node that it should look for the module somewhere else in the dependency-tree, as it should already be installed.Yet in my case
@firebase/logger
is not included anywhere in the dependency-tree offirebase-admin
and will therefore not be found even when adding it as a peer dependency.In this case, would i still add
@firebase/logger
as apeerDependency
here and should i then add@firebase/logger
as adependency
infirebase-admin
?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.
@firebase/logger
is a dependency of@firebase/database
, so it should be installed.However, yarn pnp mode has stricter rules that prevent packages to require dependencies that they don't list explicitly, so I think that's why you are seeing the error.
Is there an easy way we can test it locally?
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.
So i tested it by adding the following entry to my
.yarnrc.yaml
file:After running
yarn install
, i got the following message:So it looks like yarn is searching for peer-dependencies of
@firebase/app-types
only one level up?After extending my
.yarnrc.yaml
and declaring@firebase/logger
as a dependency of@firebase/database-types
, the peer dependency is resolved and the compilation works.I'll look into it more tomorrow but at this point i think it is also possible that this might also be a bug of yarn.
I will change the dependency type to a
peerDependency
.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.
It kinda makes sense. The peerDependencies of package A should be provided by packages that directly depend on A.
So I think we may need to make
@firebase/logger
a dependency of@firebase/app-types
, and let's use0.2.6
instead of0.x
.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.
Looking at the code of yarn here it seems like it tries to follow the tree up.
I think that would also make sense for projects like
firebase
that exist (for the most of it) in a monorepo.Well, i can check with yarn if this is expected behaviour or if its a bug but for now i agree that we can add
@firebase/logger
as a dependency of@firebase/app-types
.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.
SG. Can you please add a changeset to this PR via the link in #5144 (comment) ?
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.
Sure thing, added the changeset.