https://github.com/markthree/npm-csr
快速切换 npm 源
https://github.com/markthree/npm-csr
Last synced: about 1 year ago
JSON representation
快速切换 npm 源
- Host: GitHub
- URL: https://github.com/markthree/npm-csr
- Owner: markthree
- License: mit
- Created: 2022-04-17T14:22:35.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-02-28T08:20:33.000Z (about 2 years ago)
- Last Synced: 2025-01-13T05:08:09.019Z (over 1 year ago)
- Language: JavaScript
- Size: 118 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# npm-csr
该方案已废弃,请改用 [dnrm](https://github.com/markthree/dnrm)
快速切换 `npm` 源
## 动机 🦕
不想每次记住太长的镜像地址
## 使用 🦖
### 安装
```shell
npm i npm-csr -g
```
### 命令式
#### 获取
```shell
# 获取当前源
npm-csr
```
#### 切换 npm
```shell
# 切换为 npm 源
npm-csr npm
```
#### 切换 cnpm
```shell
# 切换为 cnpm 源
npm-csr cnpm
```
### 编程式
```ts
const {
setNpmRegistry,
getCurrentNpmRegistry,
} = require("npm-csr");
// 切换为 npm 源
await setNpmRegistry("npm");
// 切换为 cnpm 源
await setNpmRegistry("cnpm");
// 获取当前 npm 源
await getCurrentNpmRegistry();
```
## License
Made with [markthree](https://github.com/markthree)
Published under [MIT License](./LICENSE).