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

Support disturl from npm config #363

Closed
cjbarth opened this issue Jul 13, 2016 · 7 comments
Closed

Support disturl from npm config #363

cjbarth opened this issue Jul 13, 2016 · 7 comments

Comments

@cjbarth
Copy link

cjbarth commented Jul 13, 2016

Node supports an npm config distrul to set a custom distribution source. Perhaps n should leverage that. It would certainly make setup more consistent.

@qw3rtman
Copy link
Collaborator

Correct me if I'm wrong, but isn't disturl for a custom distribution source for npm modules rather than for node distribution sources?

@cjbarth
Copy link
Author

cjbarth commented Jul 13, 2016

It doesn't seem to be very well documented anywhere, but disturl is for the NodeJs sources, and registry is for the npm registry. This might help a little: https://github.com/cnpm/cnpmjs.org/wiki/Deploy-a-private-npm-registry-in-5-minutes

You can see there it references https://npm.taobao.org/mirrors/node, which points to NodeJs, not npm. There are other references like http://www.jianshu.com/p/ad29d97b0e9d that talk about this too. VSCode uses this technique: microsoft/vscode@8334c89. Additionally, node-gyp uses this. See npm/npm#6923 and http://stackoverflow.com/questions/18503373/how-to-set-tarball-url-of-node-gyp-via-environment-variable

I've been using this on my machine quite successfully.

@qw3rtman
Copy link
Collaborator

qw3rtman commented Jul 13, 2016

Thanks for the references. I learned something new today. 😄

Although disturl isn't too well-known and the chances of it being set inadvertently are low (i.e: someone would likely know if they have it set), I think it's better to err on the safe side and check PROJECT_URL first as described here and then check disturl if PROJECT_URL isn't set.

@cjbarth
Copy link
Author

cjbarth commented Jul 14, 2016

That seems reasonable to me. So, it would be check NODE_MIRROR, check PROJECT_URL, and finally check disturl? That would have the benefit of not breaking anyone. Of course, the documentation should be updated to reference disturl. I would normally contribute a PR for this, but my shell scripting leaves a lot to be desired. Sorry.

@qw3rtman
Copy link
Collaborator

qw3rtman commented Jul 15, 2016

Yes, that's what I was going for.

I'm pretty sure this wouldn't break anyone's n, but since we can't be sure that someone isn't using disturl (and thus isn't expecting n to work any differently), I think this would warrant bumping major.

@joaomoreno
Copy link

This would be awesome.

@shadowspawn
Copy link
Collaborator

This issue has not had any activity in over six months. It isn't likely to get acted on due to this report.

Feel free to open a new issue if it comes up again, with new information and renewed interest.

Thank you for your contributions.

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

No branches or pull requests

4 participants