Npm Mirror Registry
a cli tool to get/set/switch npm registry
Requirement
- nodejs>=6.9
- npm
Supports
- [x] Windows
- [x] Linux
- [x] 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
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