Profpatsch / yarn2nix

Build and deploy node packages with nix from yarn.lock files.
MIT License
85 stars 21 forks source link

[documentation] private package example? #24

Open kidd opened 4 years ago

kidd commented 4 years ago

I'm quite new to nix. Even I got yarn2nix to work for 100% public dependencies, now an app I'm trying to package depends on a private repo.

The readme points somewhere to the nix docs about adding creds to netrc (I couldn't get that working .. :/), but I guess a common usecase for private packages is when they still live in the usual registry.nmpjs.org, but you'd need a token to get them.

The usual way is to npm config set //registry.npmjs.org/:_authToken=$MY_TOKEN, but I failed to get that working.

Could someone with more nix-fu add a snippet to solve this (if it's easy enough) in the readme?

Thanks!

Profpatsch commented 4 years ago

The readme points somewhere to the nix docs about adding creds to netrc (I couldn't get that working .. :/), but I guess a common usecase for private packages is when they still live in the usual registry.nmpjs.org, but you'd need a token to get them.

I wasn’t aware npm supports private packages that live in their registry, could you point me to documentation on how that works?

kidd commented 4 years ago

I'm not very familiar with those but here you have a couple of links on its usage. The info around that is very sparse, which I find it very strange :/

https://blog.npmjs.org/post/118393368555/deploying-with-npm-private-modules https://docs.npmjs.com/using-private-packages-in-a-ci-cd-workflow https://docs.npmjs.com/about-private-packages

In one of those links it tells about .npmrc file. Instead of that, what I do is to npm config set //registry.npmjs.org/:_authToken=123 (that I guess it ends up doing the same, but at least it's cli friendly).

Last question: Is there any relation between this current repo and https://github.com/moretea/yarn2nix ? I got confused a couple of times with those being named the same but being different (not forked one from the other).

Hacking around I got to build it once overriding preBuild phase and running that command. Unfortunately, I'm not sure how I did it and I 'lost' the changes that made it work. I'll keep trying and come back if I get to "reproduce" it :)

Cheers!

Profpatsch commented 4 years ago

Thanks, I’ll take a look.

Is there any relation between this current repo and https://github.com/moretea/yarn2nix ?

They try to achieve the same thing (thus the same name), but their implementation is independent of each other.