Skip to content

Commitizen adapter for commit messages using gitmojis 😜.

License

Notifications You must be signed in to change notification settings

jebarpg/cz-gitmoji-adapter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

cz-gitmoji-adapter

Commitizen adapter formatting commit messages using gitmojis.

cz-gitmoji-adapter allows you to easily use gitmojis in your commits using [commitizen].

? Select the type of change you are committing: (Use arrow keys)
❯ feature   🌟  A new feature
  fix       🐞  A bug fix
  docs      πŸ“š  Documentation change
  refactor  🎨  A code refactoring change
  chore     πŸ”©  A chore change

Install

Globally

npm install --global cz-gitmoji-adapter

# set as default adapter for your projects
echo '{ "path": "cz-gitmoji-adapter" }' > ~/.czrc

Locally

npm install --save-dev cz-gitmoji-adapter

Add this to your package.json:

"config": {
  "commitizen": {
    "path": "cz-gitmoji-adapter"
  }
}

ℹ️ pnpm requires you to specify node_modules/cz-gitmoji-adapter.

Usage

$ git cz

Customization

By default cz-gitmoji-adapter comes ready to run out of the box. Uses may vary, so there are a few configuration options to allow fine tuning for project needs.

How to

Configuring cz-gitmoji-adapter can be handled in the users home directory (~/.czrc) for changes to impact all projects or on a per project basis (package.json). Simply add the config property as shown below to the existing object in either of the locations with your settings for override.

{
  "config": {
    "cz-gitmoji-adapter": {}
  }
}

Configuration Options

Types

By default cz-gitmoji-adapter comes preconfigured with the Gitmoji types.

An [Inquirer.js] choices array:

{
  "config": {
    "cz-gitmoji-adapter": {
      "types": [
        {
          "emoji": "🌟",
          "code": ":star2:",
          "description": "A new feature",
          "name": "feature"
        }
      ]
    }
  }
}

Scopes

An [Inquirer.js] choices array:

{
  "config": {
    "cz-gitmoji-adapter": {
      "scopes": ["home", "accounts", "ci"]
    }
  }
}

Symbol

A boolean value that allows for an using a unicode value rather than the default of Gitmoji markup in a commit message. The default for symbol is false.

{
  "config": {
    "cz-gitmoji-adapter": {
      "symbol": true
    }
  }
}

Skip Questions

An array of questions you want to skip:

{
  "config": {
    "cz-gitmoji-adapter": {
      "skipQuestions": ["scope", "issues"]
    }
  }
}

You can skip the following questions: scope, body, issues, and breaking. The type and subject questions are mandatory.

Customize Questions

An object that contains overrides of the original questions:

{
  "config": {
    "cz-gitmoji-adapter": {
      "questions": {
        "body": "This will be displayed instead of original text"
      }
    }
  }
}

Customize the subject max length

The maximum length you want your subject has

{
  "config": {
    "cz-gitmoji-adapter": {
      "subjectMaxLength": 200
    }
  }
}

Commitlint

Commitlint can be set to work with this package with the following configuration:

commitlint.config.ts

import {
    RuleConfigCondition,
    RuleConfigSeverity,
    TargetCaseType,
} from '@commitlint/types';

export default {
    extends: ['gitmoji'],
    parserPreset: 'gitmoji-parser-opts',
    rules: {
        'body-leading-blank': [RuleConfigSeverity.Warning, 'always'] as const,
        'body-max-line-length': [RuleConfigSeverity.Error, 'always', 100] as const,
        'footer-leading-blank': [RuleConfigSeverity.Warning, 'always'] as const,
        'footer-max-line-length': [
            RuleConfigSeverity.Error,
            'always',
            100,
        ] as const,
        'header-max-length': [RuleConfigSeverity.Error, 'always', 100] as const,
        'header-trim': [RuleConfigSeverity.Error, 'always'] as const,
        'subject-case': [
            RuleConfigSeverity.Error,
            'never',
            ['sentence-case', 'start-case', 'pascal-case', 'upper-case'],
        ] as [RuleConfigSeverity, RuleConfigCondition, TargetCaseType[]],
        'subject-empty': [RuleConfigSeverity.Error, 'never'] as const,
        'subject-full-stop': [RuleConfigSeverity.Error, 'never', '.'] as const,
        'type-case': [RuleConfigSeverity.Error, 'always', 'lower-case'] as const,
        'type-empty': [RuleConfigSeverity.Error, 'never'] as const,
        'type-enum': [
            RuleConfigSeverity.Error,
            'always',
            [
                'style',
                'perf',
                'prune',
                'fix',
                'quickfix',
                'feature',
                'docs',
                'deploy',
                'ui',
                'init',
                'test',
                'security',
                'osx',
                'linux',
                'windows',
                'android',
                'ios',
                'release',
                'lint',
                'wip',
                'fix-ci',
                'downgrade',
                'upgrade',
                'pushpin',
                'ci',
                'analytics',
                'refactoring',
                'docker',
                'dep-add',
                'dep-rm',
                'config',
                'i18n',
                'typo',
                'poo',
                'revert',
                'merge',
                'dep-up',
                'compat',
                'mv',
                'license',
                'breaking',
                'assets',
                'review',
                'access',
                'docs-code',
                'beer',
                'texts',
                'db',
                'log-add',
                'log-rm',
                'contrib-add',
                'ux',
                'arch',
                'iphone',
                'clown-face',
                'egg',
                'see-no-evil',
                'camera-flash',
                'experiment',
                'seo',
                'k8s',
                'types',
                'seed',
                'flags',
                'animation',
                'wastebasket',
                'passport-control',
                'adhesive-bandage',
                'monocle-face',
                'coffin',
                'test-tube',
                'necktie',
                'stethoscope',
                'bricks',
                'technologist'
            ],
        ] as [RuleConfigSeverity, RuleConfigCondition, string[]],
    }
};

About

Commitizen adapter for commit messages using gitmojis 😜.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published