V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
爱意满满的作品展示区。
xcodebuild
V2EX  ›  分享创造

写了个简单的 yarn 加速

  •  
  •   xcodebuild ·
    xcodebuild · 2021-04-01 13:24:10 +08:00 · 3245 次点击
    这是一个创建于 1118 天前的主题,其中的信息可能已经有所发展或是发生改变。

    之前一直用 cnpm,但是有些工具链和 cnpm 有些奇怪的冲突,只能用 yarn 。

    而 yarn 仅仅设置 taobao 源的情况下,很多二进制( electron,node-sass )其实还是走的外网地址。设置这些二进制 mirror 又极其麻烦。然后发现了 https://github.com/best-shot/bin-wrapper-china 这个项目解决了这个痛点问题。

    总是改 package.json 和写环境变量太麻烦,所以写了个小工具 https://github.com/xcodebuild/fastyarn 封装了一下,没几行代码,需要的话自取

    使用

    # 安装
    npm install -g yarn fyarn --registry "https://r.cnpmjs.org/"
    
    # 使用
    fyarn install
    
    6 条回复    2021-04-05 16:41:41 +08:00
    Tokin
        1
    Tokin  
       2021-04-01 15:01:11 +08:00
    想到昨天翻以前写的老项目,老项目是用 sqlite3 写的,结果 sqlite3 死活装不上,气的我把项目改成了 mysql,虽然那是一个吃灰不会再使用的老项目。。。
    fjc0k
        2
    fjc0k  
       2021-04-01 17:00:47 +08:00
    哈哈,我也做了个差不多的,npm 、npx 、pnpm 、yarn 、nvm 、node-sass 、Electron 、Puppeteer 、Cypress 、Sharp 加速可以试试: https://github.com/fjc0k/tbify
    xyxc0673
        3
    xyxc0673  
       2021-04-02 20:15:08 +08:00
    谢谢分享,马克一下
    yazoox
        4
    yazoox  
       2021-04-03 07:05:15 +08:00
    厉害啊
    Outshine
        5
    Outshine  
       2021-04-04 16:38:58 +08:00
    你说的这些源,华为都有

    https://mirrors.huaweicloud.com/
    xcodebuild
        6
    xcodebuild  
    OP
       2021-04-05 16:41:41 +08:00
    @Outshine 用哪个国内源都可以哈,其实主要是 binary 的 mirror 设置太麻烦,搞定这个其他的都不是问题
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3416 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 11:24 · PVG 19:24 · LAX 04:24 · JFK 07:24
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.