Skip to content

WindomZ/npm-registry-switch

 
 

Repository files navigation

Npm Mirror Registry

Build Status Dependency License Node

a cli tool to get/set/switch npm registry

Requirement

  • nodejs>=6.9
  • npm

Supports

  • Windows
  • Linux
  • MacOS

Installation

npm install @axetroy/nmr -g

Usage

Command line

nmr -h

  Usage: nmr <command> [options]


  Commands:

    set|s <registry>    set registry
    get|g               get registry
    reset|r [options]   reset to npm official registry
    list|ls             print out the registries

  Npm Mirror Registry, handle npm registry in a easy way

  Options:

    -h, --help     output usage information
    -V, --version  output the version number

Nodejs

const co = require('co');
const npmRegistrySwitch = require('@axetroy/nmr');

co(function*() {
  yield npmRegistrySwitch.get();    // https://registry.npmjs.org
  yield npmRegistrySwitch.set("https://registry.npm.taobao.org");
  yield npmRegistrySwitch.get();    // https://registry.npm.taobao.org
  yield npmRegistrySwitch.reset();
  yield npmRegistrySwitch.get();    // https://registry.npmjs.org
}).catch(function(err) {
  console.error(err);
})

Why I need this module

Cause i hate type npm config set registry https://xxxxxxxx npm's network is terrible, we gonna set the mirror registry like cnpm in China.

but, if we set mirror registry, then i can't use npm service anymore, like npm publish, npm whoami, npm login

if you want use it agian, you gonna set to npm official registry.

such as said, I hate type npm config set registry https://xxxxxxxx

Contribute

git clone https://github.com/axetroy/nmr.git
cd ./nmr
yarn
./bin/nmr

You can flow Contribute Guide

Contributors

Contributors Commit Add Code Remove Code Total Changes
axetroy 19 +3962(95.47%) -141(3.40%) 4103(98.87%)
wd 2 +22(0.53%) -9(0.22%) 31(0.75%)
WindomZ 2 +9(0.22%) -7(0.17%) 16(0.39%)

License

The MIT License

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%