Skip to content

Commit

Permalink
Merge branch 'master' of github.com:MuYi086/blog
Browse files Browse the repository at this point in the history
  • Loading branch information
MuYi086 committed Jul 5, 2024
2 parents ca578b6 + f62a88f commit 5e74419
Show file tree
Hide file tree
Showing 4 changed files with 363 additions and 268 deletions.
2 changes: 1 addition & 1 deletion .npmrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ strict-peer-dependencies=false
auto-install-peers=true
shamefully-hoist=true
# mirror config
# registry = https://registry.npmmirror.com/
registry = https://registry.npmmirror.com/
disturl = https://npmmirror.com/dist
sharp_binary_host = https://npmmirror.com/mirrors/sharp
sharp_libvips_binary_host = https://npmmirror.com/mirrors/sharp-libvips
Expand Down
23 changes: 23 additions & 0 deletions Docs/Articles/Node/安装Node.js和npm配置.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,28 @@ npm config set registry https://registry.npmjs.org/
npm uninstall -g node-sass
```

## 增加npm-run-all
我们可以安装 `npm-run-all` 包,来支持运行多个命令: 并行 `run-p`, 串行 `run-s`

::: code-group
```json [改造前]
{
"scripts": {
"build": "npm run build:esm && npm run build:cjs",
"build:esm": "echo build esm",
"build:cjs": "echo build cjs"
}
}
```
```json [改造后]
{
"scripts": {
"build": "run-p build:esm build:cjs"
}
}
```
:::

## 快速下载node-sass等
类似 `node-sass` , `phantomjs` 等会从 `github.com` 上下载一个 `.node` 文件,大部分安装不成功的原因都源自这里,因为 `GitHub Releases` 里的文件都托管在 `s3.amazonaws.com` 上面,而这个地址被墙了
```shell
Expand All @@ -66,3 +88,4 @@ sqlite3_binary_site=https://npm.taobao.org/mirrors/sqlite3/

## 参考
1. [安装 node-sass 的正确姿势](https://github.com/lmk123/blog/issues/28)
1. [npm-run-all2](https://www.npmjs.com/package/npm-run-all2?activeTab=readme)
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"license": "MIT",
"scripts": {
"dev": "vitepress dev Docs",
"build": "vitepress build Docs && npm run compress:gz",
"build": "run-s buildStart compress:gz",
"buildStart": "vitepress build Docs",
"serve": "vitepress serve Docs",
"compress:gz": "bash ./compress_gz.sh"
},
Expand All @@ -20,6 +21,7 @@
"doc": "Docs"
},
"devDependencies": {
"npm-run-all2": "^6.2.2",
"pagefind": "^1.1.0",
"sass": "^1.76.0",
"typescript": "^5.4.5",
Expand Down
Loading

0 comments on commit 5e74419

Please sign in to comment.