[英]A local package.json file
Is it possible to have another package.json file load up that is only available locally and will override the options in the repo's package.json file. 是否有可能加载另一个package.json文件,该文件仅在本地可用,并且将覆盖存储库的package.json文件中的选项。 I have different version requirements for packages in my local machine for global things like yarn. 我在本地机器上对诸如纱之类的全局程序的软件包有不同的版本要求。
As far as I know this is not possible and your best bet would be using the devDependencies
field or using the scripts
hooks to trigger specific npm i
only locally 据我所知这是不可能的,最好的选择是使用devDependencies
字段或使用scripts
挂钩仅在本地触发特定的npm i
The approach with scripts would work similar to this 使用脚本的方法将与此类似
{
"scripts": {
"postinstall": "[\"$(hostname)\" == \"local-machine-hostname\" ] && npm i --no-save specific-package-local-only"
}
}
(This triggers the npm i
if the current machine's hostname is local-machine-hostname
) (如果当前计算机的主机名是local-machine-hostname
这将触发npm i
)
Bare in my however that this approach makes those commands public, if that is an issue. 但是,我认为这种方法会使这些命令公开,如果有问题的话。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.