-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Resolve Git dependencies offline if tarball is available. #3000
Conversation
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 @raymondwang! Thanks for this PR, it looks pretty good! Would you mind fixing my nit comment and rebasing your work on the master branch?
@@ -201,7 +201,7 @@ export default class HostedGitResolver extends ExoticResolver { | |||
// If we can access the files over HTTP then we should as it's MUCH faster than git | |||
// archive and tarball unarchiving. The HTTP API is only available for public repos | |||
// though. | |||
if (await this.hasHTTPCapability(httpUrl)) { | |||
if (this.request.getLocked('tarball') || await this.hasHTTPCapability(httpUrl)) { |
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 works, but I think it would make more sense semantically speaking to just move those lines at the beginning of the resolve()
function instead.
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.
Yes, sounds good to me!
When running yarn offline, Git dependencies get trapped in hasHTTPCapabiity even though resolveOverHTTP defaults to returning the tarball. This change allows us to bypass that step altogether if the tarball already exists.
@arcanis Done! |
Thanks! |
I am correct in assuming that this is not part of the just released yarn 0.23.4? Because that one still fails for me with the "--offline" flag.
If so, what release would this be included in then? |
Yes. It will be released in the 0.24, which we want to publish later today. |
Summary
When running yarn offline, Git dependencies get trapped in
hasHTTPCapability
even thoughresolveOverHTTP
defaults to returning the tarball. This change allows us to bypass that step altogether if the tarball already exists.Resolves #1925.
Test plan
Create a
package.json
with a Git dependency, like:Then:
This should fail prior to this commit, but succeed after.
This change was first proposed in #2705, but @chrisgavin closed the PR and hasn't had a chance to revisit. I'm happy to add unit tests if/as needed, but may need some guidance on mocking offline functionality.