1.2.1 • Published 8 years ago

@axetroy/nmr v1.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
8 years ago

Npm Mirror Registry

Greenkeeper badge Build Status Dependency License Node

a cli tool to get/set/switch npm registry

npm.io

Requirement

  • nodejs>=6.9
  • npm

Supports

  • Windows
  • Linux
  • MacOS

Installation

npm install @axetroy/nmr -g

Usage

Command line

$ nmr -h

   nmr 1.2.0 - Npm Mirror Registry, handle npm registry in a easy way

   USAGE

     nmr <command> [options]

   COMMANDS

                          Default command
     set <registry>       set registry
     get                  get registry
     reset                reset to npm official registry
     list                 print out the registries
     switch               switch the npm registry
     help <command>       Display help for a specific command

   GLOBAL OPTIONS

     -h, --help         Display help
     -V, --version      Display version
     --no-color         Disable colors
     --quiet            Quiet mode - only displays warn and error messages
     -v, --verbose      Verbose mode - will also output debug messages

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

License

The MIT License