Skip to content

Commit 7abf718

Browse files
committed
feat: replace pre-commit with husky
1 parent 328ea20 commit 7abf718

6 files changed

Lines changed: 672 additions & 32 deletions

File tree

.husky/commit-msg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pnpm exec commitlint --edit "$1"

.husky/pre-commit

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pnpm astro check
2+
pnpm exec lint-staged

.pre-commit-config.yaml

Lines changed: 0 additions & 29 deletions
This file was deleted.

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,11 @@ Website for the most important Python [event](https://2026.es.pycon.org/) in Spa
66

77
- Node.js v22.0.0 (see `.nvmrc`)
88
- pnpm
9-
- [pre-commit](https://pre-commit.com/)
109

1110
## Installation
1211

1312
```bash
1413
pnpm install
15-
pre-commit install
1614
```
1715

1816
## Development
@@ -38,35 +36,43 @@ pnpm preview
3836
To maintain good SEO and consistency as the project grows, follow these guidelines when adding new pages:
3937

4038
### 1. Creating Multi-language Pages
39+
4140
New pages should be created in `src/pages/[lang]/` using `getStaticPaths`.
41+
4242
- Ensure you use the `<Layout>` component.
4343
- Always provide a unique `title` and `description` to the Layout.
4444

4545
Example:
46+
4647
```astro
4748
---
4849
import Layout from '../../layouts/Layout.astro'
4950
// ...
5051
---
52+
5153
<Layout title="Your Page Title" description="Concise description (150-160 chars)">
5254
<!-- Content -->
5355
</Layout>
5456
```
5557

5658
### 2. SEO Best Practices
59+
5760
- **Semantic HTML**: Use only one `<h1>` per page. Follow a logical heading hierarchy (`<h2>`, `<h3>`).
5861
- **Image Alt Tags**: All `<img>` tags MUST have descriptive `alt` attributes.
5962
- **Internal Linking**: Use descriptive link text (avoid "click here").
6063

6164
### 3. Analytics
65+
6266
- Set the `PUBLIC_GA_ID` environment variable in your `.env` file to enable Google Analytics.
6367
```text
6468
PUBLIC_GA_ID=G-XXXXXXXXXX
6569
```
6670

6771
### 4. Structured Data
72+
6873
- The main event structured data (JSON-LD) is globally included in `Layout.astro`.
6974
- For specific pages (like "Sponsors" or "Talks"), consider adding additional [schema.org](https://schema.org) types locally if necessary.
7075

7176
### 5. Sitemap
77+
7278
- The sitemap is automatically generated on every build. No manual action is required.

package.json

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"dev": "astro dev",
99
"build": "astro build",
1010
"preview": "astro preview",
11-
"format": "prettier --write src"
11+
"format": "prettier --write src",
12+
"prepare": "husky"
1213
},
1314
"keywords": [],
1415
"author": "",
@@ -26,6 +27,10 @@
2627
},
2728
"devDependencies": {
2829
"@astrojs/check": "^0.9.6",
30+
"@commitlint/cli": "^20.5.0",
31+
"@commitlint/config-conventional": "^20.5.0",
32+
"husky": "^9.1.7",
33+
"lint-staged": "^16.4.0",
2934
"prettier": "^3.7.4",
3035
"prettier-plugin-astro": "^0.14.1",
3136
"typescript": "^5.9.3"
@@ -47,5 +52,13 @@
4752
}
4853
}
4954
]
55+
},
56+
"lint-staged": {
57+
"*.{ts,tsx,js,jsx,json,css,md,astro}": "prettier --check"
58+
},
59+
"commitlint": {
60+
"extends": [
61+
"@commitlint/config-conventional"
62+
]
5063
}
5164
}

0 commit comments

Comments
 (0)