想用而找不到的 npm 插件
# cross-env
# 介绍
Cross-env使得您可以使用单个命令,而不必担心为平台正确设置或使用环境变量。只要像在POSIX系统上运行时那样设置它,跨环境将负责正确设置它。
https://www.npmjs.com/package/cross-env
# 安装
npm install --save-dev cross-env
1
# 使用
{
"scripts": {
"build": "cross-env NODE_ENV=production webpack --config build/webpack.config.js"
}
}
1
2
3
4
5
2
3
4
5
# concurrently
# 介绍
同时运行多个命令。
https://www.npmjs.com/package/concurrently
# 安装
npm install concurrently --save
1
# 使用
concurrently "command1 arg" "command2 arg"
1
In package.json, escape quotes:"start"``: ``"concurrently \"command1 arg\" \"command2 arg\""
# wait-on
# 介绍
https://www.npmjs.com/package/wait-on
wait-on是一个跨平台的命令行实用程序,它将等待文件、端口、套接字和http资源变得可用(或使用反向模式不可用)。功能也可以通过Node.js API获得。跨平台-运行Node.js运行的所有地方(linux, unix, mac OS X, windows)
# 安装
npm install wait-on ``# local version
1
# 使用
wait-on file1 && NEXT_CMD # wait for file1, then exec NEXT_CMD wait-on f1 f2 && NEXT_CMD # wait for both f1 and f2, the exec NEXT_CMD wait-on http://localhost:8000/foo && NEXT_CMD # wait for http 2XX HEAD wait-on https://myserver/foo && NEXT_CMD # wait for https 2XX HEAD wait-on http-get://localhost:8000/foo && NEXT_CMD # wait for http 2XX GET wait-on https-get://myserver/foo && NEXT_CMD # wait for https 2XX GET wait-on tcp:4000 && NEXT_CMD # wait for service to listen on a TCP port wait-on socket:/path/mysock # wait for service to listen on domain socket wait-on http://unix:/var/SOCKPATH:/a/foo # wait for http HEAD on domain socket wait-on http-get://unix:/var/SOCKPATH:/a/foo # wait for http GET on domain socket
1
上次更新: 2023/09/17, 20:06:58