@mihairo/cmt 1.1.3 → 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -124,7 +124,6 @@ validate it automatically — no extension needed.
124
124
  ```json
125
125
  {
126
126
  "$schema": "https://raw.githubusercontent.com/mihai-ro/cmt/main/schema/cmt.schema.json",
127
- "version": "1.1.0",
128
127
  "customTypes": [
129
128
  {
130
129
  "type": "wip",
package/cmt CHANGED
@@ -6,9 +6,9 @@
6
6
  # =============================================================================
7
7
  set -euo pipefail
8
8
 
9
- CC_VERSION="1.1.2"
10
- CC_CONFIG_FILE=".cmt.json"
11
- CC_SCHEMA_URL="https://raw.githubusercontent.com/mihai-ro/cmt/main/schema/cmt.schema.json"
9
+ CMT_VERSION="1.1.4" # x-release-please-version
10
+ CMT_CONFIG_FILE=".cmt.json"
11
+ CMT_SCHEMA_URL="https://raw.githubusercontent.com/mihai-ro/cmt/main/schema/cmt.schema.json"
12
12
 
13
13
  # colours
14
14
  if [[ -z "${NO_COLOR:-}" ]] && ([[ -t 1 ]] || [[ -c /dev/tty ]]); then
@@ -58,7 +58,7 @@ BUILTIN_TYPES=(
58
58
 
59
59
  # config loader
60
60
  load_config() {
61
- local cfg="${CC_CONFIG_FILE}"
61
+ local cfg="${CMT_CONFIG_FILE}"
62
62
 
63
63
  TYPES=("${BUILTIN_TYPES[@]}")
64
64
  CUSTOM_SCOPES=()
@@ -563,7 +563,7 @@ cmd_commit() {
563
563
  fi
564
564
  fi
565
565
 
566
- printf "\n ${ACCENT_BOLD}cmt${RESET} ${MUTED}conventional commits v%s${RESET}\n" "$CC_VERSION" >/dev/tty
566
+ printf "\n ${ACCENT_BOLD}cmt${RESET} ${MUTED}conventional commits v%s${RESET}\n" "$CMT_VERSION" >/dev/tty
567
567
  printf " ${MUTED}─────────────────────────────────────${RESET}\n" >/dev/tty
568
568
 
569
569
  SELECTED_TYPE="" SELECTED_SCOPE="" SELECTED_DESC=""
@@ -727,23 +727,23 @@ SNIPPET
727
727
  # install or append cmt block to a hook file
728
728
  # usage: _install_hook <path> <needs_shebang> <cmt_path> [snippet_fn]
729
729
  _install_hook() {
730
- local path="$1" shebang="${2:-1}" cc_path="$3" snippet_fn="${4:-_hook_snippet}"
730
+ local path="$1" shebang="${2:-1}" cmt_path="$3" snippet_fn="${4:-_hook_snippet}"
731
731
  local marker; [[ "$snippet_fn" == "_lint_snippet" ]] && marker="cmt-lint" || marker="cmt"
732
732
 
733
733
  if [[ -f "$path" ]]; then
734
734
  if grep -q ">>> ${marker}" "$path" 2>/dev/null; then
735
735
  local tmp; tmp=$(mktemp)
736
736
  awk "/# >>> ${marker}/{skip=1} !skip{print} /# <<< ${marker}/{skip=0}" "$path" > "$tmp"
737
- "$snippet_fn" "$cc_path" >> "$tmp"
737
+ "$snippet_fn" "$cmt_path" >> "$tmp"
738
738
  mv "$tmp" "$path"
739
739
  success "Updated ${marker} block in $(basename "$(dirname "$path")")/$(basename "$path")"
740
740
  else
741
- "$snippet_fn" "$cc_path" >> "$path"
741
+ "$snippet_fn" "$cmt_path" >> "$path"
742
742
  success "Appended to $(basename "$(dirname "$path")")/$(basename "$path")"
743
743
  fi
744
744
  else
745
745
  [[ "$shebang" == "1" ]] && printf '#!/usr/bin/env bash\n' > "$path"
746
- "$snippet_fn" "$cc_path" >> "$path"
746
+ "$snippet_fn" "$cmt_path" >> "$path"
747
747
  chmod +x "$path"
748
748
  success "Created $(basename "$(dirname "$path")")/$(basename "$path")"
749
749
  fi
@@ -802,7 +802,7 @@ cmd_types() {
802
802
  printf " %s ${BOLD}%-12s${RESET}${badge} ${MUTED}%s${RESET}\n" "$e" "$t" "$d"
803
803
  done
804
804
  printf "\n"
805
- if [[ -f "$CC_CONFIG_FILE" ]]; then
805
+ if [[ -f "$CMT_CONFIG_FILE" ]]; then
806
806
  printf " ${MUTED}custom types from .cmt.json included above${RESET}\n\n"
807
807
  else
808
808
  printf " ${MUTED}run cmt init to configure custom types${RESET}\n\n"
@@ -814,16 +814,15 @@ cmd_types() {
814
814
  cmd_init() {
815
815
  git rev-parse --git-dir > /dev/null 2>&1 || die "Not inside a git repository"
816
816
 
817
- local git_root cc_path
817
+ local git_root cmt_path
818
818
  git_root=$(git rev-parse --show-toplevel)
819
- cc_path=$(realpath "$0")
819
+ cmt_path=$(realpath "$0")
820
820
 
821
821
  # .cmt.json
822
- if [[ ! -f "${git_root}/${CC_CONFIG_FILE}" ]]; then
823
- cat > "${git_root}/${CC_CONFIG_FILE}" << JSONEOF
822
+ if [[ ! -f "${git_root}/${CMT_CONFIG_FILE}" ]]; then
823
+ cat > "${git_root}/${CMT_CONFIG_FILE}" << JSONEOF
824
824
  {
825
- "\$schema": "${CC_SCHEMA_URL}",
826
- "version": "${CC_VERSION}",
825
+ "\$schema": "${CMT_SCHEMA_URL}",
827
826
  "customTypes": [
828
827
  { "type": "wip", "emoji": "🚧", "semver": "none", "description": "Work in progress" }
829
828
  ],
@@ -848,15 +847,15 @@ JSONEOF
848
847
 
849
848
  if [[ $use_husky -eq 1 ]]; then
850
849
  mkdir -p "${git_root}/.husky"
851
- _install_hook "${git_root}/.husky/prepare-commit-msg" 0 "$cc_path"
850
+ _install_hook "${git_root}/.husky/prepare-commit-msg" 0 "$cmt_path"
852
851
  if [[ $use_lint -eq 1 ]]; then
853
- _install_hook "${git_root}/.husky/commit-msg" 0 "$cc_path" _lint_snippet
852
+ _install_hook "${git_root}/.husky/commit-msg" 0 "$cmt_path" _lint_snippet
854
853
  fi
855
854
  printf " ${DIM}Commit .husky/ hooks to share with your team.${RESET}\n"
856
855
  else
857
- _install_hook "${git_root}/.git/hooks/prepare-commit-msg" 1 "$cc_path"
856
+ _install_hook "${git_root}/.git/hooks/prepare-commit-msg" 1 "$cmt_path"
858
857
  if [[ $use_lint -eq 1 ]]; then
859
- _install_hook "${git_root}/.git/hooks/commit-msg" 1 "$cc_path" _lint_snippet
858
+ _install_hook "${git_root}/.git/hooks/commit-msg" 1 "$cmt_path" _lint_snippet
860
859
  fi
861
860
  fi
862
861
 
@@ -911,8 +910,8 @@ cmd_uninstall() {
911
910
  done
912
911
 
913
912
  # remove .cmt.json config
914
- if [[ -f "${git_root}/${CC_CONFIG_FILE}" ]]; then
915
- rm "${git_root}/${CC_CONFIG_FILE}"
913
+ if [[ -f "${git_root}/${CMT_CONFIG_FILE}" ]]; then
914
+ rm "${git_root}/${CMT_CONFIG_FILE}"
916
915
  success "Removed .cmt.json"
917
916
  removed=1
918
917
  fi
@@ -924,13 +923,13 @@ cmd_uninstall() {
924
923
 
925
924
  # cmd: version
926
925
  cmd_version() {
927
- printf "cmt version %s\n" "$CC_VERSION"
926
+ printf "cmt version %s\n" "$CMT_VERSION"
928
927
  }
929
928
 
930
929
  # cmd: help
931
930
  cmd_help() {
932
931
  printf "
933
- ${BOLD}${CYAN}cmt${RESET} v${CC_VERSION} — Conventional Commits CLI
932
+ ${BOLD}${CYAN}cmt${RESET} v${CMT_VERSION} — Conventional Commits CLI
934
933
 
935
934
  ${BOLD}USAGE${RESET}
936
935
  cmt <command> [options]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mihairo/cmt",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "description": "Zero-dependency conventional commits CLI — interactive picker, linter, and git hook installer. One bash script, works in any repo.",
5
5
  "keywords": [
6
6
  "conventional-commits",
@@ -12,14 +12,6 @@
12
12
  "description": "JSON Schema pointer — enables editor intellisense. Leave as-is."
13
13
  },
14
14
 
15
- "version": {
16
- "type": "string",
17
- "description": "Config schema version. Currently '1.1.2'.",
18
- "pattern": "^\\d+\\.\\d+\\.\\d+$",
19
- "default": "1.1.2",
20
- "examples": ["1.1.2"]
21
- },
22
-
23
15
  "customTypes": {
24
16
  "type": "array",
25
17
  "description": "Additional commit types appended after the built-in ones (feat, fix, docs, …).",
@@ -124,7 +116,6 @@
124
116
  "examples": [
125
117
  {
126
118
  "$schema": "https://raw.githubusercontent.com/mihai-ro/cmt/main/schema/cc.schema.json",
127
- "version": "1.1.2",
128
119
  "customTypes": [
129
120
  {
130
121
  "type": "wip",