npm-republicate
Description
Replicates a module (along with its dependencies) from an NPM registry to another by publishing it (&& dependencies).
API
republicate(package, options, callback)
, where:
package
is an object containing thename
&&version
properties (for the module you want to replicate)options
is an object that can have the following properties: cacheDir / npmClient (see https://github.com/alessioalex/npm-pkginfo), to (target registry), from (destination registry), username, email, password (NPM data needed for auth when publishing a module), log (bunyan logger instance), all (if you want to republicate all versions of a package).
Use cases
- custom replication of the NPM registry (only replicate the modules you want)
Usage
var os = fse = bunyan = republicate = createMockServer = port server tmpDir pkgName pkgVersion logger; port = processenvPORT || 3333;// NOTE: this mock server is just for testing && example purposes,// it shouldn't be used as an NPM registry in productionserver = ;// tmpDir for cachetmpDir = os + '/npm-republicator-example';fse;fse; pkgName = processenvPKG || 'express';pkgVersion = processenvVER || 'latest'; logger = bunyan; ;
Note: to better view the logs for the default example you can use bunyan like so:
node republicate.js | bunyan -o short
Motivation
Creating private NPM registries with easy custom replication of modules.
How does it work?
Reads all the dependencies for a package, then iterates through each and publishes them.
Tests
npm test
License
MIT