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包进行修改,按照步骤,下次可直接运行

使用

安装

  1. # npm
  2. npm i patch-package
  3. # yarn
  4. yarn add patch-package postinstall-postinstall

添加

  1. // in package.json
  2. // add node command in package.json scripts
  3. "scripts": {
  4. + "postinstall": "patch-package"
  5. }

使用

  1. # when modified
  2. # the package-name was modified package
  3. # yarn
  4. yarn patch-package package-name
  5. # npx
  6. npx patch-package package-name

PruneCluster

(leaflet聚合插件)

安装

  1. npm i PruneCluster exports-loader

引用

  1. import { PruneCluster, PruneClusterForLeaflet } from 'exports-loader?exports[]=PruneCluster&exports[]=PruneClusterForLeaflet!@sintef/prune-cluster/dist/PruneCluster'

nodemon

安装

  1. # 最好作为全局安装
  2. npm i nodemon -g

作用

最简便的node自动化工具之一。自动更新node项目

配置

  1. // package.json
  2. "scripts": {
  3. "start": "node ./bin/www",
  4. "devstart": "nodemon ./bin/www"
  5. }

更新包

  1. # yarn
  2. yarn upgrade-interactive --latest # yarn 提供了全选切换功能,就是按键 A,空格切换包是否更新,Control + C 取消更新,回车就是执行更新。
  3. # npm
  4. 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

阿拉伯数字转汉字输出

nzh