Skip to content
/ dnrm Public

deno 实现的 nrm,每次切换源都在 100ms 内,速度超级快 | deno implementation of nrm, each switch source within 100ms, super fast

License

Notifications You must be signed in to change notification settings

markthree/dnrm

Repository files navigation

dnrm

deno 实现的 nrm,每次切换源都在 100ms 内,速度超级快


README 🦉

简体中文 | English


Bench

npm 镜像源工具速度对比


Usage

install

1. 模块安装

deno install --allow-read --allow-sys --allow-write --allow-env --allow-net -rfn dnrm https://deno.land/x/dnrm/mod.ts

如果你装了 node,却没有安装过 deno 👇

npx deno-npx install --allow-read --allow-write --allow-env --allow-net -rfn dnrm https://deno.land/x/dnrm/mod.ts

在一些不想装 deno 的临时场景下 👇

# 注意: 这种使用方式仍然很慢,因为加载 deno 垫片需要时间
npm i deno-nrm -g

2. 本地安装

  1. 下载该项目到本地

  2. 在项目根目录下执行命令

deno task install

cli

# 查看当前源
dnrm

# 切换 taobao 源
dnrm use taobao

# 查看所有源
dnrm ls

# 测试所有源
dnrm test

# 设置源在本地
dnrm use taobao --local

# 查看帮助
dnrm -h

# 查看版本号
dnrm -V

优化原理

  1. 热路径查询
  2. deno 的冷启动比 node 更快
  3. 自动区分使用场景,按需解析参数,按需加载低频模块,按需设置配置文件
  4. 针对 registry 配置使用正则快速获取和替换配置,不使用任何耗时的解析器,不需要序列化和反序列化
  5. 直接针对配置文件进行配置替换,而不是调用子进程执行 npm config set registry=...,因为 npm 内部分支太多,这是卡的主要原因

License

Made with markthree

Published under MIT License.

About

deno 实现的 nrm,每次切换源都在 100ms 内,速度超级快 | deno implementation of nrm, each switch source within 100ms, super fast

Topics

Resources

License

Stars

Watchers

Forks

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy