Migrate all versions of a selected package from a registry to another one.
const migrate = require('npm-migrate')
const moduleName = 'my-private-module'
const from = 'http://your-old.private-registry.com:8080'
const to = 'http://nice-new.private-registry.org:8080'
// optional
const options = {
debug: false // default
}
migrate(moduleName, from, to, options)
.then((migrated) => console.log(migrated)) // list of migrated packages
.catch((err) => console.error(err))
- Fetches all versions (or just those not already migrated) as tarballs from old registry
- Extracts & updates
package.json
: thepublishConfig.registry
field to the new registry url - Publishes each version to the new registry
- Cleans up after itself
- The dates of every version published will be reset to the date and time you run this script
- The migrating user will be added as maintainer
- v1.2.0 - Work with scoped packages
- v1.3.0 - Compare both registries and migrate only the remaining versions not in the new registry