Skip to content

Commit 5e74419

Browse files
committed
Merge branch 'master' of github.com:MuYi086/blog
2 parents ca578b6 + f62a88f commit 5e74419

File tree

4 files changed

+363
-268
lines changed

4 files changed

+363
-268
lines changed

.npmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ strict-peer-dependencies=false
22
auto-install-peers=true
33
shamefully-hoist=true
44
# mirror config
5-
# registry = https://registry.npmmirror.com/
5+
registry = https://registry.npmmirror.com/
66
disturl = https://npmmirror.com/dist
77
sharp_binary_host = https://npmmirror.com/mirrors/sharp
88
sharp_libvips_binary_host = https://npmmirror.com/mirrors/sharp-libvips

Docs/Articles/Node/安装Node.js和npm配置.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,28 @@ npm config set registry https://registry.npmjs.org/
4545
npm uninstall -g node-sass
4646
```
4747

48+
## 增加npm-run-all
49+
我们可以安装 `npm-run-all` 包,来支持运行多个命令: 并行 `run-p`, 串行 `run-s`
50+
51+
::: code-group
52+
```json [改造前]
53+
{
54+
"scripts": {
55+
"build": "npm run build:esm && npm run build:cjs",
56+
"build:esm": "echo build esm",
57+
"build:cjs": "echo build cjs"
58+
}
59+
}
60+
```
61+
```json [改造后]
62+
{
63+
"scripts": {
64+
"build": "run-p build:esm build:cjs"
65+
}
66+
}
67+
```
68+
:::
69+
4870
## 快速下载node-sass等
4971
类似 `node-sass` , `phantomjs` 等会从 `github.com` 上下载一个 `.node` 文件,大部分安装不成功的原因都源自这里,因为 `GitHub Releases` 里的文件都托管在 `s3.amazonaws.com` 上面,而这个地址被墙了
5072
```shell
@@ -66,3 +88,4 @@ sqlite3_binary_site=https://npm.taobao.org/mirrors/sqlite3/
6688

6789
## 参考
6890
1. [安装 node-sass 的正确姿势](https://github.com/lmk123/blog/issues/28)
91+
1. [npm-run-all2](https://www.npmjs.com/package/npm-run-all2?activeTab=readme)

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"license": "MIT",
77
"scripts": {
88
"dev": "vitepress dev Docs",
9-
"build": "vitepress build Docs && npm run compress:gz",
9+
"build": "run-s buildStart compress:gz",
10+
"buildStart": "vitepress build Docs",
1011
"serve": "vitepress serve Docs",
1112
"compress:gz": "bash ./compress_gz.sh"
1213
},
@@ -20,6 +21,7 @@
2021
"doc": "Docs"
2122
},
2223
"devDependencies": {
24+
"npm-run-all2": "^6.2.2",
2325
"pagefind": "^1.1.0",
2426
"sass": "^1.76.0",
2527
"typescript": "^5.4.5",

0 commit comments

Comments
 (0)