[英]Event when npm package is installed?
Im thinking of creating a plugin framwork in nodejs. 我正在考虑在nodejs中创建插件框架。
Can i catch an event when a package is installed using npm? 使用npm安装软件包时,我可以捕获事件吗?
you can add script to the packages.json
that make something after and before install 您可以将脚本添加到
packages.json
,以便在安装前后进行安装
{ "scripts" :
{ "install" : "scripts/install.js"
, "postinstall" : "scripts/install.js"
, "uninstall" : "scripts/uninstall.js"
}
}
or add a hook script 或添加一个钩子脚本
node_modules/.hooks/{eventname}
see this example 看这个例子
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.