npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@4s1/conventional-commit-creator

v3.12.0

Published

Conventional Commit Creator

Downloads

179

Readme

Conventional Commit Creator

Please don't upload to GitHub

This CLI application assists you in creating commit messages that are conform to the conventional commit style. It will ask for type, scope, description, body and issue id.

Features:

⭐ format of the commit message can be fully customized
⭐ different templates for your repositories based on Git remote url
⭐ issue id can be inserted in up to three places of a commit message

Install & usage

Install this package globally.

npm install -g @4s1/conventional-commit-creator

Inside your repository run Conventional Commit Creator.

conventional-commit-creator
# or just
ccc

Configure commit message templates

The configuration is stored in ~/.config/conventional-commit-creator/config.json.

The default template look like the following json:

{
  "$schema": "https://www.4s1.de/conventional-commit-creator/schema.json",
  "version": 1,
  "templates": [
    {
      "name": "Default",
      "regex": ".*",
      "pattern": "{type}{scope}: {description}{issue}{body}",

      "pre_type": "",
      "post_type": "",
      "pre_scope": "(",
      "post_scope": ")",
      "pre_description": "",
      "post_description": "",
      "pre_body": "\n\n",
      "post_body": "",

      "pre_issue": " (#",
      "post_issue": ")",
      "pre_issue2": "",
      "post_issue2": "",
      "pre_issue3": "",
      "post_issue3": ""
    }
  ]
}

and will create the following commit message:

--- your input --------------------------

type: chore
scope: foo
description: some description
body: Lorem ipsum dolor sit amet.
issue: 42

--- commit message result ---------------

chore(foo): some description (#42)

Lorem ipsum dolor sit amet.

The pre and post texts are only inserted if a matching middle part has also been entered.

Now let's look at another more complex variant.

We take the configuration from above, remove all empty strings (missing settings are replaced by empty strings) and add another template that should apply to all GitHub projects (see regex).

{
  "$schema": "https://www.4s1.de/conventional-commit-creator/schema.json",
  "version": 1,
  "templates": [
    {
      "name": "Default",
      "regex": ".*",
      "pattern": "{type}{scope}: {description}{issue}{body}",
      "pre_scope": "(",
      "post_scope": ")",
      "pre_body": "\n\n",
      "pre_issue": " (#",
      "post_issue": ")"
    },
    {
      "name": "GitHub Project",
      "regex": "^.*github.*$",
      "pattern": "{type}{scope}: {description}{body}{issue}{issue2}{issue3}",
      "pre_scope": "(",
      "post_scope": ")",
      "pre_body": "\n\n",
      "pre_issue": "\n\nRefs: #",
      "pre_issue2": " | [refs #",
      "post_issue2": "]",
      "pre_issue3": " | REDMINE-",
      "post_issue3": ""
    }
  ]
}

This will result in the following commit example:

--- your input --------------------------

type: refactor
scope: -
description: foobar
body: Hallo \n world
issue: 42

--- commit message result ---------------

refactor: foobar

Hallo
world

Refs: #42 | [refs #42] | REDMINE-42

or without issue id

--- your input --------------------------

type: refactor
scope: -
description: foobar
body: Hallo \n world
issue: -

--- commit message result ---------------

refactor: foobar

Hallo
world

Checking the Git remote url via regular expression is done in the order the templates were specified from top to bottom. The last hit wins.