0%

实力内容

markdown

你你你

代码提交注释

目前没有统一的强制的代码提交注释规范,社区有一些规范,这里着重介绍Angular规范https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#-git-commit-guidelines

Commit message目的

  • 清晰明了,说明本次提交的目的
  • 自动生成CHANGELOG.md
  • 识别不重要的提交
  • 为浏览提交历史时提供更明确的信息

Angular规范标准格式

1
2
3
4
5
<type>(<scope>): <subject>
// 空一行
<body>
// 空一行
<footer>

总体要求,每行字符不得超过72个或100个,避免自动换行

关键词解释

type:说明本次commit的类别,只允许使用

  • feature:一项新功能
  • fix:一个错误修复
  • docs:仅文档更改
  • style:不影响代码含义的更改(空格,格式,缺少分号等)
  • perf:优化或改善性能
  • refactor:重构
  • test:增加测试
  • chore:构建过程或者辅助工具变化
  • revert:用于撤销以前的 commit后面跟着被撤销 Commit 的首行信息,Body部分的格式是固定的,必须写成This reverts commit <hash>.,其中的hash是被撤销 commit 的 SHA 标识符。
  • deps:或者build,依赖的外部资源变化,待定
1
2
3
revert: feat(pencil): add 'graphiteWidth' option

This reverts commit 667ecc1654a317a13331b17617d973392f415f02.

scope:说明 commit 影响的范围,比如数据层、控制层、视图层等等,视项目不同而不同

subject: commit 目的的简短描述,不超过50个字符

注意<type>(<scope>): <subject>只有一行,包括三个字段:type(必需)、scope(可选)和subject(必需)

1
2
3
以动词开头,使用第一人称现在时,比如change,而不是changed或changes
第一个字母小写
结尾不加句号(.)

body:对本次 commit 的详细描述,可以分成多行

1
2
3
4
5
6
7
8
9
More detailed explanatory text, if necessary.  Wrap it to 
about 72 characters or so.

Further paragraphs come after blank lines.

- Bullet points are okay, too
- Use a hanging indent
- 使用第一人称现在时,比如使用change而不是changed或changes
- 说明代码变动的动机,以及与以前行为的对比

footer:只在两种情况出现,不兼容的变动,关闭issue

不兼容变动描述以BREAKING CHANGE开头,后面是变动描述和变动理由及其迁移方法

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
BREAKING CHANGE: isolate scope bindings definition has changed.

To migrate the code follow the example below:

Before:

scope: {
myAttr: 'attribute',
}

After:

scope: {
myAttr: '@',
}

The removed `inject` wasn't generaly useful for directives so there should be no code using it.

关闭issue则以Closes开头

1
Closes #123, #245, #992

标准commit的辅助工具

Commitizenhttps://github.com/commitizen/cz-cli

validate-commit-msghttps://github.com/kentcdodds/validate-commit-msg

根据标准commit生成ChangeLog的辅助工具

conventional-changeloghttps://github.com/ajoslin/conventional-changelog

HEXO与本项目

Hexo 是一个快速、简洁且高效的博客框架。Hexo 使用 Markdown(或其他渲染引擎)解析文章,在几秒内,即可利用靓丽的主题生成静态网页。

本项目是轻量化产品的版本更新信息和开发计划的发布页

使用hexo

  • 安装git
  • 安装Node.js版本推荐10以上
  • npm install -g hexo-cli

新建文章

  • hexo new “文章名”
  • 在source/_posts/找到新建的md并编辑
  • hexo g -d
  • 手动更新pages服务

注意在gitee上面手动更新pages服务,不会自动刷新

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Quick Start

Create a new post

1
$ hexo new "My New Post"

More info: Writing

Run server

1
$ hexo server

More info: Server

Generate static files

1
$ hexo generate

More info: Generating

Deploy to remote sites

1
$ hexo deploy

More info: Deployment