-
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
Use shortand for gitlab dependencies #2774
Comments
Feel free to send a pull request adding this if you like. |
If I have time it'll be a pleasure! |
I investigated and discovered that yarn is totally capable to resolve that kind of dependency references (i.e. gitlab:mygitlabuser/myproject). The problem is, it is not able to download private packages. On the opposite npm is capable of doing it. The problem, I think, is that npm resolves the shorthand into the url
while yarn transforms it into
and so, it encounters authentication problems because it isn't using ssh. |
Or maybe that url is only used to get back the ref from the repository. In any case npm does something different to retrieve it. |
This line here tries to check to see if accessing a private repo would work over HTTP:
it always seems to pass, if you change it to return false, packages will be installed via git successfully, but will be slower. I wonder if a "prefer git" CLI option could be used here, or have a better way of checking if a repo is available over HTTP. Is defaulting shortened git urls to use git by default rather than HTTP a more expected result (although slower)? |
Npm checks http first,for what I can see in the logs,than it fallbacks to git+ssh |
suffering same problem |
Working on a PR to solve this issue: #2992 |
Version 0.23 fixes URLs in the format of Seems like a problem with the regex at: https://github.com/yarnpkg/yarn/blob/master/src/util/git.js#L62 |
New PR to allow more git URL formats: #3445 |
The code around this functionality is quite a lot cleaner now so if anyone wants to give a shot at submitting a PR, now is a great time :) |
What is the current behavior?
yarn add "gitlab:mygitlabuser/myproject"
gives an error
What is the expected behavior?
Should behave the same as
npm install -S "gitlab:mygitlabuser/myproject"
With npm this is a valid dependency also in package.json, while it doesn't work with yarn. This is actually a simple shorthand for a complete git url and work the same for bitbucket and gist
Please mention your node.js, yarn and operating system version.
node v7.6.0 on Kde Neon (linux 4.4.0-64-generic)
The text was updated successfully, but these errors were encountered: