CLI Deno Commitizen
Commitizen is a command-line utility that generates conventional commits. The conventional commit specification is a lightweight convention for commit messages that has the following structure (fields within the [] are optional ):
type[optional scope]: description
[optional body]
[optional footer(s)]
The full Commitizen utility can be installed either with PIP (python) or NPM (node). With Deno instead of Node, it's possible to run Commitizen directly from a URL, I made this repository available from this URL: https://tessarinseve.pythonanywhere.com/staticdeno/commitizen-deno/commitizen-deno.
On Windows command prompt, make sure you have GIT and FZF installed, then use Deno to launch the Commitizen client from the command line (see the video at the bottom of the page). An interactive menu will allow selecting the type of commit, followed by a set of questions where you can include the scope and the description of the commit. This will generate a conventional commit message in the local repository.
If your terminal doesn't support ANSI color codes, it's possible to set the NO_COLOR environmental variable to zero.
REM Filename: czc.bat
set NO_COLOR=0
deno.exe run -r --no-check --allow-run --allow-read --allow-env https://tessarinseve.pythonanywhere.com/staticdeno/commitizen-deno/commitizen-deno
Configuration File
It's also possible to define a user's configuration file, here's the default one and its standard location in the file system.
# ~/.config/commitizen-deno/config.yaml
message:
items:
- name: type
description: Select the type of change that you're committing
required: true
form: select
options:
- name: feat
description: A new feature
- name: fix
description: A bug fix
- name: docs
description: Documentation only changes
- name: style
description: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
- name: refactor
description: A code change that neither fixes a bug nor adds a feature
- name: perf
description: A code change that improves performance
- name: test
description: Adding missing tests or correcting existing tests
- name: build
description: "Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)"
- name: ci
description: "Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)"
- name: chore
description: Other changes that don't modify src or test files
- name: revert
description: Reverts a previous commit
- name: scope
description: What is the scope of this change (e.g. component or file name)
form: input
- name: subject
description: Write a short, imperative tense description of the change
required: true
form: input
- name: detail
description: Provide a longer description of the change
form: input
- name: breakingChange
description: Describe the breaking changes if exist
prompt: "BREAKING CHANGE > "
form: input
- name: issue
description: 'Add issue references (e.g. "fix #123", "re #123".)'
form: input
template: "<%- type %><% if (scope) { %>(<%- scope %>)<% } %>: <%- subject %><% if (detail) { %>\n\n<%- detail %><% } %><% if (breakingChange) { %>\n\nBREAKING CHANGE: <%- breakingChange %><% } %><% if (issue) { %>\n\n<%- issue %><% } %>"
Extend Command Prompt (add directories to PATH Environmental Variable)
It may be useful to have an ad hoc profile in the Windows terminal that extends the default PATH. The image below shows Command Prompt shell's configuration that sources a user's batch file at the startup.
In this file the default PATH, it can be for instance extended as follows:
@echo off
REM Vim90
set PATH=%PATH%;C:\Users\Seve\Vim\vim90
REM Git binary folder
set PATH=%PATH%;C:\Users\Seve\workplace\msys2\usr\bin
REM Fzf binary folder
set PATH=%PATH%;C:\Users\Seve\bin