mozilla-b2g/npm-mirror

Mirror multiple versions of package not working

Closed this issue · 2 comments

Hello,

I tested npm-mirror within our company infrastructure with multiple projects/package.json files and found out that it is not possible to have multiple versions of a package cloned with npm-mirror.

test.json:

{
"dependencies": {
"bluebird": "3.4.0",
"bluebird": "3.3.4",
"bluebird": "2.9.26"
}
}

npm-mirror:

DEBUG=* npm-mirror \
--master http://registry.npmjs.org \
--manifests /Users/mdanek/Development/puppet/modules/mirror/files/npm/test.json \
--hostname http://secret-npm-mirror.com \
--root /Users/mdanek/Development/npmmirrorbin

local mirror:

mdanek/dev/npm-mirror/bluebird » ls -la
total 8
drwxr-xr-x 4 mdanek staff 136 Dec 12 13:45 .
drwxr-xr-x 4 mdanek staff 136 Dec 12 13:45 ..
drwxr-xr-x 4 mdanek staff 136 Dec 12 13:45 2.9.26
-rw-r--r-- 1 mdanek staff 918 Dec 12 13:45 index.json

So only the last defined package in the json files will be mirrored.

Is there a quick fix for that or is it possible to set it via cli commands?

Cheers,
Markus

The technical explanation is that your test.json is not valid JSON (having multiple keys with the same name, "bluebird"). My https://github.com/heikkipora/registry-sync suffers from the same issue at the moment.

@markusdanek: Actually, I just implemented support for that in registry-sync v1.2.6. Feel free to give it a spin :)