|
7 | 7 | - [Installation](#installation) |
8 | 8 | - [Running the Project](#running-the-project) |
9 | 9 | - [Testing](#testing) |
| 10 | +- [Development Workflow](#development-workflow) |
10 | 11 | - [TypeScript Configuration](#typescript-configuration) |
11 | 12 | - [Platform-Specific Notes](#platform-specific-notes) |
12 | 13 | - [Deployment](#deployment) |
@@ -66,6 +67,14 @@ This project uses the following key dependencies: |
66 | 67 |
|
67 | 68 | ## Installation |
68 | 69 |
|
| 70 | +### Install Root Dependencies |
| 71 | + |
| 72 | +First, install root dependencies (required for Husky pre-commit hooks): |
| 73 | + |
| 74 | +```bash |
| 75 | +npm install |
| 76 | +``` |
| 77 | + |
69 | 78 | ### Install Dependencies for Each Package |
70 | 79 |
|
71 | 80 | #### 1. Smart Contracts (trust-anchor-did-ethr) |
@@ -187,6 +196,45 @@ cd packages/demo-app-frontend |
187 | 196 | npm run lint |
188 | 197 | ``` |
189 | 198 |
|
| 199 | +## Development Workflow |
| 200 | + |
| 201 | +### Pre-commit Hooks |
| 202 | + |
| 203 | +This project uses [Husky](https://typicode.github.io/husky/) and [lint-staged](https://github.com/okonet/lint-staged) to automatically lint your code before commits: |
| 204 | + |
| 205 | +**What happens when you commit:** |
| 206 | +1. You stage files: `git add src/components/MyComponent.tsx` |
| 207 | +2. You commit: `git commit -m "fix: update component"` |
| 208 | +3. Pre-commit hook runs automatically: |
| 209 | + - ESLint checks code quality and fixes issues |
| 210 | + - Prettier formats code (indentation, spacing, etc.) |
| 211 | + - Both tools auto-fix and re-stage files |
| 212 | + - Unfixable errors block the commit |
| 213 | +4. If successful, commit proceeds with clean, formatted code |
| 214 | + |
| 215 | +**Manual formatting:** |
| 216 | +```bash |
| 217 | +npm run format # Format all files with Prettier |
| 218 | +npm run lint # Check code quality with ESLint |
| 219 | +``` |
| 220 | + |
| 221 | +**Configuration:** |
| 222 | +- Hook script: `.husky/pre-commit` |
| 223 | +- Prettier rules: `packages/demo-app-frontend/.prettierrc` |
| 224 | +- ESLint rules: `packages/demo-app-frontend/eslint.config.js` |
| 225 | +- Staged file rules: `packages/demo-app-frontend/package.json` → `lint-staged` section |
| 226 | + |
| 227 | +### Continuous Integration (GitHub Actions) |
| 228 | + |
| 229 | +Pull requests and pushes to `main` trigger automated checks (`.github/workflows/ci.yml`): |
| 230 | + |
| 231 | +**CI Jobs:** |
| 232 | +1. **Frontend Linting**: Runs ESLint on entire frontend codebase |
| 233 | +2. **Frontend Formatting**: Checks Prettier formatting compliance |
| 234 | +3. **Contract Validation**: Compiles smart contracts and runs full test suite |
| 235 | + |
| 236 | +**All checks must pass before merging.** The CI uses Node.js 22.12.0 to match local development. |
| 237 | + |
190 | 238 | ## TypeScript Configuration |
191 | 239 |
|
192 | 240 | ### Smart Contracts (trust-anchor-did-ethr) |
|
0 commit comments