Upload downloaded third-party offline.
Hi, verdaccio team:
Appreciate your hard working, this project has been designed meticulously. Recently I changed a job, which can only work at a offline PC, so I have to set up my own registry with all dependencies, not only my private package. Firstly ,I use the store cache to transfer third party packages, but I cannot search them. Besides, some nested dependencies cannot be cached. So I implement my own 'publish' entry in the web, this button can upload node_modules or a built package or a group of packages(@xxx/ directory in node_modules). the process behind of this button is: 1. generate tar gzip file. 2. generate manifest object. 3. call publish node-api. I haven't implement the integrity code generation, so we need to use npm install --no-verify to skip integrity check. Besides, the upload process must be excuted in secure context(in localhost or in https address)
The modified code is here, welcome have a try for offline registry setup !
The coresponding docker image is here: https://hub.docker.com/repository/docker/hawtinzeng/verdaccio/general
There's a plugin for the "offline scenario": https://www.npmjs.com/package/verdaccio-offline-storage
The missing download of nested dependencies (only scoped ones), is a known issue https://github.com/verdaccio/verdaccio/issues/4070 (I'm working on it)
One more thing: By default, npm caches HTTP requests. This means npm will not request a package/tarball from Verdaccio if it is already cached. If you want to make sure everything is downloaded to Verdaccio, use the following:
npm config set prefer-online true