Skip to content

Commit 3a288e0

Browse files
committed
feat(git): configure Git hooks and enhance project setup
1 parent 0e4186f commit 3a288e0

File tree

8 files changed

+194
-48
lines changed

8 files changed

+194
-48
lines changed

.gitconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[core]
2+
hooksPath = .husky
3+
ignorecase = false
4+
5+
[hooks]
6+
enforceForAll = true
7+
8+
[receive]
9+
denyNonFastForwards = true

.github/workflows/branch-check.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Branch Name Check
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- main
7+
- develop
8+
pull_request:
9+
branches:
10+
- main
11+
- develop
12+
13+
jobs:
14+
check-branch-name:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Check branch name
18+
run: |
19+
BRANCH=${GITHUB_REF#refs/heads/}
20+
if [[ ! $BRANCH =~ ^[a-zA-Z0-9]+/[a-zA-Z0-9-]+$ ]]; then
21+
echo "🚫 Branch name validation failed"
22+
echo "Branch: $BRANCH"
23+
echo "Required format: username/feature-name"
24+
echo "Examples:"
25+
echo "✅ john/add-footer"
26+
echo "✅ jane/fix-auth"
27+
echo "❌ main"
28+
echo "❌ feature-branch"
29+
echo "❌ fix_bug"
30+
exit 1
31+
fi
32+
echo "✅ Branch name follows convention: $BRANCH"
33+
34+
validate-commit:
35+
runs-on: ubuntu-latest
36+
steps:
37+
- uses: actions/checkout@v4
38+
with:
39+
fetch-depth: 0
40+
41+
- name: Check commit message
42+
run: |
43+
git log -1 --pretty=format:"%s" | npx --no -- commitlint
44+
if [ $? -ne 0 ]; then
45+
echo "🚫 Commit message must follow conventional commits"
46+
echo "Examples:"
47+
echo "✅ feat: add new button component"
48+
echo "✅ fix: resolve auth redirect issue"
49+
echo "✅ docs: update README"
50+
exit 1
51+
fi

.husky/pre-receive

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/sh
2+
3+
# Enforce branch naming
4+
while read oldrev newrev refname; do
5+
branch=$(echo "$refname" | sed -n 's|refs/heads/||p')
6+
if [[ ! $branch =~ ^[a-zA-Z0-9]+/[a-zA-Z0-9-]+$ ]]; then
7+
echo "🚫 ERROR: Branch '$branch' does not follow naming convention"
8+
echo "✅ Required format: username/feature-name"
9+
exit 1
10+
fi
11+
done
12+
13+
# Block force pushes
14+
if git rev-list $newrev..$oldrev >/dev/null 2>&1; then
15+
echo "🚫 Force pushes are not allowed"
16+
exit 1
17+
fi

README.md

Lines changed: 42 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ npm install
1818
3. **Run development server**
1919
```bash
2020
npm run dev
21+
# or with Docker
22+
docker compose up --build
2123
```
2224

2325
Open [http://localhost:3000](http://localhost:3000) to view the project.
@@ -27,43 +29,67 @@ Open [http://localhost:3000](http://localhost:3000) to view the project.
2729
### Prerequisites
2830
- Node.js (v18 or higher)
2931
- npm (v9 or higher)
32+
- Docker (optional)
3033

3134
### Environment Setup
3235
1. Copy the environment template:
3336
```bash
34-
cp .env.example .env.local
37+
cp .env.example .env.production
3538
```
3639

3740
2. Install husky hooks:
3841
```bash
3942
npm run prepare
43+
git config core.hooksPath .husky
44+
```
45+
46+
## 🐳 Docker
47+
48+
### Build and Run
49+
```bash
50+
docker compose up --build
51+
```
52+
53+
### Environment Variables
54+
Required in `.env.production`:
55+
```env
56+
GOOGLE_CLIENT_ID=your_client_id
57+
GOOGLE_CLIENT_SECRET=your_client_secret
58+
NEXTAUTH_URL=http://localhost:3000
59+
NEXTAUTH_SECRET=your_secret
60+
POSTHOG_KEY=your_key
61+
POSTHOG_HOST=your_host
4062
```
4163

4264
## 📝 Contributing
4365

66+
### Strict Git Enforcement
67+
All commits and branches are strictly enforced through:
68+
- Local git hooks (husky)
69+
- Server-side hooks
70+
- GitHub Actions
71+
- GUI client configurations
72+
4473
### Branch Naming Convention
4574
All branches must follow the pattern:
4675
```
4776
username/feature-name
4877
```
4978
Example: `john/add-ai-page`
5079

51-
### Pre-commit Checks
52-
Before committing, ensure:
53-
1. Code is linted and formatted:
54-
```bash
55-
npm run lint
56-
```
57-
58-
2. TypeScript types are valid:
59-
```bash
60-
npm run type-check
61-
```
80+
Enforcement:
81+
- Pre-receive hooks
82+
- GitHub Actions
83+
- Local git hooks
84+
- No force pushes allowed
6285

63-
3. Build succeeds:
64-
```bash
65-
npm run build
66-
```
86+
### Pre-commit Checks
87+
Before committing, the following are automatically enforced:
88+
1. Code linting and formatting
89+
2. TypeScript type checking
90+
3. Successful build
91+
4. Branch name validation
92+
5. Commit message format
6793

6894
### Commit Message Format
6995
Follow the conventional commits specification:

app/layout.tsx

Lines changed: 44 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { Montserrat } from 'next/font/google';
55
import { PostHogProvider } from '@/components/providers/PostHogProvider'
66
import { PostHogPageview } from '@/components/PostHogPageview'
77
import { NextAuthProvider } from '@/components/providers/NextAuthProvider'
8+
import { websiteSchema, organizationSchema } from './schema'
89

910
const geistSans = localFont({
1011
src: "./fonts/GeistVF.woff",
@@ -25,46 +26,45 @@ const montserrat = Montserrat({
2526
export const metadata: Metadata = {
2627
metadataBase: new URL('https://coc-landing.vercel.app'),
2728
title: {
28-
default: "VJTI Resources & Communities",
29-
template: "%s | VJTI Resources"
30-
},
31-
description: "Access curated educational resources, join tech communities, and connect with VJTI's developer ecosystem. Features AI, Web Dev, CP, and academic materials.",
32-
keywords: ["VJTI", "education", "resources", "developer communities", "engineering", "tech clubs", "Mumbai","AI","Web Dev","CP","academic materials","coc","coding"],
33-
authors: [{ name: "VJTI Resources Team" }],
34-
openGraph: {
35-
type: "website",
36-
locale: "en_IN",
37-
url: "https://coc-landing.vercel.app",
38-
siteName: "VJTI Resources",
39-
images: [{
40-
url: "/coc_vjti.jpeg",
41-
width: 1200,
42-
height: 630,
43-
alt: "VJTI Resources & Communities Logo"
44-
}],
45-
},
46-
twitter: {
47-
card: "summary_large_image",
48-
site: "@vjti_resources",
49-
images: "/coc_vjti.jpeg",
50-
},
51-
icons: {
52-
icon: "/coc_vjti.jpeg",
29+
default: "Community of Coders VJTI | COC Landing",
30+
template: "%s | Community of Coders VJTI"
5331
},
32+
description: "Access curated educational resources, join tech communities, and explore learning paths for Web Development, AI/ML, Competitive Programming at VJTI.",
33+
keywords: ["VJTI", "COC", "tech communities", "educational resources", "web development", "AI/ML", "competitive programming", "student clubs"],
34+
authors: [{ name: "Community of Coders" }],
35+
creator: "Community of Coders VJTI",
36+
publisher: "VJTI",
5437
robots: {
5538
index: true,
5639
follow: true,
5740
googleBot: {
5841
index: true,
5942
follow: true,
60-
"max-video-preview": -1,
61-
"max-image-preview": "large",
62-
"max-snippet": -1,
43+
'max-video-preview': -1,
44+
'max-image-preview': 'large',
45+
'max-snippet': -1,
6346
},
6447
},
65-
verification: {
66-
google: "your-google-verification-code",
48+
openGraph: {
49+
type: 'website',
50+
locale: 'en_US',
51+
url: 'https://coc-landing.vercel.app',
52+
title: 'Community of Coders VJTI',
53+
description: 'Access curated educational resources and join tech communities at VJTI.',
54+
siteName: 'Community of Coders VJTI',
55+
},
56+
twitter: {
57+
card: 'summary_large_image',
58+
title: 'Community of Coders VJTI',
59+
description: 'Access curated educational resources and join tech communities at VJTI.',
60+
creator: '@COC_VJTI',
6761
},
62+
alternates: {
63+
canonical: 'https://coc-landing.vercel.app',
64+
},
65+
verification: {
66+
google: 'your-google-verification-code',
67+
}
6868
};
6969

7070
export default function RootLayout({
@@ -74,6 +74,20 @@ export default function RootLayout({
7474
}>) {
7575
return (
7676
<html lang="en">
77+
<head>
78+
<script
79+
type="application/ld+json"
80+
dangerouslySetInnerHTML={{
81+
__html: JSON.stringify(websiteSchema)
82+
}}
83+
/>
84+
<script
85+
type="application/ld+json"
86+
dangerouslySetInnerHTML={{
87+
__html: JSON.stringify(organizationSchema)
88+
}}
89+
/>
90+
</head>
7791
<body
7892
className={`${geistSans.variable} ${geistMono.variable} ${montserrat.variable} antialiased`}
7993
>

app/schema.tsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
export const websiteSchema = {
2+
"@context": "https://schema.org",
3+
"@type": "WebSite",
4+
"name": "Community of Coders VJTI",
5+
"url": "https://coc-landing.vercel.app",
6+
"potentialAction": {
7+
"@type": "SearchAction",
8+
"target": "https://coc-landing.vercel.app/search?q={search_term_string}",
9+
"query-input": "required name=search_term_string"
10+
}
11+
};
12+
13+
export const organizationSchema = {
14+
"@context": "https://schema.org",
15+
"@type": "Organization",
16+
"name": "Community of Coders VJTI",
17+
"url": "https://coc-landing.vercel.app",
18+
"logo": "https://coc-landing.vercel.app/logo.png",
19+
"sameAs": [
20+
"https://www.linkedin.com/company/community-of-coders-vjti",
21+
"https://github.com/Community-Of-Coders"
22+
]
23+
};

app/sitemap.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { domains } from '@/config/navigation'
44
export default function sitemap(): MetadataRoute.Sitemap {
55
const baseUrl = 'https://coc-landing.vercel.app'
66

7-
// Base routes
87
const routes = [
98
'',
109
'/about',

package.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
"test": "echo 'No tests yet'",
1515
"type-check": "tsc --noEmit",
1616
"lint-staged": "lint-staged",
17-
"prepare": "husky",
17+
"prepare": "husky install && git config core.hooksPath .husky",
18+
"postinstall": "git config core.hooksPath .husky",
1819
"pre-commit": "npm run lint && npm run type-check && npm run build"
1920
},
2021
"dependencies": {
@@ -65,5 +66,11 @@
6566
"prettier": "^3.4.2",
6667
"tailwindcss": "^3.4.1",
6768
"typescript": "^5"
69+
},
70+
"lint-staged": {
71+
"*.{js,jsx,ts,tsx}": [
72+
"eslint --fix",
73+
"prettier --write"
74+
]
6875
}
6976
}

0 commit comments

Comments
 (0)