pp-assistor

npm 包初始化和 git tag 輔助工具。源於搜車前端內部規範化改造,具體指內部功能模塊 SDK 化和 GitFlow 流程規範化。Github: git.scm.ppmoney.com/Automation/… 歡迎 star 和 prjavascript

Usage

全局安裝前端

npm install -g pp-assistor
複製代碼

在項目根目錄(package.json 所在文件夾)執行java

pp-assistor
複製代碼

彈出以下選擇界面git

? 選擇要執行的命令 (Use arrow keys)
  ❯ init (用於 npm 包初始化,請在 npm init 後執行) 
    tag (用於發佈前 master 分支的 tag 標記)
複製代碼

選擇 init 後的交互(Gif)
github

npm-assistor-init

選擇 tag 後的交互(Gif)
shell

npm-assistor-tag

Config(Important!!)

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

複製代碼

Init 說明

eslintrc
具體 IDE 集成參考:eslint.orgjson

LICENSE(未作集成)
licenses list by name
並未作成命令行,具體能夠參考,源碼 licenses-files 文件夾,內含思惟導圖 xmind 格式 api

popular-license

Tag 說明

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

GitFlowV2 Of souche

About

Have Fun!

本站公眾號
   歡迎關注本站公眾號,獲取更多信息