create-koppajs 1.1.0 → 1.2.1
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 +40 -0
- package/README.md +123 -122
- package/bin/create-koppajs.js +158 -13
- package/package.json +2 -1
- package/template/package.json +2 -2
- package/template/pnpm-lock.yaml +11 -18
- 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 +3786 -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
package/template/pnpm-lock.yaml
CHANGED
|
@@ -9,8 +9,8 @@ importers:
|
|
|
9
9
|
.:
|
|
10
10
|
dependencies:
|
|
11
11
|
'@koppajs/koppajs-core':
|
|
12
|
-
specifier: ^3.0.
|
|
13
|
-
version: 3.0.
|
|
12
|
+
specifier: ^3.0.3
|
|
13
|
+
version: 3.0.3
|
|
14
14
|
devDependencies:
|
|
15
15
|
'@commitlint/cli':
|
|
16
16
|
specifier: ^20.1.0
|
|
@@ -22,8 +22,8 @@ importers:
|
|
|
22
22
|
specifier: ^10.0.1
|
|
23
23
|
version: 10.0.1(eslint@10.0.3(jiti@2.6.1))
|
|
24
24
|
'@koppajs/koppajs-vite-plugin':
|
|
25
|
-
specifier: ^1.0.
|
|
26
|
-
version: 1.0.
|
|
25
|
+
specifier: ^1.0.1
|
|
26
|
+
version: 1.0.1(typescript@5.9.3)(vite@7.2.6(@types/node@25.4.0)(jiti@2.6.1)(sass@1.97.1)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2))
|
|
27
27
|
'@playwright/test':
|
|
28
28
|
specifier: ^1.58.2
|
|
29
29
|
version: 1.58.2
|
|
@@ -605,12 +605,12 @@ packages:
|
|
|
605
605
|
'@jridgewell/trace-mapping@0.3.31':
|
|
606
606
|
resolution: {integrity: sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==}
|
|
607
607
|
|
|
608
|
-
'@koppajs/koppajs-core@3.0.
|
|
609
|
-
resolution: {integrity: sha512-
|
|
608
|
+
'@koppajs/koppajs-core@3.0.3':
|
|
609
|
+
resolution: {integrity: sha512-l6e+M8hEugVW/4crOzddeImLM/0j+rqSJ5ZkFyBZPdv57Bp45WWdbmoK7HNKzPd+L70SehCaH7CcgRKM8ltbCQ==}
|
|
610
610
|
engines: {node: '>=20', pnpm: '>=10.24.0'}
|
|
611
611
|
|
|
612
|
-
'@koppajs/koppajs-vite-plugin@1.0.
|
|
613
|
-
resolution: {integrity: sha512-
|
|
612
|
+
'@koppajs/koppajs-vite-plugin@1.0.1':
|
|
613
|
+
resolution: {integrity: sha512-idjAD9zYQsK68yLxAI9So2bZScH7R4akDPsznHHivVCksMHSvkvQVtq328oeAg8rCi9AYN4z1Q0SAUB90aMDbg==}
|
|
614
614
|
engines: {node: '>=20', pnpm: '>=10.24.0'}
|
|
615
615
|
peerDependencies:
|
|
616
616
|
typescript: '>=5.5 <6'
|
|
@@ -944,11 +944,6 @@ packages:
|
|
|
944
944
|
peerDependencies:
|
|
945
945
|
acorn: ^6.0.0 || ^7.0.0 || ^8.0.0
|
|
946
946
|
|
|
947
|
-
acorn@8.15.0:
|
|
948
|
-
resolution: {integrity: sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==}
|
|
949
|
-
engines: {node: '>=0.4.0'}
|
|
950
|
-
hasBin: true
|
|
951
|
-
|
|
952
947
|
acorn@8.16.0:
|
|
953
948
|
resolution: {integrity: sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==}
|
|
954
949
|
engines: {node: '>=0.4.0'}
|
|
@@ -2411,11 +2406,11 @@ snapshots:
|
|
|
2411
2406
|
'@jridgewell/resolve-uri': 3.1.2
|
|
2412
2407
|
'@jridgewell/sourcemap-codec': 1.5.5
|
|
2413
2408
|
|
|
2414
|
-
'@koppajs/koppajs-core@3.0.
|
|
2409
|
+
'@koppajs/koppajs-core@3.0.3': {}
|
|
2415
2410
|
|
|
2416
|
-
'@koppajs/koppajs-vite-plugin@1.0.
|
|
2411
|
+
'@koppajs/koppajs-vite-plugin@1.0.1(typescript@5.9.3)(vite@7.2.6(@types/node@25.4.0)(jiti@2.6.1)(sass@1.97.1)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2))':
|
|
2417
2412
|
dependencies:
|
|
2418
|
-
acorn: 8.
|
|
2413
|
+
acorn: 8.16.0
|
|
2419
2414
|
autoprefixer: 10.4.23(postcss@8.5.6)
|
|
2420
2415
|
postcss: 8.5.6
|
|
2421
2416
|
sass: 1.97.1
|
|
@@ -2726,8 +2721,6 @@ snapshots:
|
|
|
2726
2721
|
dependencies:
|
|
2727
2722
|
acorn: 8.16.0
|
|
2728
2723
|
|
|
2729
|
-
acorn@8.15.0: {}
|
|
2730
|
-
|
|
2731
2724
|
acorn@8.16.0: {}
|
|
2732
2725
|
|
|
2733
2726
|
agent-base@7.1.4:
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Architecture
|
|
2
|
+
|
|
3
|
+
This repository is a small KoppaJS router starter. It demonstrates a clear
|
|
4
|
+
bootstrap path: HTML shell, TypeScript entrypoint, one root app shell
|
|
5
|
+
component, one router instance, two primary routes, and one explicit not-found
|
|
6
|
+
route. The repository also carries the same quality and release automation
|
|
7
|
+
baseline as the minimal starter so the example remains production-like.
|
|
8
|
+
|
|
9
|
+
## System overview
|
|
10
|
+
|
|
11
|
+
- `index.html` provides the document shell, loads global CSS, declares the
|
|
12
|
+
`<app-view>` root element, and imports the TypeScript entrypoint.
|
|
13
|
+
- `src/main.ts` registers local components with `Core.take(...)`, calls
|
|
14
|
+
`Core()` once, waits for the route outlet to exist, and initializes one
|
|
15
|
+
`KoppajsRouter` instance.
|
|
16
|
+
- `src/app-view.kpa` is the root shell. It renders the hero area, the primary
|
|
17
|
+
navigation, and the `#app-outlet` container that receives route content.
|
|
18
|
+
- `src/home-page.kpa` is the default route and composes `counter-component`.
|
|
19
|
+
- `src/router-page.kpa` is the second route and explains the router wiring.
|
|
20
|
+
- `src/not-found-page.kpa` is the explicit catch-all route.
|
|
21
|
+
- `src/counter-component.kpa` remains the example local-state component.
|
|
22
|
+
- `src/style.css` defines global tokens, base layout, and the background.
|
|
23
|
+
- `tests/integration/` verifies bootstrap wiring and router startup.
|
|
24
|
+
- `tests/e2e/` verifies the user-visible route flow and counter behavior.
|
|
25
|
+
|
|
26
|
+
More detailed boundaries live in [docs/architecture/module-boundaries.md](./docs/architecture/module-boundaries.md).
|
|
27
|
+
|
|
28
|
+
## Runtime flow
|
|
29
|
+
|
|
30
|
+
1. The browser loads [`index.html`](./index.html).
|
|
31
|
+
2. The document loads [`src/style.css`](./src/style.css) and [`src/main.ts`](./src/main.ts).
|
|
32
|
+
3. [`src/main.ts`](./src/main.ts) registers `app-view`, `home-page`,
|
|
33
|
+
`router-page`, `not-found-page`, and `counter-component`, then calls
|
|
34
|
+
`Core()`.
|
|
35
|
+
4. KoppaJS instantiates `<app-view>`.
|
|
36
|
+
5. [`src/app-view.kpa`](./src/app-view.kpa) renders the app shell, navigation,
|
|
37
|
+
and `#app-outlet`.
|
|
38
|
+
6. `src/main.ts` initializes `KoppajsRouter` with the route table and outlet.
|
|
39
|
+
7. The router renders the matching route component into `#app-outlet`,
|
|
40
|
+
synchronizes active links, and updates the current browser URL.
|
|
41
|
+
|
|
42
|
+
## Quality automation layer
|
|
43
|
+
|
|
44
|
+
- `eslint.config.mjs` lint-checks TypeScript source plus tooling files.
|
|
45
|
+
- `prettier.config.mjs` and `.editorconfig` keep supported text files consistent.
|
|
46
|
+
- `.npmrc` enforces the declared engine floor during installs.
|
|
47
|
+
- `.husky/pre-commit` runs `lint-staged`.
|
|
48
|
+
- `.husky/commit-msg` validates commit headers with `commitlint`.
|
|
49
|
+
- `.github/workflows/ci.yml` runs the full repository validation flow on GitHub.
|
|
50
|
+
- `.github/workflows/release.yml` runs tagged release validation and creates GitHub Releases.
|
|
51
|
+
|
|
52
|
+
## Module responsibilities
|
|
53
|
+
|
|
54
|
+
| Module | Responsibility | Must not do |
|
|
55
|
+
| --------------------------- | ---------------------------------------------------------------- | ------------------------------------------------------ |
|
|
56
|
+
| `index.html` | Declare the root tag and static assets | Hold feature logic or router setup |
|
|
57
|
+
| `src/main.ts` | Bootstrap the app, register components, and start one router | Accumulate page copy or unrelated UI state |
|
|
58
|
+
| `src/app-view.kpa` | Render the shared shell, nav, and router outlet | Own route resolution or register components |
|
|
59
|
+
| `src/home-page.kpa` | Render the landing route and compose the counter example | Reach into router internals or mutate global DOM state |
|
|
60
|
+
| `src/router-page.kpa` | Render the second route and explain the router baseline | Own bootstrap logic or global navigation state |
|
|
61
|
+
| `src/not-found-page.kpa` | Render the explicit fallback route | Replace route matching or bootstrap responsibilities |
|
|
62
|
+
| `src/counter-component.kpa` | Demonstrate local interactive state | Reach into route orchestration or app-shell concerns |
|
|
63
|
+
| `src/style.css` | Hold global tokens and truly global base styles | Duplicate component-local visuals |
|
|
64
|
+
| `tests/integration/` | Verify bootstrap and router-start boundaries | Duplicate full browser smoke expectations |
|
|
65
|
+
| `tests/e2e/` | Verify visible navigation and counter behavior in a real browser | Assert brittle implementation details |
|
|
66
|
+
|
|
67
|
+
## Invariants
|
|
68
|
+
|
|
69
|
+
- There is exactly one bootstrap entrypoint.
|
|
70
|
+
- The root tag in `index.html` must match a component registered in `src/main.ts`.
|
|
71
|
+
- `Core()` is called once from `src/main.ts`.
|
|
72
|
+
- The starter owns exactly one router instance.
|
|
73
|
+
- The route table contains an explicit `*` fallback route.
|
|
74
|
+
- Route rendering happens through `#app-outlet`.
|
|
75
|
+
- Official releases require matching versions across `package.json`,
|
|
76
|
+
`CHANGELOG.md`, and `vX.Y.Z` tags.
|
|
77
|
+
|
|
78
|
+
## Extension guidance
|
|
79
|
+
|
|
80
|
+
- Add new route components under `src/` and register them from `src/main.ts`.
|
|
81
|
+
- Keep route definitions in one obvious place.
|
|
82
|
+
- Extract reusable route helpers into `.ts` modules only when logic becomes
|
|
83
|
+
shared or branch-heavy.
|
|
84
|
+
- Add a spec before changing visible navigation behavior.
|
|
85
|
+
- Add an ADR before changing the routing model, adding data fetching,
|
|
86
|
+
persistence, or another major subsystem.
|
|
@@ -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.
|