### Install Devmoji Globally and Locally Source: https://github.com/folke/devmoji/blob/master/README.md Instructions for installing the Devmoji CLI tool globally using npm or yarn, and locally as a development dependency for project-specific usage. ```sh npm install -g devmoji yarn global add devmoji ``` ```sh npm install --dev devmoji yarn add --dev devmoji ``` -------------------------------- ### Devmoji Configuration File Example Source: https://github.com/folke/devmoji/blob/master/README.md An example configuration file (`devmoji.config.js`) demonstrating how to customize Devmoji behavior. It shows how to define extra commit types and custom devmojis, including overriding existing ones or adding new ones based on gitmojis. ```javascript module.exports = { // extra types used in commit messages types: ["lint"], // custom devmoji devmoji: [ // use :boom: instead of :sparkles: for the type 'feat' { code: "feat", emoji: "boom" }, // add a custom devmoji { code: "fail", emoji: "poop", description: "something bad happened", }, // add a new devmoji based on an existing gitmoji. description will be taken from the gitmoji { code: "css", gitmoji: "art", }, // the emoji from the gitmoji can be overriden as well { code: "config", gitmoji: "wrench", emoji: "gear", }, ], } ``` -------------------------------- ### Devmoji Text Formatting Examples Source: https://github.com/folke/devmoji/blob/master/README.md Demonstrates how to use Devmoji to convert text between different emoji formats (shortcode, unicode, devmoji) using stdin or the --text flag. ```sh $ echo "This is a :test: of the first :release: :boom: ✨" | devmoji --format shortcode This is a :rotating_light: of the first :rocket: :boom: :sparkles: ``` ```sh $ echo "This is a :test: of the first :release: :boom: :sparkles:" | devmoji --format unicode This is a 🚨 of the first 🚀 💥 ✨ ``` ```sh $ echo "🚀 :boom: :sparkles:" | devmoji --format devmoji :chore-release: :breaking: :feat: ``` ```sh $ echo "test 🚀 :boom: :sparkles: :security:" | devmoji --format strip test ``` -------------------------------- ### Husky Git Hook Integration for Devmoji Source: https://context7.com/folke/devmoji/llms.txt Sets up devmoji as a git hook using Husky to automatically emojify and lint commit messages. This involves installing husky, initializing it, and adding the devmoji command to the prepare-commit-msg or commit-msg hook. ```bash npm install husky --save-dev npx husky install npx husky add .husky/prepare-commit-msg "npx devmoji -e --lint" ``` ```bash npx husky add .husky/commit-msg "npx devmoji -e --lint" ``` ```bash #!/bin/sh . "$(dirname "$0")/_/husky.sh" npx devmoji -e --lint ``` -------------------------------- ### Manage Devmoji Configuration Source: https://context7.com/folke/devmoji/llms.txt Shows how to initialize the Config class with default or custom settings and load configurations from external files. ```typescript import { Config } from "devmoji/lib/config"; const customConfig = new Config({ types: ["lint", "wip"], devmoji: [ { code: "lint", emoji: "rotating_light", description: "linting changes" }, { code: "wip", emoji: "construction", description: "work in progress" }, ], }); const config = await Config.load("./custom-devmoji.config.js"); ``` -------------------------------- ### CLI Command: devmoji --help Source: https://context7.com/folke/devmoji/llms.txt Displays the help menu and available CLI options for the devmoji tool. ```APIDOC ## GET devmoji --help ### Description Displays usage information, available flags, and configuration options for the devmoji CLI. ### Method CLI Command ### Endpoint devmoji --help ### Parameters #### Options - **-c|--config** (string) - Optional - Path to devmoji.config.js - **-l|--list** (boolean) - Optional - List all known devmojis - **-t|--text** (string) - Optional - Text to format - **--lint** (boolean) - Optional - Lint the conventional commit - **-f|--format** (string) - Optional - Output format (unicode, shortcode, devmoji) - **--commit** (boolean) - Optional - Automatically add emoji to header - **-e|--edit** (boolean) - Optional - Read from .git/COMMIT_EDITMSG ``` -------------------------------- ### Display Devmoji CLI Help Source: https://context7.com/folke/devmoji/llms.txt Displays the help menu for the devmoji CLI, detailing all available options and flags for configuration and formatting. ```bash devmoji --help ``` -------------------------------- ### Programmatic CLI Usage Source: https://context7.com/folke/devmoji/llms.txt Explains how to instantiate the CLI class to run commands, format text, and lint commit messages programmatically. ```typescript import { Cli } from "devmoji/lib/cli"; const cli = await Cli.create(["node", "devmoji", "--text", "feat: new feature"]); cli.run(); const result = cli.format("feat: testing", "unicode", true, false); const errors = cli.lint("feat: valid commit"); ``` -------------------------------- ### CLI Command: devmoji --list Source: https://context7.com/folke/devmoji/llms.txt Lists all available devmoji codes, their corresponding emojis, and descriptions. ```APIDOC ## GET devmoji --list ### Description Returns a list of all supported conventional commit types and their mapped emojis. ### Method CLI Command ### Endpoint devmoji --list ### Response #### Success Response (200) - **list** (array) - List of objects containing emoji, code, and description ``` -------------------------------- ### Devmoji CLI Help Output Source: https://github.com/folke/devmoji/blob/master/README.md Displays the available options and usage instructions for the Devmoji command-line interface, including configuration, formatting, and Git integration flags. ```console $ devmoji --help Usage: devmoji [options] Options: -c|--config location of the devmoji.config.js file -l|--list list all known devmojis -t|--text text to format. reads from stdin when omitted --lint lint the conventional commit. disabled for --log -f|--format format should be one of: unicode, shortcode, devmoji (default: "unicode") --commit automatically add a devmoji to the conventional commit header (default: true) --no-commit do not process conventional commit headers -e|--edit read last commit message from .git/COMMIT_EDITMSG in the git root --log format conventional commits in text similar to git log --color use colors for formatting. Colors are enabled by default, unless output is piped to another command (default: true) --no-color don't use colors --version output the version number -h, --help output usage information ``` -------------------------------- ### Control Emoji Output Format Source: https://context7.com/folke/devmoji/llms.txt Demonstrates how to switch between different emoji formats including unicode, shortcode, devmoji aliases, and stripping emojis. ```bash echo "🚀 💥 ✨" | devmoji --format shortcode echo ":test: :release: :boom: :sparkles:" | devmoji --format unicode echo "🚀 :boom: :sparkles:" | devmoji --format devmoji echo "test 🚀 :boom: :sparkles: :security:" | devmoji --format strip ``` -------------------------------- ### CLI Command: devmoji --text Source: https://context7.com/folke/devmoji/llms.txt Formats input text by converting shortcodes to emojis and processing conventional commit headers. ```APIDOC ## POST devmoji --text ### Description Processes input text to inject appropriate emojis based on conventional commit standards. ### Method CLI Command ### Endpoint devmoji --text "[message]" ### Parameters #### Request Body - **text** (string) - Required - The commit message string to process ### Response #### Success Response (200) - **output** (string) - The formatted commit message with emojis ``` -------------------------------- ### CLI Command: devmoji --format Source: https://context7.com/folke/devmoji/llms.txt Controls the output emoji format for the processed text. ```APIDOC ## POST devmoji --format ### Description Specifies the output format for emojis in the processed text. ### Method CLI Command ### Endpoint devmoji --format [format_type] ### Parameters #### Query Parameters - **format_type** (string) - Required - One of: unicode, shortcode, devmoji, strip ### Response #### Success Response (200) - **output** (string) - The text formatted in the requested style ``` -------------------------------- ### CLI Command: devmoji --edit Source: https://context7.com/folke/devmoji/llms.txt Reads and formats the current commit message from the git repository. ```APIDOC ## POST devmoji --edit ### Description Reads the last commit message from .git/COMMIT_EDITMSG and applies devmoji formatting. ### Method CLI Command ### Endpoint devmoji --edit ### Response #### Success Response (200) - **status** (string) - Success message and the updated commit content ``` -------------------------------- ### List Available Devmojis Source: https://github.com/folke/devmoji/blob/master/README.md Displays a list of all available Devmojis that can be used in commit messages or other text. This command is essential for discovering and selecting appropriate emojis. ```shell devmoji --list ``` -------------------------------- ### Format Conventional Commits with Devmoji Source: https://context7.com/folke/devmoji/llms.txt Demonstrates how to use the ConventionalCommits class to inject emojis into commit headers and log outputs based on commit types and scopes. ```typescript import { Config } from "devmoji/lib/config"; import { Devmoji } from "devmoji/lib/devmoji"; import { ConventionalCommits } from "devmoji/lib/conventional-commits"; const devmoji = new Devmoji(new Config()); const cc = new ConventionalCommits(devmoji); cc.formatCommit("feat: testing"); cc.formatCommit("fix(security): upgraded lodash"); cc.formatLog(`* abc123 - feat(cli): added feature\n* def456 - fix: bug fix`); ``` -------------------------------- ### Format Text with Devmoji Source: https://context7.com/folke/devmoji/llms.txt Converts shortcodes to emojis or processes conventional commit headers using the --text flag or standard input. ```bash echo ":rocket: :sparkles:" | devmoji echo "feat: added a new feature" | devmoji devmoji --text "fix(security): upgraded lodash" ``` -------------------------------- ### Yorkie Git Hook Integration for Devmoji Source: https://context7.com/folke/devmoji/llms.txt Configures devmoji as a git hook using Yorkie by adding the necessary commands to the 'gitHooks' section in the package.json file. ```json { "gitHooks": { "prepare-commit-msg": "devmoji -e --lint" } } ``` -------------------------------- ### Default Devmoji Type Mappings Source: https://context7.com/folke/devmoji/llms.txt Provides a reference for the default commit type to emoji mappings and the list of valid commit types used for linting. ```typescript const defaultDevmoji = { "feat": "✨", "fix": "🐛", "docs": "📚", "style": "🎨", "refactor": "♻️", "perf": "⚡", "test": "🚨", "chore": "🔧" }; const validTypes = ["feat", "fix", "docs", "style", "refactor", "perf", "test", "chore"]; ``` -------------------------------- ### Customizing Devmoji with devmoji.config.js Source: https://context7.com/folke/devmoji/llms.txt Customizes devmoji behavior by creating a `devmoji.config.js` file in the project root. This allows for adding custom commit types, overriding emoji mappings, or defining new devmoji codes. ```javascript // devmoji.config.js module.exports = { // Add extra commit types for linting types: ["lint", "wip", "merge"], // Custom devmoji definitions devmoji: [ // Override existing emoji for 'feat' type { code: "feat", emoji: "boom" }, // Add completely custom devmoji { code: "fail", emoji: "poop", description: "something bad happened", }, // Create devmoji based on existing gitmoji // Description is inherited from gitmoji { code: "css", gitmoji: "art", }, // Override emoji while using gitmoji description { code: "config", gitmoji: "wrench", emoji: "gear", }, // Compound type-scope codes { code: "fix-typo", emoji: "pencil2", description: "fix typos in code or docs", }, ], } ``` -------------------------------- ### Format Git Log Output with Devmoji Source: https://context7.com/folke/devmoji/llms.txt Formats commit messages in git log output using devmoji. This command processes commit patterns anywhere in the text, unlike the --commit flag. It requires git log output as input. ```bash git log --oneline | devmoji --log ``` ```bash git log --graph --pretty=format:'%h - %s (%cr) <%an>' | devmoji --log ``` -------------------------------- ### Format Commit Messages with Devmoji Source: https://github.com/folke/devmoji/blob/master/README.md Automagically adds emojis to conventional commit messages based on type and scope. It checks for specific patterns like ':type-scope:', ':type:', and ':scope:' to determine which emojis to apply. The output is a formatted commit message with relevant emojis. ```javascript if (exists(":type-scope:")) return emoji(":type-scope:") if (exists(":type:") && exists(":scope:")) return emoji(":type:") + emoji(":scope:") if (exists(":type:")) return emoji(":type:") ``` ```shell $ echo "feat: added a new feature :smile:" | devmoji --commit feat: ✨ added a new feature 😄 $ echo "chore(release): 1.1.1" | devmoji --commit chore(release): 🚀 1.1.1 $ echo "fix(security): upgraded lodash" | devmoji --commit fix(security): 🐛 🔒 upgraded lodash ``` -------------------------------- ### Format Git Log with Devmoji Source: https://github.com/folke/devmoji/blob/master/README.md Formats commit messages within the output of `git log`. It identifies and transforms patterns like 'type(scope): something useful' anywhere in the log entry, making the log output more readable with emojis. This is useful for creating custom git log aliases. ```shell $ git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --decorate --date=short # Using devmoji --log > using "devmoji --log" ``` -------------------------------- ### Programmatic API: Devmoji Class for Emoji Conversion Source: https://context7.com/folke/devmoji/llms.txt The core Devmoji class for programmatic emoji conversion operations in Node.js applications. It provides methods for emojifying, demojifying, converting to devmoji codes, stripping emojis, and retrieving emojis by code. ```typescript import { Config } from "devmoji/lib/config" import { Devmoji } from "devmoji/lib/devmoji" // Create instance with default config const config = new Config() const devmoji = new Devmoji(config) // emojify: Convert shortcodes to Unicode emojis devmoji.emojify(":rocket:") // Returns: "🚀" devmoji.emojify(":sparkles: :bug:") // Returns: "✨ 🐛" devmoji.emojify(":missing:") // Returns: ":missing:" (unknown codes unchanged) devmoji.emojify("testing 123") // Returns: "testing 123" (plain text unchanged) // demojify: Convert Unicode emojis to shortcodes devmoji.demojify("🚀") // Returns: ":rocket:" devmoji.demojify("✨ 🐛") // Returns: ":sparkles: :bug:" // devmojify: Convert to devmoji codes (semantic aliases) devmoji.devmojify(":rocket:") // Returns: ":chore-release:" devmoji.devmojify(":sparkles:") // Returns: ":feat:" devmoji.devmojify("🚀") // Returns: ":chore-release:" // strip: Remove all emojis from text devmoji.strip("build: 📦 added") // Returns: "build: added" devmoji.strip("testing 123 :feat:") // Returns: "testing 123" // get: Retrieve Unicode emoji for a code devmoji.get("rocket") // Returns: "🚀" devmoji.get("feat") // Returns: "✨" ``` -------------------------------- ### Lint Commit Messages with Devmoji Source: https://github.com/folke/devmoji/blob/master/README.md Lints commit messages to verify if they adhere to the conventional commit format. This functionality helps ensure commit messages are standardized and easily parsable. ```shell devmoji --lint ``` -------------------------------- ### Validate Commit Messages with Devmoji Lint Source: https://context7.com/folke/devmoji/llms.txt Validates commit messages against the conventional commit format. Exits with error code 1 if the message is invalid. It takes commit messages as standard input. ```bash echo "feat(cli): added new feature" | devmoji --lint ``` ```bash echo "invalid: not a conventional commit" | devmoji --lint ``` ```bash echo "feat:" | devmoji --lint ``` -------------------------------- ### Format Commit Message via Edit Hook Source: https://context7.com/folke/devmoji/llms.txt Reads the current commit message from .git/COMMIT_EDITMSG and formats it, typically used within git hooks. ```bash devmoji --edit ``` -------------------------------- ### Edit and Save Commit Messages with Devmoji Source: https://github.com/folke/devmoji/blob/master/README.md Formats and saves the current commit message in `.git/COMMIT_EDITMSG`. This is primarily useful as a `prepare-commit-msg` or `commit-msg` Git hook. It can be used in conjunction with linting tools like commitlint. ```shell # Using Husky $ npx husky install $ npx husky add .husky/prepare-commit-msg "npx devmoji -e --lint" ``` ```javascript // Using Yorkie in package.json { "gitHooks": { "prepare-commit-msg": "devmoji -e --lint" } } ``` ```shell # If Devmoji is a local dev dependency $ npx --no-install devmoji -e --lint ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.