Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Add git+file:// URL protocol #3868

Closed
wants to merge 1 commit into from

5 participants

@tehsenaus

I added this to allow hosting private modules on a bare git repo, without needing to host that repo over HTTP or SSH.

I haven't run the full test suite yet as I'm behind a proxy which blocks git:// protocol, but other tests are passing.

@luk-

What does this allow us to do that we cannot already do using npm i ~/path/to/module/folder which currently work?

@tehsenaus

It allows use of bare git repos - npm currently complains about not finding the package.json. It also allows specific tags to be referenced, for versioning.

@luk-
@tehsenaus

Of course a bare git repo doesn't have a package.json... The contents of the repo on the other hand does. :)

@luk-
@tehsenaus

Deploying private modules via a git repo located on a shared drive. This mitigates the need for any central server to provide HTTP/SSH access.

Besides, file:/// is a protocol supported by git, I don't see why it shouldn't be supported by npm, especially when the implementation is such a small change!

@domenic
Collaborator

This seems great to me; what convinced me was

Besides, file:/// is a protocol supported by git, I don't see why it shouldn't be supported by npm, especially when the implementation is such a small change!

However I cannot merge due to #3948; tagging as ready-to-merge.

@robertkowalski
Collaborator

Seems I can test git related npm functionality soon in our test-suite! Great!

@robertkowalski
Collaborator

(without doing a network call to external dependencies)

@luk-
@robertkowalski
Collaborator

I totally understand your point @luk- - having a smarter feature would be really nice.

For me the userstory behind this feature is "I want to enable git from the local filesystem" and not "I want to install private marked repositories from the local filesystem". So for me the feature is a valid feature.

I already had an usecase for this, yesterday night for #4104 where I used a public repo on GitHub for testing the feature.

@luk-

The reason I'm being difficult about this is because the feature's and its caveat are close enough to another request: supporting local filesystem modules in package.json dependencies (regardless of if they're in a repo), since you can already npm install path/to/module/. I discussed this with Isaac about 2 months ago, and his main requirement for supporting something like this would be to ensure that the modules are marked as private, something I agree with.

This requirement is to help prevent modules being published with what I would call an impossible dependency. A user can't install a module if one of its required dependencies is a reference to a nonexistent location on a local filesystem. I don't want to get into the nightmareish dependency situation in which people are publishing modules on npm that require users to have something installed on their system already — not any more than we already are in a few cases. You could make the argument that someone is currently able to include an invalid dependency, but I don't think that means we should add a feature that could bring forth havoc to thousands of users who expect their node modules to Just Work.

I guess you're looking at this from an agile point of view, which is fine if it works for you, but consider this userstory blocked by another userstory: modules cannot use dependencies on a filesystem path unless they are private modules.

@robertkowalski
Collaborator

That is really reasonable. Thanks for the explanation.

@robertkowalski
Collaborator

was quite easy to build, build this today.

@robertkowalski robertkowalski referenced this pull request from a commit in robertkowalski/npm
@robertkowalski robertkowalski Allow installations from git+file:// if the package is private
Throw error, in case they should be published
See #3868
ea32837
@robertkowalski robertkowalski referenced this pull request from a commit in robertkowalski/npm
@robertkowalski robertkowalski Allow installations from git+file:// if the package is private
Throw error, in case packages are going to be published
See #3868
fbd5189
@othiym23 othiym23 added review and removed ready-to-merge! labels
@othiym23 othiym23 added this to the 2.0.0 milestone
@othiym23 othiym23 removed this from the 2.0.0 milestone
@robertkowalski
Collaborator

this is possible now: #4108

sorry for the delay @tehsenaus

@othiym23 othiym23 removed the review label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 6, 2013
  1. @tehsenaus
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 0 deletions.
  1. +1 −0  lib/utils/is-git-url.js
View
1  lib/utils/is-git-url.js
@@ -8,6 +8,7 @@ function isGitUrl (url) {
case "git+rsync:":
case "git+ftp:":
case "git+ssh:":
+ case "git+file:":
return true
}
}
Something went wrong with that request. Please try again.