GithubHelp home page GithubHelp logo

npm-copy's Introduction

npm-copy

A utility to copy packages from one NPM server to another.

build status npm version MIT license we're hiring

We wrote this while migrating from Nodejitsu's (deprecated) private NPM service to our own deployment of Sinopia. For the list of modules you provide, it will find all of the published versions on the from repository, and publish them on the to repository. It's that easy. It's also idempotent and prints a warning if a particular version already exists on the to repo.

Usage

The example should explain things. We accept either token auth or username/password auth.

npm install -g npm-copy
npm-copy --from https://old.npm.mycorp.com --from-token foo --to https://new.npm.mycorp.com --to-username bob --to-password secret --to-email [email protected] mycorp-logger mycorp-stats

Contributing

Please follow our Code of Conduct when contributing to this project.

$ git clone https://github.com/goodeggs/npm-copy && cd npm-copy
$ npm install
$ npm test

Module scaffold generated by generator-goodeggs-npm.

npm-copy's People

Contributors

bobzoller avatar goodeggs-mk avatar goodeggs-terraformer avatar jylitalo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

npm-copy's Issues

Do not enforce credentials on --from

Our source repository is somewhat broken and will actually fail as soon as you try to authenticate to it (Nexus).

Can there be a way to simply not specify credentials to from?

If --from credentials are not specified, the auth parameter will be omitted. This would work great for public --from repositories.

Unable to copy scoped packages

Hi,
I'm using this to migrate packages from Proget to Nexus RM 3.13.0-01. All unscoped packages migrate fine, however scoped ones throw an exception thus:

npm-copy --from https://proget.redacted.com/npm/private-npm --from-username XXX --from-password XXX --to https://nxrm.redacted.com/repository/npm-private --to-username XXX --to-password XXX --to-email [email protected] @my_scope/my_component

info attempt registry request try #1 at 8:18:26 AM
http request GET https://proget.redacted.com/npm/private-npm/@my_scope/my_component
http 200 https://proget.redacted.com/npm/private-npm/@my_scope/my_component
info attempt registry request try #1 at 8:18:28 AM
http request GET https://nxrm.redacted.com/repository/npm-private/@my_scope/my_component
http 404 https://nxrm.redacted.com/repository/npm-private/@my_scope/my_component
info attempt registry request try #1 at 8:18:28 AM
http fetch GET https://proget.redacted.com/npm/private-npm/@my_scope/my_component/-/my_component-0.0.31.tgz
http fetch 200 https://proget.redacted.com/npm/private-npm/@my_scope/my_component/-/my_component-0.0.31.tgz
info attempt registry request try #1 at 8:18:28 AM
http request PUT https://nxrm.redacted.com/repository/npm-private/@my_scope/@my_scope%2fmy_component
http 400 https://nxrm.redacted.com/repository/npm-private/@my_scope/@my_scope%2fmy_component
ERR! publish Failed PUT 400
Error: 400 Bad Request
    at Object.wait (/usr/lib/node_modules/npm-copy/node_modules/fibers/future.js:449:15)
    at RegClient.<anonymous> (/usr/lib/node_modules/npm-copy/node_modules/fibrous/lib/fibrous.js:66:47)
    at Object.publish (/usr/lib/node_modules/npm-copy/node_modules/fibrous/lib/fibrous.js:101:47)
    at /usr/lib/node_modules/npm-copy/lib/cli.js:84:26
    at /usr/lib/node_modules/npm-copy/lib/cli.js:101:7
    at /usr/lib/node_modules/npm-copy/node_modules/fibers/future.js:467:21
    - - - - -
    at makeError (/usr/lib/node_modules/npm-copy/node_modules/npm-registry-client/lib/request.js:329:12)
    at RegClient.<anonymous> (/usr/lib/node_modules/npm-copy/node_modules/npm-registry-client/lib/request.js:259:9)
    at Request._callback (/usr/lib/node_modules/npm-copy/node_modules/npm-registry-client/lib/request.js:216:14)
    at Request.self.callback (/usr/lib/node_modules/npm-copy/node_modules/request/request.js:185:22)
    at emitTwo (events.js:106:13)
    at Request.emit (events.js:191:7)
    at Request.<anonymous> (/usr/lib/node_modules/npm-copy/node_modules/request/request.js:1161:10)
    at emitOne (events.js:96:13)
    at Request.emit (events.js:188:7)
    at IncomingMessage.<anonymous> (/usr/lib/node_modules/npm-copy/node_modules/request/request.js:1083:12)

TIA.

Do do not try to vopy deleted versions

npmjs.cpm allows to delete(unpublish) versions in private repositories. For this versions the fetch of the package fails and the copy process stops with an error.

Error on publish

I'm trying to copy my corp's private npmjs repositories to an on-premise hosting (using Nexus OSS 3.3.0), using this I do

npm-copy --from https://registry.npmjs.org --from-token <token-taken-from-dotnpmrc> --to http://nexus.my.corps.lan:8081/repository/npm-my-corp --to-username admin --to-password <my-admin-password @my-corp%2fapp-status @my-corp%2fapp-update

which gives the following errors

info attempt registry request try #1 at 12:56:28 PM
http request GET https://registry.npmjs.org/@my-corp%2fapp-status
http 200 https://registry.npmjs.org/@my-corp%2fapp-status
info attempt registry request try #1 at 12:56:28 PM
http request GET http://nexus.my.corps.lan:8081/repository/npm-my-corp/@my-corp%2fapp-status
http 404 http://nexus.my.corps.lan:8081/repository/npm-my-corp/@my-corp%2fapp-status
info attempt registry request try #1 at 12:56:28 PM
http fetch GET https://registry.npmjs.org/@my-corp/app-status/-/app-status-1.0.0.tgz
http fetch 200 https://registry.npmjs.org/@my-corp/app-status/-/app-status-1.0.0.tgz
Error: auth required for publishing
    at RegClient.publish (/usr/lib/node_modules/npm-copy/node_modules/npm-registry-client/lib/publish.js:30:14)
    at RegClient.<anonymous> (/usr/lib/node_modules/npm-copy/node_modules/fibrous/lib/fibrous.js:50:17)
    at RegClient.<anonymous> (/usr/lib/node_modules/npm-copy/node_modules/fibrous/lib/fibrous.js:66:29)
    at Object.publish (/usr/lib/node_modules/npm-copy/node_modules/fibrous/lib/fibrous.js:101:47)
    at /usr/lib/node_modules/npm-copy/lib/cli.js:83:26
    at /usr/lib/node_modules/npm-copy/lib/cli.js:100:7
    at /usr/lib/node_modules/npm-copy/node_modules/fibers/future.js:467:21

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.