0

I am trying to set up a completely offline Verdaccio installation that I can use as a proxy for NPM packages for a small team of developers and for our build machine.

My challenge is that I would like to be able to update the offline npm packages from time to time (to add more packages). To do this, the only possibility I have is to use another machine (a laptop) that is outside this isolated network and has a separate Verdaccio installation and npm install the packages there. After installation I have the new tgz files in the storage folder. But my question is how do I merge the Storage folder from the offline Verdaccio installation with the Storage folder of the online one. Because I cannot do this manually, especially when you have packages with a lot of dependencies.

Is there some replication that I could easily setup (I am not an expert in CouchDb) or even a plain CLI instruction I could use? Or is there a way to achieve this with Verdaccio or some other utility?

Please bear in mind that this network is completely isolated (without network access) even if it is also used for development.

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
SmartDev
  • 2,802
  • 1
  • 17
  • 22
  • what you need is **cache** properly all dependencies in your storage folder. see this like: https://stackoverflow.com/questions/52649655/creating-a-replica-of-npm-registry-on-an-offline-machine/59517874#59517874 – AminRostami Jan 01 '20 at 10:43

2 Answers2

1

I just got the craziest idea that could be a good solution:

Whenever I will need to merge a new storage folder content, I will just copy it to a temporary location, start a new Verdaccio instance (with the storage at that location), then simply set the uplink of the main instance to the new/temporary one.

This way I will be able to run 'npm install' on the new packages on the main registry and this will automatically update the main storage folder (merge the databases). At the end I simply stop the second Verdaccio instance and cleanup the temp folder.

SmartDev
  • 2,802
  • 1
  • 17
  • 22
1

For this problem exactly I created this CLI tool: bulk-npm-publish.

How to use it:

  1. Copy the storage folder to your isolated network.
  2. Run bulk-npm-publish 3: Follow the steps (if you pass -i It will run interactively.
  3. Run the outputted publish script.

with this tool you can skip already existing packages.

Raz Luvaton
  • 3,166
  • 4
  • 21
  • 36