Skip to content

Commit

Permalink
更新 ESLint 规则 shorthand
Browse files Browse the repository at this point in the history
更新说明文档
  • Loading branch information
gucong3000 committed May 22, 2023
1 parent e505f8a commit 2af8074
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 25 deletions.
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ module.exports = {
],
'object-shorthand': [
'error',
'never',
],
'quotes': [
'error',
Expand Down
49 changes: 27 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ mirror-config-china
## 特性

- 支持Windows和其他操作系统
- 自动配置各个node模块的安装源为淘宝镜像
- 自动配置 npm 注册表和各个包的二进制模块的安装源为https://npmmirror.com/

## 安装

Expand All @@ -24,25 +24,22 @@ npm config list
source ~/.bashrc && env
```

## 参数

### `--registry=https://registry.npmmirror.com`
registry.npmjs.com 镜像URL

### `--bin-mirrors-prefix=https://cdn.npmmirror.com/binaries`
npmmirror.com/mirrors 镜像URL,会覆盖下文中的`{bin-mirrors}`

### `--xxx-mirrors-prefix=https://some.com/mirrors`
自定义镜像URL字面量`{xxx-mirrors}`

### `--http-proxy=https://my.proxy.com`
### `--https-proxy=https://my.proxy.com`
代理配置,默认从操作系统设置中读取

### `--disturl={bin-mirrors}/node` (别名: `--node-mirror``--nodejs-org-mirror`)
nodejs.org/dist 镜像URL 默认值为`{bin-mirrors}/node`

### 其他
## 主要参数

- `--registry=https://registry.npmmirror.com`
registry.npmjs.com 镜像URL
- `--bin-mirrors-prefix=https://cdn.npmmirror.com/binaries`
npmmirror.com/mirrors 镜像URL,会覆盖下文中的`{bin-mirrors}`
- `--xxx-mirrors-prefix=https://some.com/mirrors`
自定义镜像URL字面量`{xxx-mirrors}`
- `--http-proxy=https://my.proxy.com`
代理配置,默认从操作系统设置中读取
- `--https-proxy=https://my.proxy.com`
同上
- `--disturl={bin-mirrors}/node` (别名: `--node-mirror``--nodejs-org-mirror`)
nodejs.org/dist 镜像URL前缀,默认值为`{bin-mirrors}/node`

## 其他参数
其他参数将被写入`.npmrc`文件中,如

```bash
Expand Down Expand Up @@ -91,13 +88,21 @@ Node.js IO.js 的镜像下载地址镜像写入`NVM_NODEJS_ORG_MIRROR`、`N_NODE
-[nodist](https://github.com/marcelklehr/nodist)
-[Node Version Manager for Windows](https://github.com/hakobera/nvmw)

PATH 环境变量中加入`node_modules/.bin`这个路径,方便调用 mochaeslint 等命令行工具
PATH 环境变量中加入`node_modules/.bin`这个路径,方便调用`mocha``eslint`和本工具的命令行工具,可能需要重启终端才能生效

(Windows 下 Path 为`node_modules\\.bin;%Path%` )

## 为项目生成镜像配置文件

```
cd ~/my-project
mirror-config-china --registry=https://registry.npmmirror.com
mirror-config-china
```

## 未尽功能
部分npm包可能用git命令从github下载依赖,建议配置镜像:
```bash
git config --global url."https://gitclone.com".insteadOf "https://github.com/"
# 或者
git config --global url."https://hub.fastgit.org/".insteadOf "https://github.com/"
```
4 changes: 2 additions & 2 deletions lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ async function getConf (argv) {

const opts = {
binMirrorsPrefix: getBinPrefix(mirrors) || 'https://cdn.npmmirror.com/binaries',
npmrc: npmrc,
env: env,
npmrc,
env,
};

for (const key in mirrors?.ENVS) {
Expand Down

0 comments on commit 2af8074

Please sign in to comment.