首页 > 其他分享 >npm scripts hooks All In One

npm scripts hooks All In One

时间:2023-03-23 14:33:06浏览次数:59  
标签:npm package hooks chmod https scripts com

npm scripts hooks All In One

npm install hooks

image

npm postinstall

image

https://docs.npmjs.com/cli/v9/using-npm/scripts#npm-install

image

https://docs.npmjs.com/cli/v9/using-npm/scripts#npm-ci

image

https://docs.npmjs.com/cli/v9/using-npm/scripts#npm-rebuild

{
  "scripts" : {
    "install" : "scripts/install.js",
    "postinstall" : "scripts/install.js",
    "uninstall" : "scripts/uninstall.js"
  }
}

https://docs.npmjs.com/cli/v9/using-npm/scripts#examples

???

https://www.npmjs.com/package/postinstall

https://github.com/kapouer/postinstall

demos

npm install hooks

preinstall
install
postinstall

prepublish
preprepare
prepare
postprepare

https://docs.npmjs.com/cli/v9/using-npm/scripts#npm-install

chmod +x / chmod 755

# chmod +x
$ chmod +x ./scripts/preinstall.sh
$ chmod +x ./scripts/install.sh
$ chmod +x ./scripts/postinstall.sh

$ chmod +x ./scripts/prepublish.sh
$ chmod +x ./scripts/preprepare.sh
$ chmod +x ./scripts/prepare.sh
$ chmod +x ./scripts/postprepare.sh

# 批量 folder
# $ chmod +x ./scripts/

$ chmod +x ./scripts/*.*

https://github.com/web-fullstack/patch-package-in-action/blob/main/npm-hooks/package.json

patch-package

package.json

{
  // ...
  "scripts": {
    "postinstall": "patch-package"
  }
  // ...
 }

https://github.com/web-fullstack/patch-package-in-action/blob/main/package.json

https://www.npmjs.com/package/patch-package#why-use-postinstall-postinstall-with-yarn

(

标签:npm,package,hooks,chmod,https,scripts,com
From: https://www.cnblogs.com/xgqfrms/p/17246038.html

相关文章