Coder Social home page Coder Social logo

pkgmigr8or's Introduction

pkgmigr8or

pkgmigr8or (Package migrater) is a Migration CLI tool to export packages from NPM to a private registry e.g. Verdaccio.

Installation

npm install -g pkgmigr8or

Pre-Requisites

Authentication

To migrate any of your packages from NPM you will need to have your account logged in using npm adduser.

If your private registry also has auth permissions required to publish you will need to have logged in to that as well, also using npm adduser passing in the --registry-url flag.

You can cat ~/.npmrc and should be able to see tokens for both registries.

Usage

Create a directory somewhere and point your CLI in to it.

The script takes 2 arguments:

  1. A file which contains a list of all the packages you want to export.
  2. The URL of your private registry you are migrating to.
pkgmigr8or packages.txt http://localhost:4873

Defining your packages.

Create a plain text file in your directory e.g. packages.txt.

Each line represents a new package

myPackage
@myScope/myPackage

Restricting vesrions.

You may not want to get every version ever published of your package for migration. The script will recognise a # in your package name as a version delimiter and for each package of that name will only download packages that satisfy the version constraints based on semver.satisfies. If you don't specify a #, all versions ever published will be migrated.

myPackage#<=1.0.2
@myScope/myPackage#>1.0.2 <2.0.0

pkgmigr8or's People

Contributors

alexkvak avatar thornyweb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

pkgmigr8or's Issues

Publish not in order

If you are download more than one version of any given package, the order in which the tarballs are published is arbitrary. Suggest to fix by publishing in filename order based on semver naming of tarballs.

Migration fails if any package already exist on storage

I'm trying to migrate a package that seems already exist on my storage but fails because of a package already exist. It would be a great way to force publish.

// pkg.txt
melody-loader

pkgmigr8or pkg.txt http://localhost:4873

➜ pkgmigr8or pkg.txt http://localhost:4873
Fetching information for 1 packages...
 ████████████████████████████████████████ 100% | ETA: 0s | 1/1
Downloading 103 tarballs...
 ████████████████████████████████████████ 100% | ETA: 1s | 103/103
Publishing 103 tarballs...
 █░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 2% | ETA: 314s | 2/103(node:73922) UnhandledPromiseRejectionWarning: Error: Command failed: npm publish "/Users/user/melody-loader-1.1.1-0743e7f.53.tgz" --registry=htt
npm notice 
npm notice 📦  [email protected]
npm notice === Tarball Contents === 
npm notice 728B  package.json    
npm notice 9.6kB LICENSE         
npm notice 2.4kB lib/index.esm.js
npm notice 2.7kB lib/index.js    
npm notice 2.6kB src/index.js    
npm notice === Tarball Details === 
npm notice name:          melody-loader                           
npm notice version:       1.1.1-0743e7f.53                        
npm notice package size:  5.4 kB                                  
npm notice unpacked size: 18.1 kB                                 
npm notice shasum:        c31b172f4de5bdfe3687e65cf6a5010f11e8a716
npm notice integrity:     sha512-aF9kRn3db9a36[...]mxU+gJP9rLw/g==
npm notice total files:   5                                       
npm notice 
npm ERR! code EPUBLISHCONFLICT
npm ERR! publish fail Cannot publish over existing version.
npm ERR! publish fail Update the 'version' field in package.json and try again.
npm ERR! publish fail 
npm ERR! publish fail To automatically increment version numbers, see:
npm ERR! publish fail     npm help version

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.