-
Notifications
You must be signed in to change notification settings - Fork 1k
Add post announcing new custom-host-suffix option #504
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| --- | ||
| layout : post | ||
| title : "Private Registry Support" | ||
| author : Lukas Spieß | ||
| author_url : "https://twitter.com/lumaxis" | ||
| date : 2017-05-19 12:00:00 | ||
| categories : announcements | ||
| share_text : "Yarn now supports even more private registries" | ||
| --- | ||
|
|
||
|
|
||
| Today, Yarn already supports a wide variety of different package feeds when fetching and downloading your dependencies. Up until now, there was however a small subset of public and private package feed providers that Yarn could not yet handle very well. One example of these package feed providers that were not yet supported was [Visual Studio Team Services](https://www.visualstudio.com/team-services/) (VSTS). | ||
|
|
||
| Let's explain why: | ||
|
|
||
| ### Registry and package location URL differences | ||
|
|
||
| Some registries, such as VSTS, use two slightly different URL structures for the location of the package feed and the location of the actual package archive binary itself. | ||
| For example, a private feed's URL would look like this: | ||
|
|
||
| ``` | ||
| // Package feed URL | ||
| https://$ACCOUNT_NAME.pkgs.visualstudio.com/_packaging/$FEED_NAME/npm/registry | ||
| ``` | ||
|
|
||
| but the URLs to fetch the actual tar archives would then be returned by the feed in this format: | ||
|
|
||
| ``` | ||
| // Package archive URL | ||
| https://$ACCOUNT_NAME.pkgs.visualstudio.com/_packaging/da6e033f-20ad-4ee1-a784-8995dd6836b72/npm/registry/@scope/package-name/-/package-name-0.0.1.tgz | ||
| ``` | ||
|
|
||
| As you can see, the archive's URL does not contain the actual feed name anymore but rather a random GUID, followed by the package name and version. This differing layout of the path part of the URL lead to Yarn not recognizing that the two URLs actually both do belong to a request to the same registry and would therefore refuse to download the package. | ||
|
|
||
| ### Introducing custom host suffixes | ||
|
|
||
| Starting with version `0.26.0`, Yarn now understands a new configuration option called `custom-host-suffix`. This allows you to keep the same strict URL validations for most of your package URLs but also selectively loosen that check for a specific registry provider so that Yarn will now match the URLs where the host part ends with the value from this new option. | ||
|
|
||
| Simply add `custom-host-suffix` to either your global user-level `.npmrc` or your project's individual `.npmrc` and Yarn will be able to download your packages as desired. | ||
| In the above example of Visual Studio Team Services, the `.npmrc` should contain an entry like this: | ||
|
|
||
| ``` | ||
| custom-host-suffix='pkgs.visualstudio.com' | ||
| ``` | ||
|
|
||
| We hope you will find this new option useful and are happy that Yarn can now be used in even more projects! | ||
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.
How about
.yarnrcwith an example?Uh oh!
There was an error while loading. Please reload this page.
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.
@bestander The
custom-host-suffixactually does not work with.yarnrcright now, as far as I can tell.I think
npm-registry.jsonly loads config values from.npmrc: https://github.com/yarnpkg/yarn/blob/master/src/registries/npm-registry.js#L132There 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.
Yeah but there us yarn-registry that inherits from npm-registry and reads .yarnrc.
Could you please check if yarnrc works as well?
I expect that it should work.
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.
Can confirm - doesn't work to add custom-host-suffix to .yarnrc with 0.26.0-20170524.1610. Had to put it into .npmrc and haven't investigated further.
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.
Ok, let's merge as is and iterate further