Skip to content

Commit

Permalink
feat: 支持 fnm
Browse files Browse the repository at this point in the history
  • Loading branch information
fjc0k committed Jan 15, 2024
1 parent d59047f commit 5d19a3e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
基于环境变量对国内请求速度欠佳的资源地址进行了替换,具体分为两点:

- 通过环境变量令包管理工具(`npm``npx``yarn``pnpm``pnpx`)使用淘宝源安装依赖;
- 通过环境变量令诸如 `nvm` `node-sass``Electron``Puppeteer``Cypress``Sharp``Prisma` 等包使用淘宝镜像安装其自身所需资源
- 通过环境变量令诸如 `nvm``fnm``node-sass``Electron``Puppeteer``Cypress``Sharp``Prisma` 等工具或包使用淘宝镜像安装其自身所需资源

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

Expand All @@ -44,6 +44,7 @@ pnpm add --global tbify
| 原命令 | 使用淘宝 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` |
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"main": "lib/run.js",
"bin": {
"tbify": "lib/run.js",
"tfnm": "lib/alias/fnm.js",
"tnpm": "lib/alias/npm.js",
"tnpx": "lib/alias/npx.js",
"tnvm": "lib/alias/nvm.js",
Expand Down
4 changes: 4 additions & 0 deletions src/alias/fnm.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env node
import { run } from '../run'

run('fnm')
3 changes: 3 additions & 0 deletions src/getTaobaoEnv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ export async function getTaobaoEnv(
NVM_NODEJS_ORG_MIRROR: `${TAOBAO_MIRROR}/node`,
NVM_IOJS_ORG_MIRROR: `${TAOBAO_MIRROR}/iojs`,

// fnm
FNM_NODE_DIST_MIRROR: `${TAOBAO_MIRROR}/node`,

// nodist
NODIST_NODE_MIRROR: `${TAOBAO_MIRROR}/node`,
NODIST_IOJS_MIRROR: `${TAOBAO_MIRROR}/iojs`,
Expand Down

0 comments on commit 5d19a3e

Please sign in to comment.