npm 包初始化和 git tag 辅助工具。源于搜车前端内部规范化改造,具体指内部功能模块 SDK 化和 GitFlow 流程规范化。Github: git.scm.ppmoney.com/Automation/… 欢迎 star 和 prjavascript
全局安装前端
npm install -g pp-assistor
复制代码
在项目根目录(package.json 所在文件夹)执行java
pp-assistor
复制代码
弹出以下选择界面git
? 选择要执行的命令 (Use arrow keys)
❯ init (用于 npm 包初始化,请在 npm init 后执行)
tag (用于发布前 master 分支的 tag 标记)
复制代码
选择 init 后的交互(Gif)
github
选择 tag 后的交互(Gif)
shell
config 读取规则
优先读取用户目录下的 ~/.npm_assistor.yml
文件,若是不存在,则使 用项目默认配置。
默认配置以下:npm
################### npm-assistor Configuration Example #########################
################## 公共模版库配置 #########################
templates:
# github 远端配置库,会调用 api.github.com 相关 Api 进行内容获取
# 支持多仓库
# github:
# - https://github.com/plusmancn/npm-assistor-template.git
# - http://wangzhe@git.scm.ppmoney.com/Automation/npm-assistor-template.git
# Todo 最好支持下 gitlab,实现内网服务
gitlab:
- http://git.scm.ppmoney.com/Automation/pp-assistor-template.git
################## gitignore 服务器地址 #########################
# 项目地址: https://github.com/joeblau/gitignore.io
# 土豪大大们,能够选择在国内部署一份,屌丝只用得起国外便宜货
gitignore_server: https://www.gitignore.io
复制代码
eslintrc
具体 IDE 集成参考:eslint.orgjson
LICENSE(未作集成)
licenses list by name
并未作成命令行,具体能够参考,源码 licenses-files
文件夹,内含思惟导图 xmind 格式 api
Tag说明
发布号部分遵循 semver 规范设计,简版说明以下服务器
格式如 ${major}.${feature}.${patch},遵循 semver 规范的版本号
选择须要递增的版本号
major: 主版本号,用于断代更新或大版本发布
feature: 特性版本号,用于向下兼容的特性新增
patch: 修订版本号,用于 bug 修复
递增位的右侧位须要清零,如 1.1.2 => 1.2.0
复制代码
发布日期部分遵循 {year}w{weeks}{a-z: 本周第几回发布}
,此部分可选,若是服务端项目发布必带;sdk 发布通常不带
周数定义
const moment = require('moment');
// 更新 week 设置
moment.locale('zh-cn', {
// 每一年第一周的定义:
// 国内:包含1月4号的那周为每一年第一周
// 美国:包含1月1号的那周为每一年第一周(苹果日历也是如此)
// 更新了下 moment,如今规则是 包含1月1号的那周为每一年第一周,新的一周起始于周一
//(比较好理解,苹果日历也可设置,设置->高级->显示周数)
week : {
dow : 1, // Monday is the first day of the week.
doy : 7 // The week that contains Jan 1th is the first week of the year.
}
});
复制代码
GitFlow 流程
附上团队内部修改过的GitFlow 流程。a-successful-git-branching-model/ 原博客结尾有 keynote 源码哈,能够在这基础上改出适合本身团队的 GitFlow
Have Fun!