Monorepo版本标签约定 [英] Monorepo Version Tags Conventions

查看:93
本文介绍了Monorepo版本标签约定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在monorepos中使用版本标记是否有标准?是否符合1.0.0-myapp12.1.0-myapp2的要求?还是有另一种方法来区分应用程序之间的版本?

Is there a standard for using version tags in monorepos? Is something along the lines of 1.0.0-myapp1, and 2.1.0-myapp2 acceptable? Or is there another way to differentiate versions between applications?

推荐答案

tags组织在目录和文件中(所有git引用都在其中,请运行tree .git/refs/tags进行查看),所以我建议命名标签:

tags are organized in directories and files (all git references are, run tree .git/refs/tags to see that), so I would suggest naming the tags :

myapp1/1.0.0
myapp1/1.0.1
 ...
myapp2/2.1.0
myapp2/2.2.0
 ...

这会将每个应用程序的版本分组在一起,并且某些命令将自然地"对待数字:

This will group versions for each app together, and some commands will treat the numbers "naturally" :

# list tags, sorted by version number :
$ git tag --list --sort="version:refname"
myapp1/1.0.2
myapp1/1.0.10
myapp1/2.0.0
myapp1/10.0.0
myapp2/1.0.0
myapp2/2.0.0
myapp2/11.0.0


如果要避免在检查myapp1的日志时显示"myapp2的标签",则可以使用--decorate-refs=<pattern>:

# this will include tags starting with 'myapp1', and all branches :
$ git log --oneline --graph --decorate-refs=refs/tags/myapp1 --decorate-refs=refs/heads

如果您定期需要此功能,则可以为其添加别名:

If you need this on a regular basis, you can add an alias for it :

$ git config alias.logmyapp1 log --decorate-...

这篇关于Monorepo版本标签约定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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