iconcommittier

Configuration

Config via file

commitier picks up configuration from the following files:

  • .commitierrc
  • .commitierrc.json
  • .commitierrc.yaml
  • .commitierrc.yml
  • .commitierrc.js
  • .commitierrc.cjs
  • .commitierrc.mjs
  • .commitierrc.ts
  • .commitierrc.cts
  • commitier.config.js
  • commitier.config.cjs
  • commitier.config.mjs
  • commitier.config.ts
  • commitier.config.cts

Configuration files are resolved using cosmiconfig.

Config via package.json

You can add a committier field in package.json

Config Example

1. Config with JSON

Create a .committerrc.json file at root, you can partially add fields to override the default config.

.commitierrc.json
{
  "autoEmoji": true,
  "autoScope": true,
  "defaultType": "fix",
  "types": {...}
}

2. Config with JS

Create a committier.config.js file at root.

committier.config.js
import { defineConfig } from "committier"

export default defineConfig({
  autoEmoji: true,
  autoScope: true,
  defaultType: "fix",
  defaultDescription: true,
});

About defineConfig()

This is a helper function providing type intellisense, you can just export an object as well.

Default Config

{
  "autoEmoji": true, // boolean
  "autoScope": false, // boolean | 'replaceToPackageName' (true) | 'defaultToPackageName'
  "defaultType": "fix",
  "defaultDescription": false, // boolean | "fileName" (true) | "fileBasename" | "filePath"
  "types": {
    "feat": {
      "emoji": "โœจ",
      "title": "Feature",
      "description": "A new feature"
    },
    "fix": {
      "emoji": "๐Ÿ›",
      "title": "Bug Fixes",
      "description": "A bug fix"
    },
    "refactor": {
      "emoji": "โ™ป๏ธ",
      "title": "Code Refactoring",
      "description": "A code change that neither fixes a bug nor adds a feature"
    },
    "perf": {
      "emoji": "โšก๏ธ",
      "title": "Performance Improvements",
      "description": "A code change that improves performance"
    },
    "chore": {
      "emoji": "๐ŸŽจ",
      "title": "Chores",
      "description": "Other changes that don't modify src or test files",
      "scopes": [
        {
          "match": "release",
          "emoji": "๐Ÿš€",
          "title": "Release",
          "description": "A new release"
        }
      ]
    },
    "test": {
      "emoji": "๐Ÿงช",
      "title": "Tests",
      "description": "Adding missing tests or correcting existing tests"
    },
    "style": {
      "emoji": "๐Ÿ’„",
      "title": "Styles",
      "description": "Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)"
    },
    "docs": {
      "emoji": "๐Ÿ“",
      "title": "Documentation",
      "description": "Documentation only changes"
    },
    "revert": {
      "emoji": "โž–",
      "title": "Reverts",
      "description": "Reverts a previous commit"
    },
    "build": {
      "emoji": "๐Ÿ“ฆ๏ธ",
      "title": "Builds",
      "description": "Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)"
    },
    "ci": {
      "emoji": "๐Ÿ‘ท",
      "title": "Continuous Integrations",
      "description": "Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)"
    },
    "breakingChange": {
      "emoji": "๐Ÿ’ฅ",
      "title": "Breaking Changes",
      "description": "Introduce breaking changes."
    }
  }
}

Reference

Prop

Type

On this page