{"id":16615868,"url":"https://github.com/manudeli/husky-commitlint-commitizen","last_synced_at":"2025-10-29T19:30:38.158Z","repository":{"id":132435984,"uuid":"489610601","full_name":"manudeli/husky-commitlint-commitizen","owner":"manudeli","description":"Conventional Commit 강제하기","archived":false,"fork":false,"pushed_at":"2022-05-22T14:09:46.000Z","size":357,"stargazers_count":15,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-02T04:31:45.115Z","etag":null,"topics":["commitizen","commitlint","husky"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/manudeli.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-07T08:05:25.000Z","updated_at":"2024-02-02T02:47:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"2b61ae51-25e0-4d07-bb8d-6526b20f79a8","html_url":"https://github.com/manudeli/husky-commitlint-commitizen","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manudeli%2Fhusky-commitlint-commitizen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manudeli%2Fhusky-commitlint-commitizen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manudeli%2Fhusky-commitlint-commitizen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manudeli%2Fhusky-commitlint-commitizen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/manudeli","download_url":"https://codeload.github.com/manudeli/husky-commitlint-commitizen/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238874437,"owners_count":19545190,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["commitizen","commitlint","husky"],"created_at":"2024-10-12T02:11:02.496Z","updated_at":"2025-10-29T19:30:32.831Z","avatar_url":"https://github.com/manudeli.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 📼 Conventional Commit 발표 영상 (아래를 클릭하세요)\n[![Conventional Commit 매쉬업 발표](http://img.youtube.com/vi/l4bRepOMXs4/0.jpg)](https://youtu.be/l4bRepOMXs4)\n\n# Conventional Commit 강제하기\n## [🔗 Conventional Commit](https://www.conventionalcommits.org/en/v1.0.0/)이란?\n```\n\u003ctype\u003e[optional scope]: \u003cdescription\u003e\n\n[optional body]\n\n[optional footer(s)]\n```\nConventional Commits은 가벼운 커밋 컨벤션입니다. 정확한 커밋 히스토리를 만드는데 가장 쉬운 룰입니다. 유명한 자동화 툴을 이 컨벤션으로 사용하기 쉽게 해줍니다. 이 컨벤션은 features, fixes, breaking changes가 커밋메시지로 만드는 SemVer(Semantic Version의 줄임말)과 잘 맞습니다.\n\n\u003e The Conventional Commits specification is a lightweight convention on top of commit messages. It provides an easy set of rules for creating an explicit commit history; which makes it easier to write automated tools on top of. This convention dovetails with SemVer, by describing the features, fixes, and breaking changes made in commit messages.\n\n## Semantic Versioning\n```\nMAJOR.MINOR.PATCH 버전 번호가 주어지면 다음을 증가시킵니다.\n1. 호환되지 않는 API 변경 시 MAJOR 버전,\n2. 이전 버전과 호환되는 방식으로 기능을 추가하는 경우 MINOR 버전 및\n3. 이전 버전과 호환되는 버그 수정을 할 때 PATCH 버전.\n시험판 및 빌드 메타데이터에 대한 추가 레이블은 MAJOR.MINOR.PATCH 형식의 확장으로 사용할 수 있습니다.\n```\n### 왜 [🔗 Semantic Versioning](https://semver.org/)이 필요했나?\n소프트웨어 관리의 세계에는 의존성 지옥이라 불리는 두려움이 있습니다. 점점 더 많은 패키지들을 우리의 시스템에 함께 사용할 수록 언젠가는 절망의 구덩이에 빠지게 될 가능성이 커집니다. (자세한 내용은 링크에서)\n\n\u003eIn the world of software management there exists a dreaded place called “dependency hell.” The bigger your system grows and the more packages you integrate into your software, the more likely you are to find yourself, one day, in this pit of despair.\n\n# `husky + commitlint + commitizen` 설정을 통한 Conventional Commit 강제\n\n## husky\ngit-hook을 외부에서 사용할 수 있도록 도와주는 라이브러리\n\n### 유명한 사용자\n\u003e webpack/webpack\nangular/angular\nangular/angular-cli\nangular/components\nvercel/hyper\nblitz-js/blitz\nfacebook/docusaurus\ntypescript-eslint/typescript-eslint\n11ty/eleventy\nstylelint/stylelint\nrollup/rollup\ntauri-apps/tauri\nNativeScript/NativeScript\nformatjs/formatjs\nreact-bootstrap/react-bootstrap\nreact-dnd/react-dnd\nreact-grid-layout/react-grid-layout\nsnabbdom/snabbdom\nlogaretm/vee-validate\nzenorocha/clipboard.js\nNodeBB/NodeBB\nant-design/ant-design\nAnd more\n\n## commitlint\nhusky와 함께 사용해 commit message의 유효성검사를 하는 라이브러리\n\n## commitizen\ncommit message를 정해진 형식에 맞춰서 입력하도록 선택지를 보여주는 라이브러리\n\n## 1. husky + commitlint 로 Conventional Commit만 커밋메시지로 강제하기\n\n### a. 의존성 추가\n```\nnpm i -D husky @commitlint/cli @commitlint/config-conventional\n```\n\n### b. `package.json` Life Cycle scripts 중 `postinstall`에 추가후 `npm i`\n다른 클론 받은 개발자가 husky를 다운로드 받은 상황에서 사용할 수 있도록 추가\n```json\n\"script\": {\n  \"postinstall\": \"husky install\"\n}\n```\n\n### c. root에 `commitlint.config.ts`를 추가\n```typescript\nimport type { UserConfig } from '@commitlint/types'\n\nconst Configuration: UserConfig = {\n  extends: ['@commitlint/config-conventional'],\n}\n\nmodule.exports = Configuration\n\n```\n\n### d. .husky/commit-msg 추가\n```shell\n#!/bin/sh\n. \"$(dirname \"$0\")/_/husky.sh\"\n\nnpx --no-install commitlint --edit \"$1\"\n```\n\n## 2. commitizen으로 커밋 메시지 선택지를 쉽게 선택하도록 하기\n\n### a. `package.json` scripts 에 `commit` 추가 (의존성 설치하지 않고 사용하기)\n```json\n\"scripts\": {\n  \"commit\": \"npx cz-customizable\"\n}\n```\n\n### b. root에 `.cz-config.js`를 추가 후 원하는 typeEnum으로 나오도록 설정\n```javascript\nconst typeEnums = {\n  feat: '새로운 기능 추가 시',\n  fix: '버그 해결 / 수정 시',\n  docs: '도큐멘테이션 추가 또는 수정 시',\n  markup: '마크업 추가시',\n  revert: '작업 되돌리기 시',\n  style: '스타일 추가시',\n  remove: '불필요한 파일 제거 시',\n  perf: '성능 개선 시',\n  ci: 'CI 구성 파일 및 스크립트 변경 시',\n  event: '이벤트 추가시',\n  config: '설정파일 변경 / 추가시',\n}\n\nconst maxSpaceLength = Object.keys(typeEnums).reduce(\n  (acc, { length }) =\u003e (length \u003e acc ? length : acc),\n  0,\n)\n\nconst commitizenConfig = {\n  types: Object.entries(typeEnums).map(([type, description]) =\u003e ({\n    value: type,\n    name: `${type}:     ${' '.repeat(maxSpaceLength - type.length)}` + description,\n  })),\n}\n\nmodule.exports = commitizenConfig\n```\n\n### c. 자세한 `.cz-config.js` 설정하기\n[🔗 설정하기 참고 링크](https://github.com/leoforfree/cz-customizable#options)\n\n\n## 3. commitlint - commitizen 룰 동기화\n\n### a. commitlint룰이 commitizen룰의 typeEnum을 바라보도록 해서 동기화\n```typescript\nimport type { UserConfig } from '@commitlint/types'\nimport commitizenConfig from './.cz-config.js'\n\nconst Configuration: UserConfig = {\n  extends: ['@commitlint/config-conventional'],\n  rules: {\n    'type-enum': [2, 'always', commitizenConfig.types.map(({ value }) =\u003e value)],\n    'type-case': [2, 'always', 'lower-case'],\n    'scope-empty': [2, 'never'],\n  },\n}\n\nmodule.exports = Configuration\n\n```\n\n# 더 알아보면 좋을 것들\n## GitHub Actions + [🔗semantic-release](https://semantic-release.gitbook.io/semantic-release/) + CI\n- 원하는 브랜치에 푸시받은 경우 github-actions에서 semantic-release가 실행\n- semantic-release가 semantic-versioning에 따라 major/minor/patch중 어떤 버전을 올려야 할지 commit 메시지(conventional-commit의 형식)를 보고 자동으로 태그를 푸시해줍니다.\n- 이 버전 태그를 보고 CI - CD를 진행하게 합니다.\n\n## Semantic Release 예시 레포\n- 🔗[manudeli/semantic-release-test](https://github.com/manudeli/semantic-release-test/releases)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanudeli%2Fhusky-commitlint-commitizen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmanudeli%2Fhusky-commitlint-commitizen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanudeli%2Fhusky-commitlint-commitizen/lists"}