Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .commitlintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
export default {
extends: ['@commitlint/config-conventional'], // Nom du module sous forme de chaîne
rules: {
// Types autorisés
'type-enum': [
2, // Niveau d'erreur (2 = erreur bloquante)
'always',
['feat', 'fix', 'chore', 'docs', 'style', 'refactor', 'test', 'build', 'ci', 'revert'],
],

// Le type ne doit jamais être vide
'type-empty': [2, 'never'],

// Le sujet (message après le type) ne doit jamais être vide
'subject-empty': [2, 'never'],

// Longueur maximale du message
'header-max-length': [2, 'always', 72],

// Enforce lowercase in subject
'subject-case': [2, 'always', 'lower-case'],

// Pas de point final dans le sujet
'subject-full-stop': [2, 'never', '.'],
},
};
17 changes: 17 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
# EditorConfig helps maintain consistent coding styles across editors and IDEs.
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
trim_trailing_whitespace = true

[*.md]
max_line_length = off
trim_trailing_whitespace = false

[*.{ts,tsx,js,jsx,json}]
indent_style = space
indent_size = 2

[*.yml]
indent_style = space
indent_size = 2
25 changes: 15 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: CI/CD

on:
push:
Expand Down Expand Up @@ -31,17 +31,20 @@ jobs:
node-version: '22'
cache: 'pnpm'

- name: Clear pnpm cache
run: pnpm store prune
- name: Clear pnpm cache if needed
run: |
if pnpm store status; then
pnpm store prune
fi

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Format code
run: pnpm prettier --write .
run: pnpm format

- name: Lint code
run: pnpm lint --fix
run: pnpm lint

- name: Run tests
run: pnpm test
Expand All @@ -61,19 +64,22 @@ jobs:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
issues: write
pull-requests: write
packages: write
steps:
- uses: actions/checkout@v3
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: pnpm/action-setup@v2
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 9.15.2

- uses: actions/setup-node@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '22'
registry-url: 'https://registry.npmjs.org'
Expand All @@ -85,5 +91,4 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: pnpm semantic-release
36 changes: 32 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,22 @@ node_modules/

# Build output
dist/
*.tsbuildinfo

# Logs
logs/
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Coverage reports
coverage/

# TypeScript
*.tsbuildinfo

# IDE files
.vscode/
.idea/
*.iml

# System files
.DS_Store
Expand All @@ -26,4 +28,30 @@ Thumbs.db
.env
.env.local
.env.*.local
structure*.txt

# Temporary files
*.tmp
*.temp

# pnpm cache
.pnpm-store/

# Specific project files
structure*.txt

# Test files and reports
.jest-cache/
.jest-test-results.json
vitest-cache/

# Dependency directories
.pnpm/

# Lock files
pnpm-lock.yaml

# Miscellaneous
*.bak
*.swp
*.swo
*.orig
2 changes: 2 additions & 0 deletions .husky/applypatch-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env sh
. "$(dirname "$0")/h"
43 changes: 43 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/sh

# Stop on error
set -e

# Debugging line to confirm hook execution
echo "📝 commit-msg hook executed for $1" >&2

# Validate commit message
echo "📝 Validating commit message..."

# Check if pnpm is installed
if ! command -v pnpm > /dev/null; then
echo "❌ pnpm is not installed. Please install it from https://pnpm.io/installation."
exit 1
fi

# Check if Commitlint is installed
if ! pnpm ls @commitlint/cli > /dev/null 2>&1; then
echo "❌ Commitlint is not installed. Please install it with 'pnpm add -D @commitlint/cli'."
exit 1
fi

# Check if the commit message file exists
if [ ! -f "$1" ]; then
echo "❌ Commit message file not found: $1"
exit 1
fi

# Run Commitlint
if ! pnpm commitlint --edit "$1"; then
echo "❌ Commit message validation failed. Please follow the commit conventions."
echo "🔗 See: https://www.conventionalcommits.org/"
echo "Examples of valid messages:"
echo " feat(core): add a new feature"
echo " fix(ui): resolve alignment issue"
echo " chore(deps): update dependencies"
exit 1
fi

# Show validated message
echo "📄 Commit message: $(cat "$1")"
echo "✅ Commit message validation passed."
22 changes: 22 additions & 0 deletions .husky/h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env sh
[ "$HUSKY" = "2" ] && set -x
n=$(basename "$0")
s=$(dirname "$(dirname "$0")")/$n

[ ! -f "$s" ] && exit 0

if [ -f "$HOME/.huskyrc" ]; then
echo "husky - '~/.huskyrc' is DEPRECATED, please move your code to ~/.config/husky/init.sh"
fi
i="${XDG_CONFIG_HOME:-$HOME/.config}/husky/init.sh"
[ -f "$i" ] && . "$i"

[ "${HUSKY-}" = "0" ] && exit 0

export PATH="node_modules/.bin:$PATH"
sh -e "$s" "$@"
c=$?

[ $c != 0 ] && echo "husky - $n script failed (code $c)"
[ $c = 127 ] && echo "husky - command not found in PATH=$PATH"
exit $c
2 changes: 0 additions & 2 deletions .husky/husky.sh

This file was deleted.

2 changes: 2 additions & 0 deletions .husky/post-applypatch
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env sh
. "$(dirname "$0")/h"
24 changes: 24 additions & 0 deletions .husky/post-checkout
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/sh

# Post-checkout tasks
echo "🔄 Running post-checkout tasks..."

# Install dependencies if needed
if [ -f pnpm-lock.yaml ]; then
echo "📦 Installing dependencies..."
pnpm install --frozen-lockfile
fi

# Clear build or cache directories if applicable
echo "🧹 Clearing cache (if any)..."
pnpm store prune || echo "⚠️ PNPM cache could not be pruned."

# Additional tasks, like setting up the environment
echo "🌍 Setting up environment variables..."
if [ -f .env ]; then
echo "✅ .env file found. Ready for development."
else
echo "⚠️ No .env file found. Please ensure your environment variables are configured."
fi

echo "✅ Post-checkout tasks completed successfully."
25 changes: 25 additions & 0 deletions .husky/post-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/sh

# Post-commit tasks
echo "🔄 Starting post-commit tasks..."

# Check for outdated dependencies
echo "📦 Checking for outdated dependencies..."
outdated=$(pnpm outdated --json || true)
if [ "$outdated" != "null" ] && [ -n "$outdated" ]; then
echo "⚠️ Some dependencies are outdated:"
pnpm outdated
else
echo "✅ All dependencies are up to date."
fi

# Validate commit message format
echo "📝 Validating commit message format..."
if ! pnpm commitlint --edit "$1"; then
echo "❌ Commit message validation failed. Please follow the commit convention."
echo "Example: feat(scope): add a new feature"
exit 1
fi

# Confirm successful post-commit
echo "✅ Post-commit tasks completed successfully."
11 changes: 11 additions & 0 deletions .husky/post-merge
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh

echo "🔄 Running post-merge tasks..."

# Install dependencies if lockfile exists
if [ -f pnpm-lock.yaml ]; then
echo "📦 Installing dependencies..."
pnpm install --frozen-lockfile
fi

echo "✅ Post-merge tasks completed."
3 changes: 3 additions & 0 deletions .husky/post-rewrite
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

echo "🔄 Post-rewrite detected. You might want to verify your branch state."
2 changes: 2 additions & 0 deletions .husky/pre-applypatch
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env sh
. "$(dirname "$0")/h"
2 changes: 2 additions & 0 deletions .husky/pre-auto-gc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env sh
. "$(dirname "$0")/h"
17 changes: 3 additions & 14 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

# Arrêt en cas d'erreur
# Stop script on error
set -e

# Format et lint
echo "🎨 Formatting..."
pnpm format || exit 1

echo "🔍 Linting..."
pnpm lint || exit 1

echo "🧪 Testing..."
pnpm test || exit 1

# Stage les fichiers modifiés
git add -A
# Run tests
npm test
2 changes: 2 additions & 0 deletions .husky/pre-merge-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env sh
. "$(dirname "$0")/h"
33 changes: 22 additions & 11 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,23 +1,34 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

# Arrêt en cas d'erreur
# Stop script on error
set -e

# Vérification de pnpm-lock.yaml
# Check pnpm-lock.yaml
echo "🔒 Checking pnpm-lock.yaml..."
if ! pnpm install --frozen-lockfile --prefer-offline > /dev/null 2>&1; then
echo "❌ Lockfile check failed. Please update pnpm-lock.yaml."
echo "❌ Lockfile check failed. Please ensure pnpm-lock.yaml is up to date."
exit 1
fi

# Lint complet
echo "🔍 Full linting..."
pnpm lint || exit 1
# Full linting
echo "🔍 Performing full linting..."
if ! pnpm lint; then
echo "❌ Linting failed. Please fix the issues before pushing."
exit 1
fi

# Tests avec couverture
# Run tests with coverage
echo "🧪 Running tests with coverage..."
pnpm test:coverage || exit 1
if ! pnpm test:coverage; then
echo "❌ Tests failed or coverage did not meet the required threshold."
exit 1
fi

# Ensure no uncommitted changes
echo "📂 Checking for uncommitted changes..."
if ! git diff --exit-code > /dev/null 2>&1; then
echo "❌ Uncommitted changes detected. Please commit your changes before pushing."
exit 1
fi

# Assurer que tout est stageé avant de pousser
git diff --exit-code || exit 1
echo "✅ All checks passed. Ready to push!"
Loading
Loading