Skip to content

Commit 5dc4ec1

Browse files
authored
Merge pull request #64 from bartstc/chore/add-madge
chore: introduce madge
2 parents f8a6d9a + 0198307 commit 5dc4ec1

14 files changed

Lines changed: 1121 additions & 47 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ FROM mcr.microsoft.com/devcontainers/typescript-node:dev-22
22

33
RUN corepack enable
44

5-
# Install GitHub CLI
5+
# Install GitHub CLI and graphviz (graphviz is required by `pnpm madge:graph` to render the dependency graph image)
66
RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
77
&& chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
88
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
99
&& apt update \
10-
&& apt install -y gh
10+
&& apt install -y gh graphviz
1111

1212
# Setup Claude Code
1313

.github/workflows/ci.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ jobs:
2626
test-type: typecheck
2727
test-command: pnpm typecheck
2828

29+
madge-circular:
30+
uses: ./.github/workflows/run-tests.yml
31+
with:
32+
test-type: madge-circular
33+
test-command: pnpm madge:circular
34+
2935
playwright-tests:
3036
uses: ./.github/workflows/playwright.yml
3137
with:
@@ -159,7 +165,14 @@ jobs:
159165

160166
build:
161167
needs:
162-
[lint-tests, typecheck, unit-tests, storybook-tests, playwright-tests]
168+
[
169+
lint-tests,
170+
typecheck,
171+
madge-circular,
172+
unit-tests,
173+
storybook-tests,
174+
playwright-tests,
175+
]
163176
runs-on: ubuntu-latest
164177
steps:
165178
- name: Checkout

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ dist-ssr
1414
storybook-static
1515
coverage
1616
storybook-report.json
17+
graph.png
1718

1819
# Editor directories and files
1920
.idea

README.md

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ An opinionated, production-ready starter for **Single Page Application** develop
99
- [Vite](https://vitejs.dev/) — fast dev server and build tooling
1010
- [TypeScript](https://www.typescriptlang.org/) — strict type safety
1111
- [ESLint](https://eslint.org/) (with custom rules) + [Prettier](https://prettier.io/) + [Husky](https://typicode.github.io/husky/) — consistent code style
12+
- [madge](https://github.com/pahen/madge) — circular dependency check + module graph visualization
1213
- [PNPM](https://pnpm.io/) — fast, disk-efficient package manager
1314
- [Devcontainer](https://code.visualstudio.com/docs/devcontainers/containers) — reproducible VS Code dev environment
1415
- [GitHub Actions](https://docs.github.com/en/actions) CI — tests, build, coverage reports, deploy draft
@@ -42,6 +43,7 @@ e2e/ Playwright end-to-end tests
4243

4344
- Feature slice architecture with clean architecture principles — each feature has four layers (`components/`, `application/`, `providers/`, `models/`) with strict dependency rules
4445
- Strict ESLint guardrails enforce the feature-slice layer boundaries. See [`eslint.config.mjs`](eslint.config.mjs).
46+
- Circular dependency check and dependency graph visualization via `madge` (`pnpm madge:circular` / `pnpm madge:graph`)
4547
- Centralized API layer with endpoint-based organization and type consolidation
4648
- Spec-driven development for AI-assisted workflows — four-phase gated spec process, typed building block patterns, and a self-improvement loop
4749
- Formatting utilities for numbers, monetary values, and dates
@@ -75,24 +77,26 @@ It's recommended to run the dev server inside a container for consistent Node/PN
7577

7678
## Commands
7779

78-
| Command | Description |
79-
| ---------------------- | ------------------------------------------ |
80-
| `pnpm dev` | Dev server with HMR on port `5173` |
81-
| `pnpm dev:server` | Local API server only on port `3001` |
82-
| `pnpm dev:all` | Frontend + API server together |
83-
| `pnpm typecheck` | Type-check all sources without emitting |
84-
| `pnpm lint` | Check for lint errors |
85-
| `pnpm build` | Production build |
86-
| `pnpm test` | Run all tests (unit + storybook) |
87-
| `pnpm test:unit` | Unit tests only |
88-
| `pnpm test:storybook` | Storybook component tests only |
89-
| `pnpm test:coverage` | Tests with coverage report |
90-
| `pnpm test:e2e` | E2E tests (headless) |
91-
| `pnpm test:e2e:ui` | E2E in interactive web UI mode |
92-
| `pnpm test:e2e:headed` | E2E with visible browser |
93-
| `pnpm test:e2e:debug` | E2E in debug mode |
94-
| `pnpm test:e2e:report` | Open the HTML report from the last E2E run |
95-
| `pnpm storybook` | Storybook on port `6006` |
80+
| Command | Description |
81+
| ---------------------- | ------------------------------------------------------------------- |
82+
| `pnpm dev` | Dev server with HMR on port `5173` |
83+
| `pnpm dev:server` | Local API server only on port `3001` |
84+
| `pnpm dev:all` | Frontend + API server together |
85+
| `pnpm typecheck` | Type-check all sources without emitting |
86+
| `pnpm lint` | Check for lint errors |
87+
| `pnpm madge:circular` | Check for circular module dependencies |
88+
| `pnpm madge:graph` | Generate dependency graph image (`graph.png`) — requires `graphviz` |
89+
| `pnpm build` | Production build |
90+
| `pnpm test` | Run all tests (unit + storybook) |
91+
| `pnpm test:unit` | Unit tests only |
92+
| `pnpm test:storybook` | Storybook component tests only |
93+
| `pnpm test:coverage` | Tests with coverage report |
94+
| `pnpm test:e2e` | E2E tests (headless) |
95+
| `pnpm test:e2e:ui` | E2E in interactive web UI mode |
96+
| `pnpm test:e2e:headed` | E2E with visible browser |
97+
| `pnpm test:e2e:debug` | E2E in debug mode |
98+
| `pnpm test:e2e:report` | Open the HTML report from the last E2E run |
99+
| `pnpm storybook` | Storybook on port `6006` |
96100

97101
## Testing strategy
98102

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
"preview": "vite preview",
2424
"typecheck": "tsc --noEmit",
2525
"lint": "eslint . --ignore-pattern '*.d.ts' --report-unused-disable-directives --max-warnings 0",
26+
"madge:circular": "madge --circular --extensions ts,tsx --ts-config tsconfig.json src/main.tsx",
27+
"madge:graph": "madge --image graph.png --extensions ts,tsx --ts-config tsconfig.json src/main.tsx",
2628
"prepare": "husky install",
2729
"storybook": "storybook dev -p 6006",
2830
"dev:server": "pnpm --filter server dev",
@@ -89,6 +91,7 @@
8991
"eslint-plugin-vitest": "0.5.4",
9092
"husky": "8.0.3",
9193
"jsdom": "21.1.2",
94+
"madge": "8.0.0",
9295
"msw": "2.12.7",
9396
"msw-storybook-addon": "2.0.7",
9497
"playwright": "1.57.0",

0 commit comments

Comments
 (0)