Giter VIP home page Giter VIP logo

tbify's Introduction

tbify

使用 淘宝 NPM 镜像 加速包管理工具安装依赖的速度。


原理

基于环境变量对国内请求速度欠佳的资源地址进行了替换,具体分为两点:

  • 通过环境变量令包管理工具(npmnpxyarnpnpmpnpx)使用淘宝源安装依赖;
  • 通过环境变量令诸如 nvmnode-sassElectronPuppeteerCypressSharp 等包使用淘宝镜像安装其自身所需资源。

以上,本工具对包管理工具本身零侵入,同时,对环境变量的设置也是一次性的,并不会产生任何的副作用,请放心使用。

安装

# npm
npm install tbify --global

# yarn
yarn global add tbify

# pnpm
pnpm add --global tbify

使用

对于常用的包管理命令,tbify 提供了使用淘宝 NPM 镜像的等价命令,除了发布包到 npm 时必须使用 npm publish 外,都可以使用等价命令进行相关操作:

原命令 使用淘宝 NPM 镜像的命令 示例
nvm tnvm (或 tbify nvm) tnvm install 8.0.0
npm tnpm (或 tbify npm) tnpm install react
npx tnpx (或 tbify npx) tnpx kill-port 3000
yarn tyn (或 tbify yarn) tyn add react
pnpm tpm (或 tbify pnpm) tpm add react
pnpx tpx (或 tbify pnpx) tpx kill-port 3000

对于其他命令,在使用时加上 tbify 前缀即可,比如:

tbify printenv npm_config_registry
# -> https://r.npm.taobao.org

鸣谢

正所谓前人栽树后人乘凉,感谢 @fengmk2 大佬及 cnpm 团队 为提供一个优质国内镜像所作出的努力!👍

同时本工具从 @yiminghe 大佬的 tyarn 项目借鉴了很多思路,一并表示感谢!💐

许可

Jay Fong (c) MIT

tbify's People

Contributors

fjc0k avatar

Watchers

James Cloos avatar

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.