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

Rewrite the registry-url-in-lock-file RFC #99

Merged
merged 2 commits into from
Sep 15, 2018

Conversation

Gudahtt
Copy link
Member

@Gudahtt Gudahtt commented Aug 21, 2018

The registry-url-in-lock-file RFC was a proposal for allowing users to more easily switch between registries. The current problem with switching registries is that Yarn tries to use the cached tarball URL in the resolved field of the lockfile instead of the current registry when installing.

The original proposal was to remove the registry from the lockfile. This would force Yarn to use the current registry. Later in the discussion it was also proposed to follow the behavior of npm@5 and just ignore the resolved field.

Both of these solutions seemed to have the support of everyone involved in the discussion, but the concern of this being a breaking change was raised. So instead, a third proposal for an additional configuration field was what ended up being merged.

Circumstances have changed, and a major version bump is likely in the near future. Given that we can now make a breaking change, I am proposing that we rewrite this RFC to more closely match its original intention. This rewrite proposes that we solve the problem by adopting the same behavior as npm@5.

I have also updated the title of the RFC to better describe the proposal.

The `registry-url-in-lock-file` RFC was a proposal for allowing users to more
easily switch between registries. The current problem with switching
registries is that Yarn tries to use the cached tarball URL in the `resolved`
field of the lockfile instead of the current registry when installing.

The original proposal was to remove the registry from the lockfile. This would
force Yarn to use the current registry. Later in the discussion it was also
proposed to follow the behavior of `npm@5` and just ignore the `resolved`
field.

Both of these solutions seemed to have the support of everyone involved in the
discussion, but the concern of this being a breaking change was raised. So
instead, a third proposal for an additional configuration field was what ended
up being merged.

Circumstances have changed, and a major version bump is likely in the near
future. Given that we can now make a breaking change, I am proposing that we
rewrite this RFC to more closely match its original intention. This rewrite
proposes that we solve the problem by adopting the same behavior as `npm@5`.

I have also updated the title of the RFC to better match the proposal.
@Gudahtt Gudahtt force-pushed the update-registry-lockfile-RFC branch from 114089d to dfa7d49 Compare August 21, 2018 02:36

# Motivation

We currently have two internal registries/mirrors. We generate the lock file against one we have in
Copy link
Member Author

@Gudahtt Gudahtt Aug 21, 2018

Choose a reason for hiding this comment

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

I did make an attempt at including this use case, but I didn't understand it well enough to explain it.

The use cases I did include should suffice hopefully. But if someone would like to attempt incorporating this use case again, edits are welcome.

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 use case is largely solved by one of those two options:

  • Users could simply have a CI build step where they copy .yarnrc.ci into .yarnrc, or
  • Users could call Yarn with the --use-yarnrc .yarnrc.ci flag

This would let them define the registries they want to use on CI without too much hassle.

@Gudahtt Gudahtt changed the title This is a rewrite of the registry-url-in-lock-file RFC Rewrite of the registry-url-in-lock-file RFC Aug 21, 2018
@Gudahtt Gudahtt changed the title Rewrite of the registry-url-in-lock-file RFC Rewrite the registry-url-in-lock-file RFC Aug 21, 2018
Copy link
Member

@arcanis arcanis left a comment

Choose a reason for hiding this comment

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

I'm fine with those changes (one minor note is that I think we should remove the registry from the resolved field). Leaving the PR open to let others a chance to see it.


### Can non-scoped packages use alternate registries?

No, non-scoped packages would all use the same registry. This restriction simplifies the configuration, and keeps us in line with `npm`.
Copy link
Member

Choose a reason for hiding this comment

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

Well, they can use alternate registries, but on a "all or nothing basis". The technical answer is "yes" but your explanation is good 😛

Copy link
Member Author

@Gudahtt Gudahtt Aug 21, 2018

Choose a reason for hiding this comment

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

Ah... right 😛 I shall edit this to make that more clear.


### What about the `resolved` field in the lockfile?

The `resolved` field will not be used to determine which registry is used. Changes to to the `resolved` field, such as removing the registry, are outside the scope of this RFC.
Copy link
Member

Choose a reason for hiding this comment

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

Not that much - do you see a drawback removing it from the lockfile? Leaving it there seems confusing, since the lockfile would then contain "useless" data.

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 elaborated on this in a comment on the other PR.

But even if we do remove it, it had been my intention to submit a separate RFC for that step. They are definitely related, but the proposal in this RFC doesn't depend on changing the lockfile format. Because of that, I thought it might be helpful to separate the two ideas. Also it seemed like @bestander was asking for the original proposal to be split back in 2017, so I thought he might prefer it this way 😛 .

I am open to adding that to this RFC though, if that is preferred.

Copy link

Choose a reason for hiding this comment

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

@Gudahtt thank you for driving this work forward.

This RFC will help our organization work around the consequences of hard-coded registry URLs in the lock file.


# Motivation

We currently have two internal registries/mirrors. We generate the lock file against one we have in
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 use case is largely solved by one of those two options:

  • Users could simply have a CI build step where they copy .yarnrc.ci into .yarnrc, or
  • Users could call Yarn with the --use-yarnrc .yarnrc.ci flag

This would let them define the registries they want to use on CI without too much hassle.

@bestander
Copy link
Member

I love the proposal, thank you @Gudahtt for making it backwards compatible.
@arcanis approved it. I'll merge then

@bestander bestander merged commit e4e8fe5 into yarnpkg:master Sep 15, 2018
@bestander
Copy link
Member

@Gudahtt PR coming? ;)

@Gudahtt
Copy link
Member Author

Gudahtt commented Sep 16, 2018

Sure! I'll start work on it this weekend.

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.

4 participants