create-koppajs 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/README.md +119 -122
- package/bin/create-koppajs.js +158 -13
- package/package.json +2 -1
- package/template-overlays/router/ARCHITECTURE.md +86 -0
- package/template-overlays/router/CHANGELOG.md +44 -0
- package/template-overlays/router/DEVELOPMENT_RULES.md +57 -0
- package/template-overlays/router/README.md +243 -0
- package/template-overlays/router/ROADMAP.md +34 -0
- package/template-overlays/router/TESTING_STRATEGY.md +67 -0
- package/template-overlays/router/docs/adr/0001-keep-the-starter-minimal.md +32 -0
- package/template-overlays/router/docs/architecture/module-boundaries.md +39 -0
- package/template-overlays/router/docs/meta/maintenance.md +38 -0
- package/template-overlays/router/docs/specs/README.md +19 -0
- package/template-overlays/router/docs/specs/app-bootstrap.md +42 -0
- package/template-overlays/router/docs/specs/router-navigation.md +41 -0
- package/template-overlays/router/index.html +14 -0
- package/template-overlays/router/package.json +74 -0
- package/template-overlays/router/pnpm-lock.yaml +3793 -0
- package/template-overlays/router/src/app-view.kpa +128 -0
- package/template-overlays/router/src/home-page.kpa +100 -0
- package/template-overlays/router/src/main.ts +89 -0
- package/template-overlays/router/src/not-found-page.kpa +69 -0
- package/template-overlays/router/src/router-page.kpa +102 -0
- package/template-overlays/router/src/style.css +51 -0
- package/template-overlays/router/tests/e2e/app.spec.ts +38 -0
- package/template-overlays/router/tests/integration/main-bootstrap.test.ts +150 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to **__PROJECT_NAME__** are documented in this file.
|
|
4
|
+
|
|
5
|
+
This project uses a **manual, tag-driven release process**.
|
|
6
|
+
Only tagged versions represent official releases.
|
|
7
|
+
|
|
8
|
+
This changelog documents **intentional milestones and guarantees**,
|
|
9
|
+
not every internal refactor.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## [Unreleased]
|
|
14
|
+
|
|
15
|
+
_No unreleased changes yet._
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## [1.0.0] — Initial Starter Baseline
|
|
20
|
+
|
|
21
|
+
**2026-03-17**
|
|
22
|
+
|
|
23
|
+
### Added
|
|
24
|
+
|
|
25
|
+
- a small KoppaJS router app shell with `app-view`, `home-page`,
|
|
26
|
+
`router-page`, `not-found-page`, and `counter-component`
|
|
27
|
+
- route-based rendering through `@koppajs/koppajs-router`
|
|
28
|
+
- ESLint, Prettier, Vitest, Playwright, Husky, lint-staged, and commitlint
|
|
29
|
+
- starter governance docs, ADRs, specs, and release workflow files
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Versioning Policy
|
|
34
|
+
|
|
35
|
+
- Semantic Versioning (SemVer) is followed pragmatically
|
|
36
|
+
- **Breaking changes** include:
|
|
37
|
+
- public runtime behavior changes
|
|
38
|
+
- route structure changes
|
|
39
|
+
- release workflow changes
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
_This changelog documents intent.
|
|
44
|
+
If something is not written here, it is not guaranteed._
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Development Rules
|
|
2
|
+
|
|
3
|
+
## Scope
|
|
4
|
+
|
|
5
|
+
These rules describe how code and documentation are expected to evolve in this repository.
|
|
6
|
+
|
|
7
|
+
## Source layout rules
|
|
8
|
+
|
|
9
|
+
- Keep `index.html` as a static shell with asset references and the single root element.
|
|
10
|
+
- Keep `src/main.ts` limited to bootstrap concerns: imports, `Core.take(...)`
|
|
11
|
+
registrations, route definitions, and initialization of the single router instance.
|
|
12
|
+
- Use `.kpa` files for UI composition, local component state, and component-scoped CSS.
|
|
13
|
+
- Keep the route outlet inside `app-view.kpa` and keep route rendering consumer-owned.
|
|
14
|
+
- If logic becomes reusable, asynchronous, or branch-heavy, move it into `.ts` modules under `src/`.
|
|
15
|
+
- Keep `public/` for static assets only.
|
|
16
|
+
|
|
17
|
+
## Naming conventions
|
|
18
|
+
|
|
19
|
+
- Custom element names must be kebab-case.
|
|
20
|
+
- Root-level application components should use `app-` prefixes when they represent app shells or app-wide structure.
|
|
21
|
+
- Route component filenames should match their registered component tags or route purpose.
|
|
22
|
+
- New files and folders should use descriptive names over abbreviations.
|
|
23
|
+
|
|
24
|
+
## Dependency rules
|
|
25
|
+
|
|
26
|
+
- Runtime dependencies must be justified by a concrete need in a spec or ADR.
|
|
27
|
+
- Prefer browser APIs and KoppaJS primitives before adding helper libraries.
|
|
28
|
+
- Keep this repository wired to published npm packages unless there is an explicit ADR stating otherwise.
|
|
29
|
+
- Build tooling changes must update contributor docs and architecture docs in the same change.
|
|
30
|
+
- Quality tooling must stay proportionate to the starter.
|
|
31
|
+
|
|
32
|
+
## Coding patterns
|
|
33
|
+
|
|
34
|
+
- Favor simple, local state over premature abstraction.
|
|
35
|
+
- Keep route definitions obvious and close to router initialization.
|
|
36
|
+
- Avoid hidden side effects during import.
|
|
37
|
+
- Keep CSS local to components unless the style truly applies application-wide.
|
|
38
|
+
- Preserve strict TypeScript settings; do not weaken `tsconfig.json` to work around errors.
|
|
39
|
+
- Give interactive controls stable accessible names so smoke tests can target public semantics instead of brittle selectors.
|
|
40
|
+
|
|
41
|
+
## Forbidden without a spec and ADR
|
|
42
|
+
|
|
43
|
+
- Replacing the starter's single-router model with a second navigation system
|
|
44
|
+
- Adding global state containers
|
|
45
|
+
- Adding network or persistence layers
|
|
46
|
+
- Introducing SSR, multi-page bootstraps, or multiple root entries
|
|
47
|
+
- Switching dependency sourcing from npm packages to local monorepo links
|
|
48
|
+
- Expanding the starter into a feature-rich demo application
|
|
49
|
+
- Adding heavyweight hooks that run the entire suite on every commit
|
|
50
|
+
|
|
51
|
+
## Documentation obligations
|
|
52
|
+
|
|
53
|
+
- Update [ARCHITECTURE.md](./ARCHITECTURE.md) when source layout or runtime flow changes.
|
|
54
|
+
- Update [TESTING_STRATEGY.md](./TESTING_STRATEGY.md) when quality gates or tooling change.
|
|
55
|
+
- Update or create a spec in [docs/specs](./docs/specs) for user-visible changes.
|
|
56
|
+
- Add an ADR in [docs/adr](./docs/adr) for durable technical decisions.
|
|
57
|
+
- Update [docs/quality/quality-gates.md](./docs/quality/quality-gates.md) when scripts, hooks, CI checks, or browser-smoke expectations change.
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
<a id="readme-top"></a>
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
<img src="https://public-assets-1b57ca06-687a-4142-a525-0635f7649a5c.s3.eu-central-1.amazonaws.com/koppajs/koppajs-logo-text-900x226.png" width="500" alt="KoppaJS Logo">
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
<br>
|
|
8
|
+
|
|
9
|
+
<div align="center">
|
|
10
|
+
<a href="./LICENSE"><img src="https://img.shields.io/badge/license-Apache--2.0-blue?style=flat-square" alt="License"></a>
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
<br>
|
|
14
|
+
|
|
15
|
+
<div align="center">
|
|
16
|
+
<h1 align="center">__PROJECT_NAME__</h1>
|
|
17
|
+
<h3 align="center">KoppaJS router starter project</h3>
|
|
18
|
+
<p align="center">
|
|
19
|
+
<i>Scaffolded from the official KoppaJS router starter baseline.</i>
|
|
20
|
+
</p>
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
<br>
|
|
24
|
+
|
|
25
|
+
<div align="center">
|
|
26
|
+
<p align="center">
|
|
27
|
+
<a href="https://github.com/koppajs/koppajs-documentation">Documentation</a>
|
|
28
|
+
·
|
|
29
|
+
<a href="https://github.com/koppajs/koppajs-core">KoppaJS Core</a>
|
|
30
|
+
·
|
|
31
|
+
<a href="https://github.com/koppajs/koppajs-router">KoppaJS Router</a>
|
|
32
|
+
·
|
|
33
|
+
<a href="https://github.com/koppajs/koppajs-vite-plugin">Vite Plugin</a>
|
|
34
|
+
</p>
|
|
35
|
+
</div>
|
|
36
|
+
|
|
37
|
+
<br>
|
|
38
|
+
|
|
39
|
+
<details>
|
|
40
|
+
<summary>Table of Contents</summary>
|
|
41
|
+
<ol>
|
|
42
|
+
<li><a href="#what-is-this">What is this?</a></li>
|
|
43
|
+
<li><a href="#requirements">Requirements</a></li>
|
|
44
|
+
<li><a href="#getting-started">Getting Started</a></li>
|
|
45
|
+
<li><a href="#quality-workflow">Quality Workflow</a></li>
|
|
46
|
+
<li><a href="#routing-overview">Routing Overview</a></li>
|
|
47
|
+
<li><a href="#project-structure">Project Structure</a></li>
|
|
48
|
+
<li><a href="#meta-layer">Meta Layer</a></li>
|
|
49
|
+
<li><a href="#community--contribution">Community & Contribution</a></li>
|
|
50
|
+
<li><a href="#license">License</a></li>
|
|
51
|
+
</ol>
|
|
52
|
+
</details>
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## What is this?
|
|
57
|
+
|
|
58
|
+
This project was scaffolded from the official KoppaJS router starter baseline.
|
|
59
|
+
|
|
60
|
+
It keeps the application intentionally small while demonstrating one extra
|
|
61
|
+
subsystem beyond the minimal starter:
|
|
62
|
+
|
|
63
|
+
- one HTML shell
|
|
64
|
+
- one TypeScript bootstrap file
|
|
65
|
+
- one root app shell component
|
|
66
|
+
- one router instance with a visible two-page flow
|
|
67
|
+
- one counter component on the home route
|
|
68
|
+
- one explicit catch-all route for unmatched paths
|
|
69
|
+
|
|
70
|
+
It also carries the same quality and governance baseline as the minimal starter:
|
|
71
|
+
|
|
72
|
+
- ESLint for source and tooling files
|
|
73
|
+
- Prettier plus `.editorconfig` for supported text formats
|
|
74
|
+
- Vitest for local unit and integration coverage
|
|
75
|
+
- Playwright for a real-browser smoke test
|
|
76
|
+
- Husky plus lint-staged for fast staged-file checks
|
|
77
|
+
- Conventional Commits enforcement via `commitlint`
|
|
78
|
+
- a tag-driven GitHub release baseline with `CHANGELOG.md` and `RELEASE.md`
|
|
79
|
+
|
|
80
|
+
Use it when you want to start from a small KoppaJS app that already shows how
|
|
81
|
+
route definitions, `data-route` links, and route-based outlet rendering fit
|
|
82
|
+
together.
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## Requirements
|
|
87
|
+
|
|
88
|
+
- Node.js 20.19+, 22.13+, or 24+
|
|
89
|
+
- pnpm >= 10
|
|
90
|
+
|
|
91
|
+
Node 23 is intentionally not treated as supported here because the current
|
|
92
|
+
upstream frontend toolchain excludes it.
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Getting Started
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
pnpm install
|
|
100
|
+
pnpm dev
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Install the Playwright browser once if you want to run the browser smoke test locally:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
pnpm exec playwright install chromium
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Useful commands:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
pnpm lint
|
|
113
|
+
pnpm format:check
|
|
114
|
+
pnpm typecheck
|
|
115
|
+
pnpm test:run
|
|
116
|
+
pnpm test:coverage
|
|
117
|
+
pnpm build
|
|
118
|
+
pnpm serve
|
|
119
|
+
pnpm release:check
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## Quality Workflow
|
|
125
|
+
|
|
126
|
+
Fast local baseline:
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
pnpm check
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Full validation, including Playwright:
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
pnpm validate
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Standalone browser smoke test:
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
pnpm test:e2e
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## Routing Overview
|
|
147
|
+
|
|
148
|
+
The starter wires `@koppajs/koppajs-router` in `src/main.ts`.
|
|
149
|
+
|
|
150
|
+
The route table currently contains:
|
|
151
|
+
|
|
152
|
+
- `/` -> `home-page`
|
|
153
|
+
- `/router` -> `router-page`
|
|
154
|
+
- `*` -> `not-found-page`
|
|
155
|
+
|
|
156
|
+
The router renders into `#app-outlet`, updates active navigation state for
|
|
157
|
+
links that use `data-route`, and keeps the browser URL aligned with the current
|
|
158
|
+
page.
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## Project Structure
|
|
163
|
+
|
|
164
|
+
```text
|
|
165
|
+
__PROJECT_NAME__/
|
|
166
|
+
├── .editorconfig
|
|
167
|
+
├── .github/
|
|
168
|
+
├── .gitignore
|
|
169
|
+
├── .husky/
|
|
170
|
+
├── .npmrc
|
|
171
|
+
├── .prettierignore
|
|
172
|
+
├── CHANGELOG.md
|
|
173
|
+
├── commitlint.config.mjs
|
|
174
|
+
├── AI_CONSTITUTION.md
|
|
175
|
+
├── ARCHITECTURE.md
|
|
176
|
+
├── CONTRIBUTING.md
|
|
177
|
+
├── DECISION_HIERARCHY.md
|
|
178
|
+
├── DEVELOPMENT_RULES.md
|
|
179
|
+
├── RELEASE.md
|
|
180
|
+
├── ROADMAP.md
|
|
181
|
+
├── TESTING_STRATEGY.md
|
|
182
|
+
├── eslint.config.mjs
|
|
183
|
+
├── index.html
|
|
184
|
+
├── package.json
|
|
185
|
+
├── playwright.config.ts
|
|
186
|
+
├── pnpm-lock.yaml
|
|
187
|
+
├── prettier.config.mjs
|
|
188
|
+
├── tsconfig.json
|
|
189
|
+
├── vite.config.mjs
|
|
190
|
+
├── vitest.config.mjs
|
|
191
|
+
├── docs/
|
|
192
|
+
│ ├── adr/
|
|
193
|
+
│ ├── architecture/
|
|
194
|
+
│ ├── meta/
|
|
195
|
+
│ ├── quality/
|
|
196
|
+
│ └── specs/
|
|
197
|
+
├── public/
|
|
198
|
+
│ └── favicon.svg
|
|
199
|
+
├── src/
|
|
200
|
+
│ ├── main.ts
|
|
201
|
+
│ ├── style.css
|
|
202
|
+
│ ├── app-view.kpa
|
|
203
|
+
│ ├── counter-component.kpa
|
|
204
|
+
│ ├── home-page.kpa
|
|
205
|
+
│ ├── router-page.kpa
|
|
206
|
+
│ └── not-found-page.kpa
|
|
207
|
+
└── tests/
|
|
208
|
+
├── e2e/
|
|
209
|
+
├── integration/
|
|
210
|
+
└── unit/
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
## Meta Layer
|
|
216
|
+
|
|
217
|
+
The repository includes an explicit meta layer so architecture, testing, and
|
|
218
|
+
contributor rules evolve together with the codebase.
|
|
219
|
+
|
|
220
|
+
Start here:
|
|
221
|
+
|
|
222
|
+
- `DECISION_HIERARCHY.md`
|
|
223
|
+
- `AI_CONSTITUTION.md`
|
|
224
|
+
- `ARCHITECTURE.md`
|
|
225
|
+
- `DEVELOPMENT_RULES.md`
|
|
226
|
+
- `TESTING_STRATEGY.md`
|
|
227
|
+
- `CHANGELOG.md`
|
|
228
|
+
- `RELEASE.md`
|
|
229
|
+
- `docs/quality/quality-gates.md`
|
|
230
|
+
- `docs/adr/`
|
|
231
|
+
- `docs/specs/`
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
## Community & Contribution
|
|
236
|
+
|
|
237
|
+
Contribution workflow details live in `CONTRIBUTING.md`.
|
|
238
|
+
Update this section with your own repository links once the project has a
|
|
239
|
+
canonical home.
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
## License
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Roadmap
|
|
2
|
+
|
|
3
|
+
This roadmap describes intended directions, not guaranteed delivery dates.
|
|
4
|
+
|
|
5
|
+
## Current priorities
|
|
6
|
+
|
|
7
|
+
- Keep the router starter focused and production-like.
|
|
8
|
+
- Preserve a clear bootstrap path for new KoppaJS users.
|
|
9
|
+
- Keep the meta layer synchronized with the actual repository.
|
|
10
|
+
|
|
11
|
+
## Near-term opportunities
|
|
12
|
+
|
|
13
|
+
- Add route-level examples only when they demonstrate a real starter need.
|
|
14
|
+
- Strengthen route-related tests if the starter gains redirects, params, or nested routes.
|
|
15
|
+
- Keep documentation aligned with the actual router wiring.
|
|
16
|
+
|
|
17
|
+
## Longer-term expansion triggers
|
|
18
|
+
|
|
19
|
+
These should happen only with a spec and ADR:
|
|
20
|
+
|
|
21
|
+
- async data fetching
|
|
22
|
+
- persistence
|
|
23
|
+
- richer route hierarchies
|
|
24
|
+
- shared state beyond local component state
|
|
25
|
+
- CI automation changes
|
|
26
|
+
|
|
27
|
+
## Meta-layer maintenance
|
|
28
|
+
|
|
29
|
+
Every release or architecture-changing change should answer:
|
|
30
|
+
|
|
31
|
+
- Does the architecture document still match the code?
|
|
32
|
+
- Did any new decision deserve an ADR?
|
|
33
|
+
- Did testing expectations change?
|
|
34
|
+
- Did contributor instructions stay accurate?
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Testing Strategy
|
|
2
|
+
|
|
3
|
+
## Current state
|
|
4
|
+
|
|
5
|
+
This repository carries a small automated testing stack aligned with the router starter's actual risk profile:
|
|
6
|
+
|
|
7
|
+
- `pnpm test:run` for unit and integration tests in Vitest
|
|
8
|
+
- `pnpm test:coverage` for local coverage reporting
|
|
9
|
+
- `pnpm test:e2e` for a Playwright smoke test against `vite preview`
|
|
10
|
+
- `pnpm check` for the fast repository baseline
|
|
11
|
+
- `pnpm validate` for the full local and CI validation path
|
|
12
|
+
- `pnpm release:check` for tagged release candidates
|
|
13
|
+
- `commitlint` through `.husky/commit-msg` for commit message validation
|
|
14
|
+
|
|
15
|
+
## Philosophy
|
|
16
|
+
|
|
17
|
+
- Test the smallest meaningful unit that gives confidence.
|
|
18
|
+
- Prefer extracting logic into `.ts` modules when it becomes complex enough to warrant focused unit tests.
|
|
19
|
+
- Avoid brittle tests that mirror implementation details instead of observable behavior.
|
|
20
|
+
- Reuse the real Vite loading path in automated tests whenever `.kpa` handling is part of the risk surface.
|
|
21
|
+
|
|
22
|
+
## Test pyramid for this repository
|
|
23
|
+
|
|
24
|
+
### Unit tests
|
|
25
|
+
|
|
26
|
+
Use unit tests for isolated logic that can fail independently of the browser runtime.
|
|
27
|
+
|
|
28
|
+
### Integration or component tests
|
|
29
|
+
|
|
30
|
+
Use integration tests when bootstrap, component registration, and router startup
|
|
31
|
+
must be verified together but a full browser run would be disproportionate.
|
|
32
|
+
|
|
33
|
+
Typical triggers:
|
|
34
|
+
|
|
35
|
+
- bootstrap registration in `src/main.ts`
|
|
36
|
+
- router startup wiring and route table shape
|
|
37
|
+
- build-time behavior that depends on the Vite plugin
|
|
38
|
+
|
|
39
|
+
### End-to-end tests
|
|
40
|
+
|
|
41
|
+
Keep Playwright intentionally user-facing and smoke-level.
|
|
42
|
+
|
|
43
|
+
Typical triggers:
|
|
44
|
+
|
|
45
|
+
- root UI rendering
|
|
46
|
+
- route navigation between starter pages
|
|
47
|
+
- critical starter interactions such as the counter behavior
|
|
48
|
+
- preview/build regressions that would not be caught by Vitest alone
|
|
49
|
+
|
|
50
|
+
## Coverage expectations
|
|
51
|
+
|
|
52
|
+
- There is no blanket repository percentage target right now.
|
|
53
|
+
- New non-trivial logic should come with focused tests.
|
|
54
|
+
- When a subsystem introduces more branching logic, async behavior, or shared state, test automation stops being optional.
|
|
55
|
+
|
|
56
|
+
## Quality gates by change size
|
|
57
|
+
|
|
58
|
+
- Documentation-only change: verify links and document consistency.
|
|
59
|
+
- Small style or copy change: run `pnpm check`.
|
|
60
|
+
- Source or config change: run `pnpm check`.
|
|
61
|
+
- UI, bootstrap, or browser-sensitive change: run `pnpm validate`.
|
|
62
|
+
- Version, changelog, or release workflow change: run `pnpm release:check`.
|
|
63
|
+
|
|
64
|
+
## Maintenance rule
|
|
65
|
+
|
|
66
|
+
Whenever test tooling, quality gates, or expected confidence levels change,
|
|
67
|
+
update this file and [docs/quality/quality-gates.md](./docs/quality/quality-gates.md) in the same change.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# ADR 0001: Keep the router starter focused
|
|
2
|
+
|
|
3
|
+
## Context
|
|
4
|
+
|
|
5
|
+
This repository starts from the maintained KoppaJS router starter baseline.
|
|
6
|
+
Its audience needs a runnable reference that demonstrates routing without
|
|
7
|
+
turning into a broad showcase application.
|
|
8
|
+
|
|
9
|
+
## Decision
|
|
10
|
+
|
|
11
|
+
The router starter remains intentionally small:
|
|
12
|
+
|
|
13
|
+
- one HTML shell,
|
|
14
|
+
- one TypeScript bootstrap file,
|
|
15
|
+
- one root KoppaJS view,
|
|
16
|
+
- one router instance,
|
|
17
|
+
- two primary routes plus one explicit fallback route,
|
|
18
|
+
- one stateful child component,
|
|
19
|
+
- published npm packages instead of local monorepo `file:` dependencies.
|
|
20
|
+
|
|
21
|
+
Any expansion beyond that baseline requires a spec and ADR.
|
|
22
|
+
|
|
23
|
+
## Consequences
|
|
24
|
+
|
|
25
|
+
- New users get a fast example of routing without a lot of incidental complexity.
|
|
26
|
+
- The repository stays easy to audit and maintain.
|
|
27
|
+
- More advanced route features must be introduced deliberately rather than accumulating ad hoc.
|
|
28
|
+
|
|
29
|
+
## Alternatives considered
|
|
30
|
+
|
|
31
|
+
- A feature-rich demo app that showcases many KoppaJS patterns at once
|
|
32
|
+
- A monorepo-linked starter that depends on local sibling packages
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Module Boundaries
|
|
2
|
+
|
|
3
|
+
## Repository boundary model
|
|
4
|
+
|
|
5
|
+
This repository is intentionally shallow. Its boundaries keep the starter easy to inspect.
|
|
6
|
+
|
|
7
|
+
| Path | Responsibility | Allowed dependencies | Must not depend on |
|
|
8
|
+
| --------------------------- | ----------------------------------------------------------------- | ------------------------------------------------------------------------ | --------------------------------------------------- |
|
|
9
|
+
| `index.html` | Document shell, root element, asset references | Static assets, `src/main.ts`, `src/style.css` | Feature logic, router setup, extra scripts |
|
|
10
|
+
| `src/main.ts` | Application bootstrap, component registration, and router startup | `@koppajs/koppajs-core`, `@koppajs/koppajs-router`, local `.kpa` modules | Page copy, route component visuals, unrelated state |
|
|
11
|
+
| `src/app-view.kpa` | Shared shell, primary navigation, and route outlet | Local markup, local CSS | Route matching, component registration |
|
|
12
|
+
| `src/home-page.kpa` | Landing-route content and counter composition | Local markup, local CSS, `counter-component` | Router setup or global shell orchestration |
|
|
13
|
+
| `src/router-page.kpa` | Second-route content | Local markup and local CSS | Bootstrap or route resolution concerns |
|
|
14
|
+
| `src/not-found-page.kpa` | Explicit fallback-route content | Local markup and local CSS | Route matching rules or global state |
|
|
15
|
+
| `src/counter-component.kpa` | Example local state and interaction | Local markup, local methods, local CSS | Route orchestration or app-shell concerns |
|
|
16
|
+
| `src/style.css` | Global tokens and truly global base rules | Standard CSS | Route-specific or component-specific visual rules |
|
|
17
|
+
| `tests/integration/` | Bootstrap and router boundary verification | Vitest, local modules, selective mocks | Browser-only smoke assertions |
|
|
18
|
+
| `tests/e2e/` | Real-browser smoke coverage | Playwright, preview server | Implementation-detail assertions |
|
|
19
|
+
| `vite.config.mjs` | Build and dev server integration | Vite and the KoppaJS Vite plugin | Application runtime logic |
|
|
20
|
+
|
|
21
|
+
## Boundary rules
|
|
22
|
+
|
|
23
|
+
- Registration and route configuration happen in `src/main.ts`.
|
|
24
|
+
- `app-view.kpa` may compose navigation and the outlet but must not become a second router.
|
|
25
|
+
- Route components own their own copy and layout.
|
|
26
|
+
- Shared logic belongs in dedicated `.ts` modules once reuse or complexity justifies it.
|
|
27
|
+
- Vitest owns helper-level and bootstrap-level confidence; Playwright owns browser smoke confidence.
|
|
28
|
+
|
|
29
|
+
## Escalation rules
|
|
30
|
+
|
|
31
|
+
Before crossing existing boundaries, add a spec and ADR if the change introduces:
|
|
32
|
+
|
|
33
|
+
- nested or parameterized routing beyond the current baseline,
|
|
34
|
+
- shared state,
|
|
35
|
+
- async workflows,
|
|
36
|
+
- persistence,
|
|
37
|
+
- more than one root entrypoint,
|
|
38
|
+
- npm publishing or deployment automation,
|
|
39
|
+
- new top-level source folders.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Meta-Layer Maintenance
|
|
2
|
+
|
|
3
|
+
The meta layer is a living system. Any change that alters the real system must update the corresponding governance document in the same change.
|
|
4
|
+
|
|
5
|
+
## Update matrix
|
|
6
|
+
|
|
7
|
+
| Change | Required updates |
|
|
8
|
+
| ------------------------------------------ | ---------------------------------------------------------------------------------------------- |
|
|
9
|
+
| New feature or behavior | Add or update a spec in `docs/specs/`; update `README.md` if setup or visible behavior changes |
|
|
10
|
+
| New enduring technical decision | Add or update an ADR in `docs/adr/` |
|
|
11
|
+
| New module, folder, or data flow | Update `ARCHITECTURE.md` and `docs/architecture/module-boundaries.md` |
|
|
12
|
+
| New coding pattern or dependency rule | Update `DEVELOPMENT_RULES.md` |
|
|
13
|
+
| New test tooling or quality gate | Update `TESTING_STRATEGY.md` and `docs/quality/quality-gates.md` |
|
|
14
|
+
| New hook, CI step, or contributor workflow | Update `CONTRIBUTING.md` and `.github/instructions/ai-workflow.md` |
|
|
15
|
+
| Version, changelog, or release workflow | Update `CHANGELOG.md`, `RELEASE.md`, `package.json`, and affected GitHub workflow files |
|
|
16
|
+
|
|
17
|
+
## Review triggers
|
|
18
|
+
|
|
19
|
+
Perform a meta-layer review when:
|
|
20
|
+
|
|
21
|
+
- a pull request changes the repo structure,
|
|
22
|
+
- a new dependency is added,
|
|
23
|
+
- a public component tag changes,
|
|
24
|
+
- a build or test command changes,
|
|
25
|
+
- a hook or CI workflow changes,
|
|
26
|
+
- the routing model or route surface changes,
|
|
27
|
+
- a README section no longer matches the actual code.
|
|
28
|
+
|
|
29
|
+
## Periodic review checklist
|
|
30
|
+
|
|
31
|
+
- Does [ARCHITECTURE.md](../../ARCHITECTURE.md) still match the runtime flow?
|
|
32
|
+
- Do current specs cover the user-visible behaviors in the repo?
|
|
33
|
+
- Do ADRs still represent active decisions?
|
|
34
|
+
- Do contributor instructions still match the actual toolchain?
|
|
35
|
+
- Did a recent change deserve a new quality gate?
|
|
36
|
+
- Do `CHANGELOG.md`, `RELEASE.md`, and the release workflow still match actual branch and tag practice?
|
|
37
|
+
|
|
38
|
+
If any answer is "no", update the meta layer before considering the repository aligned.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Specifications
|
|
2
|
+
|
|
3
|
+
Specs define expected behavior before or alongside implementation. They are the highest-precedence project documents.
|
|
4
|
+
|
|
5
|
+
## When a spec is required
|
|
6
|
+
|
|
7
|
+
Create or update a spec when a change:
|
|
8
|
+
|
|
9
|
+
- introduces or changes user-visible behavior,
|
|
10
|
+
- adds a subsystem,
|
|
11
|
+
- changes public setup or bootstrap behavior,
|
|
12
|
+
- changes a feature in a way that needs explicit acceptance criteria.
|
|
13
|
+
|
|
14
|
+
## Current specs
|
|
15
|
+
|
|
16
|
+
- [`app-bootstrap.md`](./app-bootstrap.md)
|
|
17
|
+
- [`counter-component.md`](./counter-component.md)
|
|
18
|
+
- [`router-navigation.md`](./router-navigation.md)
|
|
19
|
+
- [`quality-workflow.md`](./quality-workflow.md)
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Spec: App bootstrap
|
|
2
|
+
|
|
3
|
+
## Status
|
|
4
|
+
|
|
5
|
+
Approved
|
|
6
|
+
|
|
7
|
+
## Purpose
|
|
8
|
+
|
|
9
|
+
Provide a predictable startup path for a KoppaJS application that includes the official router runtime.
|
|
10
|
+
|
|
11
|
+
## Behavior
|
|
12
|
+
|
|
13
|
+
- The application starts from `index.html`.
|
|
14
|
+
- The HTML shell loads one global stylesheet and one module entrypoint.
|
|
15
|
+
- The document declares exactly one root custom element: `<app-view>`.
|
|
16
|
+
- `src/main.ts` registers `app-view`, `home-page`, `router-page`, `not-found-page`, and `counter-component` with KoppaJS Core.
|
|
17
|
+
- `src/main.ts` invokes `Core()` once and starts one `KoppajsRouter` instance.
|
|
18
|
+
|
|
19
|
+
## Inputs
|
|
20
|
+
|
|
21
|
+
- Browser loading `index.html`
|
|
22
|
+
- Static asset and source file paths resolved by Vite
|
|
23
|
+
|
|
24
|
+
## Outputs
|
|
25
|
+
|
|
26
|
+
- A rendered `<app-view>` application shell
|
|
27
|
+
- A rendered route component inside `#app-outlet`
|
|
28
|
+
- A registered `<counter-component>` available to the home route
|
|
29
|
+
|
|
30
|
+
## Constraints
|
|
31
|
+
|
|
32
|
+
- There must be a single bootstrap entrypoint.
|
|
33
|
+
- The root tag in `index.html` must stay aligned with the component registered in `src/main.ts`.
|
|
34
|
+
- `Core()` must remain the only KoppaJS bootstrap call.
|
|
35
|
+
- Router initialization must happen after the route outlet exists.
|
|
36
|
+
- No extra runtime dependencies are required beyond the declared npm packages.
|
|
37
|
+
|
|
38
|
+
## Acceptance criteria
|
|
39
|
+
|
|
40
|
+
- Opening the app through Vite renders the root view without manual DOM scripting.
|
|
41
|
+
- `src/main.ts` remains the only location that calls `Core()`.
|
|
42
|
+
- The route outlet is initialized by the router and can render the home route immediately after bootstrap.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Spec: Router navigation
|
|
2
|
+
|
|
3
|
+
## Status
|
|
4
|
+
|
|
5
|
+
Approved
|
|
6
|
+
|
|
7
|
+
## Purpose
|
|
8
|
+
|
|
9
|
+
Define the starter's router baseline so the generated project demonstrates a small but real navigation flow.
|
|
10
|
+
|
|
11
|
+
## Behavior
|
|
12
|
+
|
|
13
|
+
- The starter initializes one `KoppajsRouter` instance from `src/main.ts`.
|
|
14
|
+
- The router renders matched route components into `#app-outlet`.
|
|
15
|
+
- Primary navigation links use `data-route` and participate in active-link state updates.
|
|
16
|
+
- The starter includes a home route, a second content route, and an explicit `*` fallback route.
|
|
17
|
+
|
|
18
|
+
## Inputs
|
|
19
|
+
|
|
20
|
+
- Route definitions declared in `src/main.ts`
|
|
21
|
+
- Browser URL and History API state
|
|
22
|
+
- User clicks on matching `data-route` links
|
|
23
|
+
|
|
24
|
+
## Outputs
|
|
25
|
+
|
|
26
|
+
- URL changes that stay aligned with the rendered route component
|
|
27
|
+
- Active navigation state on the current route link
|
|
28
|
+
- A predictable not-found page for unmatched paths
|
|
29
|
+
|
|
30
|
+
## Constraints
|
|
31
|
+
|
|
32
|
+
- The route table must stay small and inspectable.
|
|
33
|
+
- The fallback route must be explicit rather than implicit.
|
|
34
|
+
- Route content stays in consumer-owned `.kpa` files, not inside the router package.
|
|
35
|
+
|
|
36
|
+
## Acceptance criteria
|
|
37
|
+
|
|
38
|
+
- Visiting `/` renders the home route.
|
|
39
|
+
- Visiting `/router` renders the second route.
|
|
40
|
+
- Visiting an unmatched path renders the fallback route.
|
|
41
|
+
- The active navigation link exposes `aria-current="page"` for the current route.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>KoppaJS Router Starter</title>
|
|
7
|
+
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
8
|
+
<link rel="stylesheet" href="/src/style.css" />
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
<app-view></app-view>
|
|
12
|
+
<script type="module" src="/src/main.ts"></script>
|
|
13
|
+
</body>
|
|
14
|
+
</html>
|