Giter VIP home page Giter VIP logo

nnrm's Introduction

nnrm

English Docs | 中文文档

npm GitHub code size in bytes node-current npm Libraries.io dependency status for latest release

nnrm = new nrm

New npm registry manager.

Use smaller dependencies than nrm.

nnrm nrm
install size install size

由来

Install

# install
npm install -g nnrm
yarn global add nnrm
pnpm add -g nnrm

Usage

These commands are used to toggle the corresponding registry.

  • nnrm & nrm: npm
  • nyrm & yrm: yarn(v1-v3)
  • prm: pnpm
nnrm ls
# nrm ls
# yrm ls
# prm ls

nnrm use taobao
# nrm use taobao
# yrm use taobao
# prm use taobao

# set `.npmrc` for local
nrm use taobao -l

nnrm test
# nrm test
# yrm test
# prm test
  • nnrm -h: show help message
Usage:
  $ nrm <command> [options]

Commands:
  ls                           List all the registries
  use [registry]               Change registry
  test                         Show response time for all registries
  add <registry> <url> [home]  Add a custom registry
  remove <registry>            Remove a custom registry

Options:
  -h, --help     Display this message
  -v, --version  Display version number
Usage:
  $ nrm use [registry]

Options:
  -l, --local    set '.npmrc' for local

Add/Remove custom registry

nnrm add example https://xxx.com
nnrm remove example

It will be recorded in your ~/.nnrm/registries.json.

Default Registires

Features

  • Support npm/yarn(v1-v3)/pnpm (the registry of yarn and npm/pnpm is independent of each other)
    • yarn(v3) config use npmRegistryServer instead of registry
  • Smaller Dependencies
    • Use node-fetch instead of request for speed test
    • Use execa instead of npm
    • Use cac instead of commander
  • Asynchronously display source speed test results
  • Colorful console info
  • Automatically display the registry list after each modification, and mark the current registry

FAQ

Why new nrm?

nrm relies on the deprecated request with a larger package body, the npm package, and some other npm dependencies.

So installing nrm is also a very slow thing.

Why cac?

minimist vs commander vs cac | npm trends

minimist is only 1.3 KB, but it is just a parameter parsing tool.

We need a tool that can automatically generate help information.

commander and cac can do it.

cac(3.6KB) is smaller than commander(6.8KB). And i love C.C.

Why node-fetch?

node-fetch vs axios vs request

node-fetch is only 289B!

axios(4.6KB) is good, but node-fetch is smaller.

request(184.8KB) has been deprecated and it is so big.

Why execa?

Lock execa@8 for Node.JS 16.

execa vs shelljs

execa is only 8.4KB.

Install package npm to use npm.config.set('registry', 'xxx') is expensive.

We just need use local command: npm config set registry xxx.

Error when use Windows?

If you are a Windows user, you may want to make sure that you use a generic command line like bash instead of CMD.

nrm conflicts with other commands

nrm(command) is a command of nrm(package). You should uninstall nrm(package) to use nrm(command) with nnrm(package). Or you can use nnrm(command).

nrm(command) may conflict with nrm or ni. You can uninstall them or just use command nnrm without uninstalling them.

Ref

nnrm's People

Contributors

1wkk avatar cl1107 avatar lete114 avatar so1ve avatar yunyoujun avatar zachzhao1984 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

nnrm's Issues

使用问题

nnrm 切换 依赖源只有 npm 成功 yarn 失败

Show Global registry and Local registry

Clear and concise description of the problem

In project with .npmrc registry=xxx, nrm use yyy will always show xxx.

Suggested solution

  • Show Global registry and Local registry
  • by suffix (global) (local) when with .npmrc registry

Alternative

No response

Additional context

No response

Validations

  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.

Incompatible with node 15.11.0

install with yarn global add nnrm

➜ ~ yarn global add nnrm
yarn global v1.22.10
warning package.json: No license field
[1/4] 🔍 Resolving packages...
[2/4] 🚚 Fetching packages...
error [email protected]: The engine "node" is incompatible with this module. Expected version "14.x". Got "15.11.0"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/global for documentation about this command.

nrm use do not prevent use unknown registry

Describe the bug

nrm use xxx, if xxx not exist, node will show error

Reproduction

npm use 0x3f

System Info

System:
    OS: macOS 12.6.3
    CPU: (8) arm64 Apple M2
    Memory: 84.98 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.15.0 - ~/.nvm/versions/node/v18.15.0/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v18.15.0/bin/yarn
    npm: 9.6.4 - ~/.nvm/versions/node/v18.15.0/bin/npm
  Browsers:
    Chrome: 113.0.5672.92
    Safari: 15.6.1

Used Package Manager

pnpm

Validations

  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

在windows powershell执行报错

image

PS D:\aboutWork\APEX\R5\r5-customer> nnrm ls internal/process/esm_loader.js:74 internalBinding('errors').triggerUncaughtException( ^

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
at validateString (internal/validators.js:124:11)
at Object.join (path.js:424:7)
at file:///D:/aboutDownload/softWare/nvm/v14.17.4/node_modules/nnrm/utils/registries.js:7:19
at ModuleJob.run (internal/modules/esm/module_job.js:170:25)
at async Loader.import (internal/modules/esm/loader.js:178:24)
at async Object.loadESM (internal/process/esm_loader.js:68:5) {
code: 'ERR_INVALID_ARG_TYPE'
}
PS D:\aboutWork\APEX\R5\r5-customer>

yrm切换yarn的源时没有生效

感谢作者的帮助,这个很好使,但是我在使用中发现一个小问题:

环境:
macOS:
node version:
v17.4.0
yarn version:
v1.22.17
nnrm version:
index.js/0.3.5 darwin-x64 node-v17.4.0

操作如下
image

通过yrm use 切换源之后,执行yrm get config registry 发现并没有更新: (

yrm ls throw error

image

``` Error: Command failed with exit code 1: yarn config get registry Usage Error: Couldn't find a configuration settings named "registry" ```

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.