Gitmoji

repository·master·Indexed 12 days ago

https://github.com/carloscuesta/gitmoji

An initiative to standardize the use of emojis in GitHub commit messages. It provides a CLI tool for interactive usage, an npm package called `gitmojis` for programmatic access to the emoji list, and a public HTTP API endpoint.

Tokens
1.7K
Snippets
12
Records
14
Agent score
96%

What's inside Gitmoji

  1. Standard Gitmoji commit message format

    master

    To maintain consistency when using gitmojis, follow this recommended commit message structure:

    <intention> [scope?][:?] <message>

    • <intention>: An emoji from the gitmoji list representing the purpose of the commit.
    • [scope?]: An optional string providing contextual information about the area of the code being changed.
    • [:?]: Optional separator.
    • <message>: A brief, descriptive explanation of the change.
  2. Use the gitmojis Node module

    master

    Import the gitmojis constant from the gitmojis package. It returns an array of objects, where each object represents a gitmoji with its corresponding emoji, HTML entity, shortcode, description, and name.

    import { gitmojis } from 'gitmojis'
    
    console.log(gitmojis)
    
    /*
    [
      {
        emoji: '🎨',
        entity: '&#x1f3a8;',
        code: ':art:',
        description: 'Improve structure / format of the code.',
        name: 'art',
        semver: null
      },
      {
        emoji: '⚡️',
        entity: '&#x26a1;',
        code: ':zap:',
        description: 'Improve performance.',
        name: 'zap',
        semver: null
      },
      ...
    ]
    */
  3. Add a Gitmoji badge to your README

    master

    You can display a Gitmoji badge at the top of your project's README to indicate support for the initiative using the following HTML snippet:

    <a href="https://gitmoji.dev">
      <img
        src="https://img.shields.io/badge/gitmoji-%20😜%20😍-FFDD67.svg?style=flat-square"
        alt="Gitmoji"
      />
    </a>
  4. Configure next-sitemap for the gitmoji website

    master

    The next-sitemap.config.js file defines the configuration for generating sitemaps and robots.txt files using the next-sitemap package. It uses the IConfig type from next-sitemap to ensure valid settings.

    /** @type {import('next-sitemap').IConfig} */
    module.exports = {
      siteUrl: 'https://gitmoji.dev',
      generateRobotsTxt: true,
    }
  5. Access the gitmojis list via the gitmojis package

    master

    The gitmojis package provides a direct export of the complete list of gitmojis. You can import the gitmojis constant to access the array of gitmoji objects, which contains the emoji, description, and other metadata for each gitmoji. Additionally, the package exports a schema object representing the JSON schema used for the gitmoji data.

    import { gitmojis, schema } from 'gitmojis';
    
    console.log(gitmojis); // Array of gitmoji objects
    console.log(schema);   // The JSON schema for the gitmojis data
  6. Exported gitmojis list

    master

    The gitmojis constant is a read-only array of Gitmoji objects. It is the primary entry point for accessing the full list of available gitmojis and their metadata.

    import { gitmojis } from 'gitmojis';
    
    // Example usage: finding a specific gitmoji by name
    const bugEmoji = gitmojis.find(g => g.name === 'bug');
    console.log(bugEmoji?.code); // ':bug:'
  7. The Gitmoji type definition

    master

    The Gitmoji type represents a single gitmoji object. Each object contains the emoji character, its HTML entity, a description of its use-case, its name, its associated semver impact, and its shortcode format.

    type Gitmoji = {
      readonly emoji: string;      // e.g. '🎨'
      readonly entity: `&#${string};`; // e.g. '&#x1f3a8;'
      readonly description: string; // e.g. '🎨 Art'
      readonly name: string;       // e.g. 'art'
      readonly semver: 'patch' | 'minor' | 'major' | null;
      readonly code: `:${string}:`; // e.g. ':art:'
    }