node-reggie icon indicating copy to clipboard operation
node-reggie copied to clipboard

Import packages from registry.npmjs.org

Open sonoman opened this issue 11 years ago • 4 comments

I want to maintain a "snapshot" of packages I use for my products, as well as its dependencies. Is it possible ?

sonoman avatar Nov 04 '13 21:11 sonoman

Hi @sonoman, thank you for reporting the issue. See my comment in #9 for instructions on how to manually download packages from npmjs.org and store them in Reggie.

Since this requirement is recurring, I'll keep this issue open to serve as a reminded of a missing feature. My vision is to add a new command to the Reggie client that will do the snapshot in an automated way:

$ reggie mirror semver
$ reggie mirror semver@latest 
$ reggie mirror [email protected]

Having said that, I won't have bandwidth to implement this feature any time soon. I am happy to provide help and guidance if you (or anybody else) decide to contribute the implementation.

bajtos avatar Nov 05 '13 09:11 bajtos

there's a tool called npm-mirror that uses the same package.json format to specify which packages do you want to synchronize.....you could specify reggie mirror ./package.json

sonoman avatar Nov 05 '13 14:11 sonoman

I may be interested in taking this on.

How I'm seeing this working:

1. Download packages from npmjs.org into a local cache dir.
    a. If it is `reggie mirror semver`, it gets all versions, if a version is provided, then only that version.
2. Calls npm install --registry=reggie_url on the downloaded packages

@bajtos Were you thinking of running this as a one-time event or as a job that frequently checks?

paolodm avatar Nov 08 '13 15:11 paolodm

@paolodm Great!

Calls npm install --registry=reggie_url on the downloaded packages

I would prefer a solution that does not invoke npm. Dependencies should be (recursively) extracted from package.json or even directly from the data returned by npmjs.org. See how npm-mirror is doing this.

It would be super nice to extract the discovery of dependencies into a standalone module that can be used & shared by multiple projects - reggie, npm-mirror, even npm client itself.

Were you thinking of running this as a one-time event or as a job that frequently checks?

As an one-time event to keep reggie small and focused. There are already solutions for running a job periodically (e.g. cron or Windows Scheduler), there is no need to reinvent the wheel.

bajtos avatar Nov 08 '13 16:11 bajtos