在Dart和Pub,我应该添加pubspec.lock到我的.gitignore? [英] In Dart and Pub, should I add pubspec.lock to my .gitignore?

查看:1792
本文介绍了在Dart和Pub,我应该添加pubspec.lock到我的.gitignore?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我应该将此生成的文件添加到我的 .gitignore ,以便它不会显示在我的存储库中吗?



pubspec.lock 应包含在我的存放区吗?

解决方案

此答案有两部分,与有关Ruby的问题中的问题和答案类似 bundler



应用程序包



如果您正在使用应用程序包,那么您应该保留 pubspec.lock 文件作为您的依赖关系的快照。




应用程序包应将其锁定文件检查为源代码控制
,以便每个人都可以在应用程序和每个位置
应用程序具有一致的依赖性集合。




库包



但是,如果您正在使用库包



blockquote>

库包不应该将它们的lockfile检查为源代码控制
,因为它们应该支持一系列的依赖版本。







另请参阅锁定文件的Pub词汇表条目


Should I add this generated file to my .gitignore so that it doesn't show up in my repository?

Should pubspec.lock be included in my repository?

解决方案

This answer has two parts, similarly to the question and answer in this question about Ruby bundler.

Application packages

If you are working on an application package, then you should keep the pubspec.lock file in your repository as a snapshot of your dependencies.

From the Pub glossary:

Application packages should check their lockfiles into source control, so that everyone working on the application and every location the application is deployed has a consistent set of dependencies.

Library packages

However, if you are working on a library package, then you should not check in the lockfile.

From the Pub glossary:

Library packages should not check their lockfile into source control, since they should support a range of dependency versions.


See also the Pub glossary entry for lockfiles

这篇关于在Dart和Pub,我应该添加pubspec.lock到我的.gitignore?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆