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
handle git+ssh with semver #6239
Conversation
💖 Thanks for opening this pull request! 💖 |
offtopic: it is great to see pnpm can install git dependencies without a package.json 🎉 🚀 pnpm is a generic package manager 😱 Is that true? If so, I L O V E I T 😍 🤩 LATER EDIT: not quite apparently |
Could you add some tests? |
I added two tests (SCP-like and regular URL) for semver range. Both are failing on the current version highlighting the two bugs:
|
ok, also add a changeset for your changes.
|
Congrats on merging your first pull request! 🎉🎉🎉 |
5 years later I'm still pestering you with git+ssh+semver @zkochan :)
Currently pnpm fails to install
git+ssh://git@example.com:org/repo.git#semver:~1.2.3
(where example.com is an internal git server, not github.com) because it will end up looking for refspec/~1.2.3
which doesn't match any git tag. We end up there both because of escaping the colon insemver
, but also because we assume git+ssh URL cannot accept semver range spec.Trying to install
https://example.com/org/repo.git#semver:~1.2.3
works as expected.Looking through the code, we had quite a few patches to handle SCP-like urls, because we wanted to use
new URL
, and not the deprecatedurl.parse
.Yarn has this patch https://github.com/yarnpkg/yarn/blob/master/src/util/git.js#L103
but npm https://github.com/npm/git/blob/f60bb15da404679160c4bb6ad1c31a66d5f6ae72/lib/clone.js#L20 was mentioning the shim in https://github.com/npm/hosted-git-info/blob/f03bfbd3022c8f6283a991ff879ed97704ac35fa/lib/parse-url.js#L42
The shim didn't work out, so a similar take as yarn's landed in this PR.