Skip to content

Commit 9023277

Browse files
committed
chore: 🔧 add commitlint, devmoji
1 parent 3ec6393 commit 9023277

6 files changed

Lines changed: 857 additions & 149 deletions

File tree

.husky/commit-msg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pnpm dlx commitlint --edit $1
2+
pnpm dlx devmoji --edit $1 --config devmoji.config.cjs

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
lint-staged

commitlint.config.cjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
const config = {
2+
extends: ["@commitlint/config-conventional"],
3+
};
4+
5+
module.exports = config;

devmoji.config.cjs

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
// @ts-check
2+
3+
/**
4+
* @type {import('devmoji/lib/config-options').TDevmoji[]}
5+
*/
6+
const devmoji = [
7+
{
8+
code: "feat",
9+
description: "a new feature",
10+
emoji: "sparkles",
11+
},
12+
{
13+
code: "fix",
14+
description: "a bug fix",
15+
emoji: "bug",
16+
},
17+
{
18+
code: "docs",
19+
description: "documentation only changes",
20+
emoji: "books",
21+
},
22+
{
23+
code: "style",
24+
description:
25+
"changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)",
26+
emoji: "art",
27+
},
28+
{
29+
code: "refactor",
30+
description: "a code change that neither fixes a bug nor adds a feature",
31+
emoji: "recycle",
32+
},
33+
{
34+
code: "perf",
35+
description: "a code change that improves performance",
36+
emoji: "zap",
37+
},
38+
{
39+
code: "test",
40+
description: "adding missing or correcting existing tests",
41+
emoji: "rotating_light",
42+
},
43+
{
44+
code: "chore",
45+
description:
46+
"changes to the build process or auxiliary tools and libraries such as documentation generation",
47+
emoji: "wrench",
48+
},
49+
{
50+
code: "chore-release",
51+
description: "code deployment or publishing to external repositories",
52+
emoji: "rocket",
53+
},
54+
{
55+
code: "chore-deps",
56+
description: "add or delete dependencies",
57+
emoji: "link",
58+
},
59+
{
60+
code: "build",
61+
description: "changes related to build processes",
62+
emoji: "package",
63+
},
64+
{
65+
code: "ci",
66+
description: "updates to the continuous integration system",
67+
emoji: "construction_worker",
68+
},
69+
{
70+
code: "release",
71+
description: "code deployment or publishing to external repositories",
72+
emoji: "rocket",
73+
},
74+
75+
{
76+
code: "security",
77+
gitmoji: "lock",
78+
},
79+
{
80+
code: "i18n",
81+
gitmoji: "globe_with_meridians",
82+
},
83+
{
84+
code: "breaking",
85+
gitmoji: "boom",
86+
},
87+
{
88+
code: "config",
89+
gitmoji: "wrench",
90+
emoji: "gear",
91+
},
92+
{
93+
code: "add",
94+
emoji: "heavy_plus_sign",
95+
description: "add something",
96+
},
97+
{
98+
code: "remove",
99+
emoji: "heavy_minus_sign",
100+
description: "remove something",
101+
},
102+
{
103+
code: "revert",
104+
emoji: "rewind",
105+
description: "revert changes",
106+
},
107+
];
108+
109+
/**
110+
* Based on the default configuration from devmoji.
111+
*
112+
* @see https://github.com/folke/devmoji/blob/master/src/config-options-defaults.ts
113+
*
114+
* @type {import('devmoji/lib/config-options').ConfigOptions}
115+
*/
116+
const config = {
117+
types: devmoji.map((devmoji) => devmoji.code),
118+
devmoji,
119+
};
120+
121+
module.exports = config;

package.json

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"cf-typegen": "wrangler types --env-interface CloudflareEnv cloudflare-env.d.ts",
1212
"start": "next start",
1313
"lint": "eslint .",
14-
"start:prod": "next start -p 3001"
14+
"start:prod": "next start -p 3001",
15+
"prepare": "husky"
1516
},
1617
"dependencies": {
1718
"@mdx-js/loader": "^3.1.0",
@@ -45,16 +46,20 @@
4546
"devDependencies": {
4647
"@biomejs/biome": "2.0.6",
4748
"@catppuccin/tailwindcss": "^1.0.0",
49+
"@commitlint/cli": "^20.4.1",
50+
"@commitlint/config-conventional": "^20.4.1",
4851
"@opennextjs/aws": "^3.9.7",
4952
"@opennextjs/cloudflare": "^1.14.8",
5053
"@tailwindcss/postcss": "^4",
5154
"@types/node": "^20",
5255
"@types/react": "19.2.7",
5356
"@types/react-dom": "19.2.3",
57+
"devmoji": "^2.3.0",
5458
"esbuild": "^0.27.2",
5559
"eslint": "^9.39.2",
5660
"eslint-config-next": "15.1.11",
57-
"lefthook": "^1.12.2",
61+
"husky": "^9.1.7",
62+
"lint-staged": "^16.2.7",
5863
"open-next": "^3.1.3",
5964
"tailwindcss": "^4",
6065
"tw-animate-css": "^1.3.4",
@@ -67,5 +72,10 @@
6772
"@types/react": "19.2.7",
6873
"@types/react-dom": "19.2.3"
6974
}
75+
},
76+
"lint-staged": {
77+
"*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}": [
78+
"biome check --write --no-errors-on-unmatched"
79+
]
7080
}
71-
}
81+
}

0 commit comments

Comments
 (0)