Skip to content

Commit 7e13ec3

Browse files
authored
Update README.md
1 parent 39757d8 commit 7e13ec3

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

README.md

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,40 @@
1-
# @codegenius/registry-plugin
1+
# @codegenius/registry-plugin
2+
3+
切换 **NPM** 镜像地址, 支持命令模式, 询问模式和 API 模式;
4+
5+
使用场景: 用于没有安装其他插件且对于切换命令地址不熟悉的情况下切换常见的镜像地址.
6+
7+
### 命令模式
8+
9+
```bash
10+
# 设置 npm 官方源
11+
codeg registry -u https://registry.npmjs.org/
12+
```
13+
14+
| 选项 | 描述 |
15+
| --------- | ------------ |
16+
| -a, --ask | 启用询问模式 |
17+
18+
### 询问模式
19+
20+
```bash
21+
# 启动询问模式
22+
codeg registry --ask
23+
```
24+
25+
```
26+
# 询问过程
27+
1. 请选择 NPM 镜像
28+
```
29+
30+
### API 模式
31+
32+
仅对 `npm config set registry xxx` 包装, 无其它配置.
33+
34+
```typescript
35+
import { npmRegistry } from "code-genius";
36+
37+
(async () => {
38+
await npmRegistry("https://registry.npmjs.org/");
39+
})();
40+
```

0 commit comments

Comments
 (0)