Hacker News new | ask | show | jobs
by swsieber 3086 days ago
Everybody is mad/disappointed at/by the NPM for their handling...

Does this have any real impact on the NPM package adoption though? There is no alternative node module package directory, is there?

It seems like any action they could have taken would have had exactly the same effect (well, maybe some prospective products don't adopt JS backends, but you have all webpack projects locked in pretty tight, right?)

1 comments

I've been using gitpkg (https://github.com/ramasilveyra/gitpkg) lately; it works pretty well. Basically lets you use a git repo as a package repo, instead of npm.

Very little about how I use npm requires it to be centralized; I don't ever search npm looking for a package to install; I find a package I want and then look to install it.

Couldn't you just use github IDs in your package.json directly? npm and yarn both have support for it.
Short answer: Sure, but it works much better with gitpkg.

Long answer: Sometimes you can do that, yes. But you'll run into issues with "modern" frontned toolchains and complicated packages where you want to write ES2017 code, transpile it with babel, bundle it with webpack, make a universal lib, etc., and push the result to your package repo, but not commit it to your git repo.

Gitpkg handles all the wierd corner cases, and lets you keep build artifacts out of your git repo, and raw source out of your package repos. And if you use github you can even use the github IDs in your package.json, but the result is going to be a lot better. If you're just writing a plain one file package for use in node that doesn't need any processing, eh, no need for gitpkg.