简体   繁体   English

我应该添加 npm-shrinkwrap.json、package-lock.json 还是 yarn.lock?

[英]Should I add npm-shrinkwrap.json, package-lock.json or yarn.lock?

I am shipping a package that I only compile using tsc ( typescript compiler ) and I am expecting the consumers to get dependencies installed when they install my package using npm or yarn.我正在发布一个我只使用 tsc(打字稿编译器)编译的包,我希望消费者在使用 npm 或 yarn 安装我的包时安装依赖项。

I don't want want to lock down consumers to using npm or yarn but definitely want the same version of dependency to be installed.我不想将消费者锁定为使用 npm 或 yarn 但绝对希望安装相同版本的依赖项。 What is the recommendation around this?对此有何建议?

Lockfiles like package-lock.json or yarn.lock will be ignored by NPM. NPM 将忽略诸如package-lock.json或 yarn.lock 之类package-lock.json yarn.lock

Also if typescript is your only dependency and you have it listed under devDependencies , any users of your package will not install any sub-packages from your package anyways, since devDependencies are not installed recursively.此外,如果typescript是您唯一的依赖项并且您将其列在devDependencies下,则您的包的任何用户都不会从您的包中安装任何子包,因为devDependencies不是递归安装的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM