patch-package
作用
patch-package
lets app authors instantly make and keep fixes to npm dependencies. It’s a vital band-aid for those of us living on the bleeding edge.对npm包进行修改,按照步骤,下次可直接运行
使用
安装
# npm
npm i patch-package
# yarn
yarn add patch-package postinstall-postinstall
添加
// in package.json
// add node command in package.json scripts
"scripts": {
+ "postinstall": "patch-package"
}
使用
# when modified
# the package-name was modified package
# yarn
yarn patch-package package-name
# npx
npx patch-package package-name
PruneCluster
(leaflet聚合插件)
安装
npm i PruneCluster exports-loader
引用
import { PruneCluster, PruneClusterForLeaflet } from 'exports-loader?exports[]=PruneCluster&exports[]=PruneClusterForLeaflet!@sintef/prune-cluster/dist/PruneCluster'
nodemon
安装
# 最好作为全局安装
npm i nodemon -g
作用
最简便的node自动化工具之一。自动更新node项目
配置
// package.json
"scripts": {
"start": "node ./bin/www",
"devstart": "nodemon ./bin/www"
}
更新包
# yarn
yarn upgrade-interactive --latest # yarn 提供了全选切换功能,就是按键 A,空格切换包是否更新,Control + C 取消更新,回车就是执行更新。
# npm
npm-check -u
说明 | yarn | npm-check |
---|---|---|
更新项目依赖,没有交互 | yarn upgrade —latest | npm-check -y |
更新项目依赖,有交互 | yarn upgrade-interactive —latest | npm-check -u |
更新全局依赖,没有交互 | yarn global upgrade —latest | npm-check -g -y |
更新全局依赖,有交互 | yarn global upgrade-interactive —latest | npm-check -g -u |