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

[breaking?] - When using offline mirror yarn.lock does not change anymore #2970

Merged
merged 8 commits into from
Mar 28, 2017

Conversation

arcanis
Copy link
Member

@arcanis arcanis commented Mar 22, 2017

Summary

Related rfc : yarnpkg/rfcs#51

When enabling the offline mirror, Yarn updates the lockfile by stripping the registry URL from its resolved fields. This feature aims to simplify this process by making such an update unneeded.

Related issues: #393 / #394

Test plan

All tests should pass fine. I had a rewrite a few because of the nature of this change, but the fixtures stay the same (backward compatibility is preserved).

@bestander
Copy link
Member

How does it handle backwards compatibility?
I see that you did not change existing yarn.lock files, so it should be seamless I suppose?

@arcanis
Copy link
Member Author

arcanis commented Mar 23, 2017

Yep. Basically, if we have an URL, the offline cache filename is derived from the basename of this URL. If we have a path, then it is the offline cache filename. That should work with both old & new lockfiles.

@bestander
Copy link
Member

You have lint errors and 3 tests are failing.
1 of them might be flaky though

package.json Outdated
@@ -15,6 +15,7 @@
"death": "^1.0.0",
"debug": "^2.2.0",
"detect-indent": "^5.0.0",
"flow": "^0.2.3",
Copy link
Member

Choose a reason for hiding this comment

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

why do you need flow in deps?

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 tried last friday to bump Flow's version to check if my issue was fixed in the new versions, but forgot to rollback the change.

} else {
return this.fetchFromExternal();
async getLocalAvailabilityStatus(): Promise<bool> {
const tarballLegacyMirrorPath = this.getTarballMirrorPath({withCommit: false});
Copy link
Member

Choose a reason for hiding this comment

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

I think this justifies a comment explaining what is legacyMirrorPath and why we support it

});
});
}

async fetchFromExternal(): Promise<FetchedOverride> {
const commit = this.hash;
invariant(commit, 'Commit hash required');
const hash = this.hash; // if we don't store it in a temp variable, flow will not persist its invariant state
Copy link
Member

Choose a reason for hiding this comment

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

This is quite a common pattern in flow, you probably don't need to add a comment to describe it.
If someone decides to inline the variable flow won't let them anyway :)

Also I think we don't add comments on the same line with code (I might be wrong though)

@arcanis
Copy link
Member Author

arcanis commented Mar 28, 2017

👍

@bestander bestander changed the title Lockfile resolution online ⇄ offline [breaking?] - When using offline mirror yarn.lock does not change anymore Mar 28, 2017
@bestander bestander merged commit eac1836 into yarnpkg:master Mar 28, 2017
@zertosh zertosh mentioned this pull request Apr 5, 2017
@troyastorino
Copy link

Does this mean that the description of the lockfile in the offline-mirror blog post isn't accurate anymore?

If so, should probably either update the blog post, or port the content to the docs page that links to the blog post and update the content there

@bestander
Copy link
Member

bestander commented Apr 19, 2017 via email

@troyastorino
Copy link

Sure, happy to give it a go! I'm somewhat new to yarn, and I stumbled on this trying to setup the offline mirror cache for a sprawling multi-package repo (haven't gotten it working yet), so I want to make sure I understand what's going on:

  • The lockfile should look the same whether or not the offline mirror is used?
  • A decent way to debug whether offline-mirror is working would be to run yarn --offline after you've cleared out your yarn cache?

@Sunyang730
Copy link

Doesn't seems like the blog post is up to date. I will create a PR for that

@bestander
Copy link
Member

bestander commented Apr 25, 2017 via email

@griffinmichl
Copy link

Does this solve: #3154?

@bestander
Copy link
Member

Git dependencies should still work but there can be an edge case where it broke, thanks for linking

@griffinmichl
Copy link

Another potentially related ticket: #3194

@ericgundrum
Copy link

ericgundrum commented May 18, 2017

This change has broken git+https dependencies as described in #3309. There is a mismatch between the calculated hash and the expected hash.

@bestander
Copy link
Member

Yeah, we are on it

@steveax
Copy link

steveax commented Apr 25, 2018

For anyone else wondering if the docs for offline mirror are up-to-date, they were updated after this was merged

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.

7 participants