switch-registry

Utility for making npm registry switch easy

Usage no npm install needed!

<script type="module">
  import switchRegistry from 'https://cdn.skypack.dev/switch-registry';
</script>

README

Build Status

Simple utility to setup and switch between npm registries.

Install

npm install switch-registry -g

We can use npmrs in place of switch-registry

Run programm with

switch-registry {command} {args}

Check program usage with

switch-registry or switch-registry usage

Possible commands

  • init ( Initialize required files and entries )
  • usage ( Display this help )
  • ls ( Display list of added registries )
  • list ( Same as ls )
  • add ( Add a new registry )
  • remove ( Remove an existing registry )
  • use ( Change an existing registry )
  • change ( Same as use )

List all registries

switch-registry ls

Add new registry to list

switch-registry add <name> <url>

Remove existing registry from list

switch-registry remove <name>

Change to another npm & yarn registry from list

switch-registry use <name>

Change to another npm registry from list

switch-registry use <name> npm

Change to another yarn registry from list

switch-registry use <name> yarn

Task List

  • Create base setup, file and folder structure
  • Show usage information
  • Show list of existing entries
  • Adding new entries to list
  • Addition should happen for unique url
  • Addition should happen for unique keys
  • Addition should happen for valid urls
  • Removing entries from list
  • Changing existing entries
  • Change registry should look for invalid entries and respond with proper message
  • Changing/Setting up registry
  • Add unit test cases
  • Add default support for popular npm repos npm ----- https://registry.npmjs.org/ cnpm ---- http://r.cnpmjs.org/ taobao -- https://registry.npm.taobao.org/ skimdb -- https://skimdb.npmjs.com/registry yarn ---- https://registry.yarnpkg.com
  • Add testing function to test current entries and response time
  • Add short commands
  • Auto switch
    • Enable Auto switch
    • Disable Auto switch
    • Setup Auto switch for project/folder
    • Remove Auto switch for project/folder
  • Update to ES6

Updates

Version 1.2.0

  • Support for yarn registry update
  • By default following will change registry for both npm and yarn
switch-registry use <name>
  • We need to pass another parameter npm or yarn to switch registry for that. For example, to change registry for yarn only
switch-registry use <name> yarn

Version 1.1.9

  • Bug fixes

Version 1.1.8

  • Upgraded versions of all dependecies.