Commit Types

照抄了Conventional-Commits 中可能有的 commit 情境,定義了 以下12種 (雖然有幾種 type 例如:improv/chore/perf/refactor,在單一commit中怎麼套用有所爭論),但全部列舉出來由使用者自行分類我覺得 會比較好。

/*
 * Conventional Commits
 * BREAKINGCHANGE = 3 // type = fix、feat 或 choreSemVer 的 MAJOR
 */
export enum CommitTypes {
  build = 'build',      // Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
  ci = 'ci',         // Changes to our CI configuration files and scripts (example scopes: Circle, BrowserStack, SauceLabs)
  chore = 'chore',      //
  docs = 'docs',       // Documentation only changes
  feat = 'feat',       // New Features, SemVer's MINOR
  fix = 'fix',        // Bug Fixes, SemVer's PATCH
  improv = 'improv',
  perf = 'perf',       // A code change that improves performance
  refactor = 'refactor',   // A code change that neither fixes a bug nor adds a feature
  revert = 'revert',
  style = 'style',     // Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
  test = 'test',      // Adding missing tests or correcting existing tests
}

Commit Scopes

Commit Scopes : 定義是一個 commit 修改了哪些範圍,其預設值是先定義幾個比較常見的,例如: 動畫、元件、文件、範例、編譯器、API 等, 之後可以讓使用者自由新增、刪除與排序,我覺得這是比較好的設計。

export const COMMIT_SCOPES_DEFAULT_TEMPLATE = [
  'animations', 'api',
  'compiler', 'component',
  'docs',
  'examples',
];

Section (Types of Changes)

一個 Section 可以包含多種 Commit,在這裏的設計預設值也是先選擇常用的類型。之後可以讓使用者自由新增、刪除與排序。

// Types of changes
export enum SectionTypes {
  Added = 'Added' ,      // for new features.
  Changed = 'Changed',    // for changes in existing functionality.
  Deprecated = 'Deprecated', // for soon-to-be removed features.
  Removed = 'Removed',    // for now removed features.
  Fixed = 'Fixed',      // for any bug fixes., SemVer's PATCH
  BreakingChanges = 'Breaking Changes', // for changes incompatibility with previous version.
}