Tuesday 23 April 2019

ELI5: npm-registry

Hello,while reading the thread over at /r/javascript about the NPM layoffs followed attempt to unionize, according to complaints, there was discussion about alternatives about npm hosting and someone mentioned yarn.I always thought yarn was "just" a new CLI program to access (by default) the npm repositories, like apt-get and aptitude for Debian repositories.But then someone posted a link to https://registry.yarnpkg.com/ and I got confused what registries are and how they work.I looked up the documentation for npm-registry, which says:To resolve packages by name and version, npm talks to a registry website that implements the CommonJS Package Registry specification for reading package info.But how do you resolve packages from something like the https://registry.yarnpkg.com/? It looks more like a stats counter for me.I found an 11 month old Hacker News submission Yarn registry was down, with comments that it's just a CNAME for https://registry.npmjs.org/, even though looking at it's content, both files differ slightly. But how can they both link to the npm repository, there isn't any npm URL - something like "repository": "npmjs.com" inside the yarn registry JSON file?​So, can anyone explain to me what a registry (in this case) is, and how >npm i babel-core or $ yarn add babel can figure out from those files how to find the URL to download the appropriate file?

Submitted April 23, 2019 at 03:28PM by 0xnoob

No comments:

Post a Comment