Skip to content

Commit

Permalink
husky (#18)
Browse files Browse the repository at this point in the history
* ci: lint-staged pre-commit hook 추가

* chore: test-ci 명령어 추가

* ci: pre-commit 훅 추가

* ci: pre-push 훅 추가

* 🚚 chore(package): commitizem, cz-customizable 설치 및 설정

* 👷 ci(config): commitizen 설정 수정

* 👷 ci(workflow): pre-commit 삭제 및 yarn commit에 lint-staged 추가
  • Loading branch information
bh2980 authored May 20, 2024
1 parent c66b410 commit 65bdcb3
Show file tree
Hide file tree
Showing 4 changed files with 784 additions and 49 deletions.
1 change: 1 addition & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
yarn test-ci
117 changes: 117 additions & 0 deletions cz-config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
module.exports = {
types: [
{ value: "✨ feat", name: "✨ feat | 서비스 기능 추가" },
{ value: "🐛 fix", name: "🐛 fix | 버그 수정" },
{
value: "🚚 chore",
name: "🚚 chore | 패키지 관리 등 잡무",
},
{
value: "💄 style",
name: "💄 style | 코드에 영향이 없는 수정",
},
{ value: "♻️ refactor", name: "♻️ refactor | 코드의 구조 혹은 설계 변경" },
{
value: "✅ test",
name: "✅ test | 테스트 케이스 관련 코드 수정",
},
{
value: "👷 ci",
name: "👷 ci | 커밋부터 통합까지 CI 과정의 코드 수정",
},
{ value: "📝 docs", name: "📝 docs | 문서 수정" },
{
value: "⚡ pref",
name: "⚡ pref | 성능 개선 코드",
},
],
allowCustomScopes: false,
scopes: [
{
value: "component",
name: "component : 컴포넌트 관련",
},
{
value: "css",
name: "css : css 관련",
},
{
value: "hook",
name: "hook : hook 관련",
},
{
value: "store",
name: "store : store 관련",
},
{
value: "util",
name: "util : util 관련",
},
{
value: "api",
name: "api : api 관련",
},
{
value: "type",
name: "type : type 관련",
},
{
value: "story",
name: "story : storybook 관련",
},
{
value: "asset",
name: "asset : 에셋 관련",
},
{
value: "constant",
name: "constant : 상수 관련",
},
{
value: "package",
name: "package : 패키지 관련",
},
{
value: "formatting",
name: "formatting : 포맷팅 관련",
},
{
value: "wrong codes",
name: "wrong codes : 잘못된 코드 관련",
},
{
value: "spaghetti codes",
name: "spaghetti codes : 스파게티 코드 관련",
},
{
value: "alien codes",
name: "alien codes : 이상한 코드 관련",
},
{
value: "config",
name: "config : 설정 관련",
},
{
value: "README",
name: "README : README 관련",
},
{
value: "workflow",
name: "workflow : 작업 흐름 관련",
},
],
messages: {
type: "변경할 내용의 유형을 선택하세요:",
scope: "\n이 변경의 범위(SCOPE)를 명시하세요 (선택 사항):",
// allowCustomScopes가 true인 경우 사용
customScope: "이 변경의 범위(SCOPE)를 명시하세요:",
subject: "변경 내용에 대해 짧고 명령형으로 작성하세요:\n",
body: '변경 내용에 대한 더 긴 설명을 작성하세요 (선택 사항). "|"를 사용하여 줄 바꿈하세요:\n',
breaking: "어떤 중대한 변경사항(BREAKING CHANGES)이 있는지 나열하세요 (선택 사항):\n",
footer: "이 변경사항으로 해결된 이슈가 있다면 나열하세요 (선택 사항). 예: #31, #34:\n",
confirmCommit: "위의 커밋을 진행하시겠습니까?",
},
allowBreakingChanges: ["feat", "fix"],
skipQuestions: ["body"],
subjectLimit: 100,
};
23 changes: 22 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,27 @@
"build": "tsc --project tsconfig.build.json && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"test": "vitest",
"test-ci": "vitest run",
"preview": "vite preview",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build",
"plop": "plop"
"plop": "plop",
"prepare": "husky",
"commit": "lint-staged && cz"
},
"lint-staged": {
"**/*.{js,jsx,ts,tsx}": [
"eslint --fix",
"prettier --write"
]
},
"config": {
"commitizen": {
"path": "cz-customizable"
},
"cz-customizable": {
"config": "./cz-config.cjs"
}
},
"dependencies": {
"d3": "^7.9.0",
Expand Down Expand Up @@ -59,6 +76,8 @@
"@vitejs/plugin-react": "^4.2.1",
"@vitest/ui": "^1.6.0",
"autoprefixer": "^10.4.19",
"commitizen": "^4.3.0",
"cz-customizable": "^7.0.0",
"eslint": "^8.47.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-jest-dom": "^5.4.0",
Expand All @@ -68,7 +87,9 @@
"eslint-plugin-storybook": "^0.8.0",
"eslint-plugin-testing-library": "^6.2.2",
"eslint-plugin-vitest": "^0.5.4",
"husky": "^9.0.11",
"jsdom": "^24.0.0",
"lint-staged": "^15.2.2",
"plop": "^4.0.1",
"postcss": "^8.4.38",
"prettier": "^3.2.5",
Expand Down
Loading

0 comments on commit 65bdcb3

Please sign in to comment.