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.
Files changed (29) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/README.md +123 -122
  3. package/bin/create-koppajs.js +158 -13
  4. package/package.json +2 -1
  5. package/template/package.json +2 -2
  6. package/template/pnpm-lock.yaml +11 -18
  7. package/template-overlays/router/ARCHITECTURE.md +86 -0
  8. package/template-overlays/router/CHANGELOG.md +44 -0
  9. package/template-overlays/router/DEVELOPMENT_RULES.md +57 -0
  10. package/template-overlays/router/README.md +243 -0
  11. package/template-overlays/router/ROADMAP.md +34 -0
  12. package/template-overlays/router/TESTING_STRATEGY.md +67 -0
  13. package/template-overlays/router/docs/adr/0001-keep-the-starter-minimal.md +32 -0
  14. package/template-overlays/router/docs/architecture/module-boundaries.md +39 -0
  15. package/template-overlays/router/docs/meta/maintenance.md +38 -0
  16. package/template-overlays/router/docs/specs/README.md +19 -0
  17. package/template-overlays/router/docs/specs/app-bootstrap.md +42 -0
  18. package/template-overlays/router/docs/specs/router-navigation.md +41 -0
  19. package/template-overlays/router/index.html +14 -0
  20. package/template-overlays/router/package.json +74 -0
  21. package/template-overlays/router/pnpm-lock.yaml +3786 -0
  22. package/template-overlays/router/src/app-view.kpa +128 -0
  23. package/template-overlays/router/src/home-page.kpa +100 -0
  24. package/template-overlays/router/src/main.ts +89 -0
  25. package/template-overlays/router/src/not-found-page.kpa +69 -0
  26. package/template-overlays/router/src/router-page.kpa +102 -0
  27. package/template-overlays/router/src/style.css +51 -0
  28. package/template-overlays/router/tests/e2e/app.spec.ts +38 -0
  29. package/template-overlays/router/tests/integration/main-bootstrap.test.ts +150 -0
@@ -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>
@@ -0,0 +1,74 @@
1
+ {
2
+ "name": "__PROJECT_NAME__",
3
+ "version": "1.0.0",
4
+ "private": true,
5
+ "description": "KoppaJS router application scaffolded with create-koppajs.",
6
+ "author": "Bastian Bensch",
7
+ "license": "Apache-2.0",
8
+ "keywords": [
9
+ "koppajs",
10
+ "koppa",
11
+ "starter",
12
+ "scaffold",
13
+ "vite",
14
+ "typescript",
15
+ "web-components",
16
+ "router"
17
+ ],
18
+ "packageManager": "pnpm@10.12.1",
19
+ "engines": {
20
+ "node": "^20.19.0 || ^22.13.0 || >=24.0.0",
21
+ "pnpm": ">=10"
22
+ },
23
+ "scripts": {
24
+ "dev": "vite --host",
25
+ "build": "tsc --noEmit && vite build",
26
+ "lint": "eslint .",
27
+ "lint:fix": "eslint . --fix",
28
+ "format": "prettier . --write --ignore-unknown",
29
+ "format:check": "prettier . --check --ignore-unknown",
30
+ "test": "vitest run",
31
+ "test:watch": "vitest",
32
+ "test:run": "vitest run",
33
+ "test:coverage": "vitest run --coverage",
34
+ "test:e2e": "pnpm build && playwright test",
35
+ "test:e2e:headed": "pnpm build && playwright test --headed",
36
+ "test:e2e:ui": "pnpm build && playwright test --ui",
37
+ "check": "pnpm lint && pnpm format:check && pnpm typecheck && pnpm test:run && pnpm build",
38
+ "validate": "pnpm check && playwright test",
39
+ "release:check": "pnpm validate",
40
+ "typecheck": "tsc --noEmit",
41
+ "serve": "vite preview",
42
+ "serve:e2e": "vite preview --host 127.0.0.1 --strictPort --port 4173",
43
+ "prepare": "husky"
44
+ },
45
+ "dependencies": {
46
+ "@koppajs/koppajs-core": "^3.0.3",
47
+ "@koppajs/koppajs-router": "^0.1.0"
48
+ },
49
+ "devDependencies": {
50
+ "@commitlint/cli": "^20.1.0",
51
+ "@commitlint/config-conventional": "^20.0.0",
52
+ "@eslint/js": "^10.0.1",
53
+ "@koppajs/koppajs-vite-plugin": "^1.0.1",
54
+ "@playwright/test": "^1.58.2",
55
+ "@types/node": "^25.4.0",
56
+ "@vitest/coverage-v8": "^4.0.18",
57
+ "eslint": "^10.0.3",
58
+ "globals": "^17.4.0",
59
+ "husky": "^9.1.7",
60
+ "lint-staged": "^16.3.3",
61
+ "prettier": "^3.8.1",
62
+ "typescript": "^5.9.3",
63
+ "typescript-eslint": "^8.57.0",
64
+ "vite": "7.2.6",
65
+ "vitest": "^4.0.18"
66
+ },
67
+ "lint-staged": {
68
+ "*.{js,mjs,cjs,ts,mts,cts}": [
69
+ "eslint --fix",
70
+ "prettier --write"
71
+ ],
72
+ "*.{css,html,json,md,yml,yaml}": "prettier --write"
73
+ }
74
+ }