Code Monkey home page Code Monkey logo

tbify's Introduction

tbify

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


原理

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

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

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

安装

# 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
fnm tfnm / tbify fnm tfnm install 20
npm tnpm / tbify npm tnpm install react
npx tnpx / tbify npx tnpx kill-port 3000
yarn tyn / tyarn / tbify yarn tyn add react
pnpm tpm (Windows 下该命令被系统占用,请使用后面的替代) / tpnpm / tbify pnpm tpm add react
pnpx tpx / tpnpx / tbify pnpx tpx kill-port 3000

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

tbify printenv npm_config_registry
# -> https://registry.npmmirror.com

若想覆盖内部的环境变量值,可在使用 tbify 前设置:

npm_config_registry=https://my.npm.mirror tbify printenv npm_config_registry
# -> https://my.npm.mirror

手动同步 NPM 包到淘宝镜像

可以通过 tsynctbify sync 命令手动同步一个或多个 NPM 包到淘宝镜像。

# 一个
tsync vue

# 多个
tsync vue react

鸣谢

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

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

许可

Jay Fong (c) MIT

tbify's People

Contributors

fjc0k 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

tbify's Issues

作者可否增加homebrew安装途径?

这个工具非常有帮助,解决了electron镜像不好使等各种疑难杂症问题,build项目比以前顺利多了,但是我现在主要用homebrew管理mac的包,主要是安装和追更新比较方便,希望作者大佬考虑下把这个工具上传homebrew,谢谢大佬!

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.