create-koppajs 1.0.1 → 1.1.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 +105 -0
- package/README.md +169 -131
- package/bin/create-koppajs.js +201 -175
- package/package.json +54 -34
- package/template/AI_CONSTITUTION.md +50 -0
- package/template/ARCHITECTURE.md +86 -0
- package/template/CHANGELOG.md +34 -0
- package/template/CONTRIBUTING.md +92 -0
- package/template/DECISION_HIERARCHY.md +32 -0
- package/template/DEVELOPMENT_RULES.md +57 -0
- package/template/LICENSE +1 -1
- package/template/README.md +241 -49
- package/template/RELEASE.md +230 -0
- package/template/ROADMAP.md +34 -0
- package/template/TESTING_STRATEGY.md +93 -0
- package/template/_editorconfig +12 -0
- package/template/_gitattributes +1 -0
- package/template/_github/instructions/ai-workflow.md +33 -0
- package/template/_github/workflows/ci.yml +38 -0
- package/template/_github/workflows/release.yml +58 -0
- package/template/_gitignore +5 -0
- package/template/_husky/commit-msg +8 -0
- package/template/_husky/pre-commit +1 -0
- package/template/_npmrc +1 -0
- package/template/_prettierignore +7 -0
- package/template/commitlint.config.mjs +6 -0
- package/template/docs/adr/0001-keep-the-starter-minimal.md +32 -0
- package/template/docs/adr/0002-adopt-a-living-meta-layer.md +30 -0
- package/template/docs/adr/0003-normalize-kpa-plugin-output.md +24 -0
- package/template/docs/adr/0004-adopt-an-automated-quality-baseline.md +31 -0
- package/template/docs/adr/0005-adopt-a-tag-driven-release-baseline.md +45 -0
- package/template/docs/adr/0006-adopt-commit-message-conventions.md +39 -0
- package/template/docs/adr/README.md +37 -0
- package/template/docs/adr/TEMPLATE.md +18 -0
- package/template/docs/architecture/module-boundaries.md +48 -0
- package/template/docs/meta/maintenance.md +40 -0
- package/template/docs/quality/quality-gates.md +39 -0
- package/template/docs/specs/README.md +36 -0
- package/template/docs/specs/TEMPLATE.md +34 -0
- package/template/docs/specs/app-bootstrap.md +46 -0
- package/template/docs/specs/counter-component.md +48 -0
- package/template/docs/specs/quality-workflow.md +62 -0
- package/template/eslint.config.mjs +54 -0
- package/template/package.json +57 -6
- package/template/playwright.config.ts +31 -0
- package/template/pnpm-lock.yaml +3784 -0
- package/template/prettier.config.mjs +6 -0
- package/template/src/app-view.kpa +35 -36
- package/template/src/counter-component.kpa +87 -87
- package/template/src/style.css +5 -5
- package/template/tests/e2e/app.spec.ts +18 -0
- package/template/tests/integration/main-bootstrap.test.ts +33 -0
- package/template/tests/unit/normalize-kpa-module-export.test.ts +46 -0
- package/template/tsconfig.json +13 -2
- package/template/vite.config.d.mts +7 -0
- package/template/vite.config.mjs +39 -4
- package/template/vitest.config.mjs +19 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# ADR 0005: Adopt a tag-driven release baseline
|
|
2
|
+
|
|
3
|
+
## Context
|
|
4
|
+
|
|
5
|
+
The repository had gained a real quality baseline, governance documents, and a
|
|
6
|
+
`develop`/`main` branch model, but it still lacked an explicit release contract.
|
|
7
|
+
That left version bumps, changelog updates, and GitHub tagging behavior too
|
|
8
|
+
implicit for a maintained official starter.
|
|
9
|
+
|
|
10
|
+
`koppajs-core` already uses a documented tag-driven release path with guarded
|
|
11
|
+
automation. This starter benefits from the same clarity, but its release target
|
|
12
|
+
is different because the repository currently stays `private` and is not
|
|
13
|
+
published to npm.
|
|
14
|
+
|
|
15
|
+
## Decision
|
|
16
|
+
|
|
17
|
+
Adopt a manual, tag-driven release baseline for this repository:
|
|
18
|
+
|
|
19
|
+
- maintain `CHANGELOG.md` for official tagged milestones,
|
|
20
|
+
- document the maintainer procedure in `RELEASE.md`,
|
|
21
|
+
- create a GitHub Actions release workflow that runs on `vX.Y.Z` tags,
|
|
22
|
+
- rerun full repository validation during the release workflow,
|
|
23
|
+
- fail the workflow when the pushed tag does not match `package.json`,
|
|
24
|
+
- create GitHub Releases only while the repository remains `private`.
|
|
25
|
+
|
|
26
|
+
Release content is prepared on `develop`, moved through `release/*`, merged into
|
|
27
|
+
`main`, tagged on `main`, and merged back into `develop` after a successful
|
|
28
|
+
release.
|
|
29
|
+
|
|
30
|
+
## Consequences
|
|
31
|
+
|
|
32
|
+
- The repository now has an explicit versioning and release contract.
|
|
33
|
+
- Maintainers must update `package.json`, `CHANGELOG.md`, and `RELEASE.md` in
|
|
34
|
+
sync when release practice changes.
|
|
35
|
+
- Tagged releases are guarded against accidental version mismatches.
|
|
36
|
+
- The release workflow improves traceability without forcing npm publishing.
|
|
37
|
+
- If this repository later becomes publishable, a new ADR must extend or
|
|
38
|
+
replace this baseline rather than silently changing the release target.
|
|
39
|
+
|
|
40
|
+
## Alternatives considered
|
|
41
|
+
|
|
42
|
+
- Keeping releases informal and undocumented
|
|
43
|
+
- Adding automated versioning via Changesets or semantic-release
|
|
44
|
+
- Copying the npm publish path from `koppajs-core` even though this repository
|
|
45
|
+
is currently `private`
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# ADR 0006: Adopt commit message conventions
|
|
2
|
+
|
|
3
|
+
## Context
|
|
4
|
+
|
|
5
|
+
The repository now has staged-file checks, CI validation, and a documented
|
|
6
|
+
release process, but commit history still had no enforced structure.
|
|
7
|
+
|
|
8
|
+
That makes release review, changelog preparation, and future maintenance harder
|
|
9
|
+
than necessary, especially for an official starter that should model a clear
|
|
10
|
+
workflow for contributors.
|
|
11
|
+
|
|
12
|
+
`koppajs-core` already enforces conventional commit messages with `commitlint`.
|
|
13
|
+
The same baseline is appropriate here because it adds little overhead while
|
|
14
|
+
improving traceability.
|
|
15
|
+
|
|
16
|
+
## Decision
|
|
17
|
+
|
|
18
|
+
Adopt Conventional Commits enforcement through `commitlint`:
|
|
19
|
+
|
|
20
|
+
- add `@commitlint/cli` and `@commitlint/config-conventional`,
|
|
21
|
+
- validate commit messages in `.husky/commit-msg`,
|
|
22
|
+
- keep the rule set intentionally small,
|
|
23
|
+
- enforce a maximum header length of 72 characters,
|
|
24
|
+
- allow the existing fast `pre-commit` hook to stay focused on staged files.
|
|
25
|
+
|
|
26
|
+
## Consequences
|
|
27
|
+
|
|
28
|
+
- Contributors now need to use structured commit headers such as
|
|
29
|
+
`feat: add release workflow` or `docs: update quality workflow`.
|
|
30
|
+
- Invalid commit messages are rejected before the commit is created.
|
|
31
|
+
- The repository gains a cleaner history for release review and maintenance.
|
|
32
|
+
- If the project later needs custom commit types or scopes, the change should go
|
|
33
|
+
through `commitlint.config.mjs` and matching documentation updates.
|
|
34
|
+
|
|
35
|
+
## Alternatives considered
|
|
36
|
+
|
|
37
|
+
- Keeping commit messages informal
|
|
38
|
+
- Enforcing commit conventions only socially without a hook
|
|
39
|
+
- Adding heavier release automation before stabilizing the commit baseline
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Architecture Decision Records
|
|
2
|
+
|
|
3
|
+
This directory stores durable architectural and workflow decisions.
|
|
4
|
+
|
|
5
|
+
## When to write an ADR
|
|
6
|
+
|
|
7
|
+
Write an ADR when a change:
|
|
8
|
+
|
|
9
|
+
- changes repository structure,
|
|
10
|
+
- introduces or removes a subsystem,
|
|
11
|
+
- changes dependency sourcing or build tooling,
|
|
12
|
+
- changes public starter behavior in a lasting way,
|
|
13
|
+
- adds a new rule that future contributors must follow.
|
|
14
|
+
|
|
15
|
+
## Format
|
|
16
|
+
|
|
17
|
+
Use [`TEMPLATE.md`](./TEMPLATE.md). Every ADR must contain:
|
|
18
|
+
|
|
19
|
+
- Context
|
|
20
|
+
- Decision
|
|
21
|
+
- Consequences
|
|
22
|
+
- Alternatives considered
|
|
23
|
+
|
|
24
|
+
## Naming
|
|
25
|
+
|
|
26
|
+
- Prefix files with a four-digit sequence number.
|
|
27
|
+
- Use a short kebab-case slug.
|
|
28
|
+
- Never rewrite history silently; supersede older ADRs with new ones when decisions change.
|
|
29
|
+
|
|
30
|
+
## Current ADRs
|
|
31
|
+
|
|
32
|
+
- [`0001-keep-the-starter-minimal.md`](./0001-keep-the-starter-minimal.md)
|
|
33
|
+
- [`0002-adopt-a-living-meta-layer.md`](./0002-adopt-a-living-meta-layer.md)
|
|
34
|
+
- [`0003-normalize-kpa-plugin-output.md`](./0003-normalize-kpa-plugin-output.md)
|
|
35
|
+
- [`0004-adopt-an-automated-quality-baseline.md`](./0004-adopt-an-automated-quality-baseline.md)
|
|
36
|
+
- [`0005-adopt-a-tag-driven-release-baseline.md`](./0005-adopt-a-tag-driven-release-baseline.md)
|
|
37
|
+
- [`0006-adopt-commit-message-conventions.md`](./0006-adopt-commit-message-conventions.md)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# ADR XXXX: Title
|
|
2
|
+
|
|
3
|
+
## Context
|
|
4
|
+
|
|
5
|
+
Describe the situation, constraints, and forces that make a decision necessary.
|
|
6
|
+
|
|
7
|
+
## Decision
|
|
8
|
+
|
|
9
|
+
Describe the chosen approach in direct, testable language.
|
|
10
|
+
|
|
11
|
+
## Consequences
|
|
12
|
+
|
|
13
|
+
Explain the expected benefits, tradeoffs, and follow-up obligations.
|
|
14
|
+
|
|
15
|
+
## Alternatives considered
|
|
16
|
+
|
|
17
|
+
- Alternative 1
|
|
18
|
+
- Alternative 2
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Module Boundaries
|
|
2
|
+
|
|
3
|
+
## Repository boundary model
|
|
4
|
+
|
|
5
|
+
This repository is intentionally shallow. Its boundaries are designed to keep the starter easy to understand.
|
|
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, extra scripts, framework-specific behavior |
|
|
10
|
+
| `CHANGELOG.md` | Tagged release history | Release notes, versioned milestones | Unreleased planning notes or unrelated contributor guidance |
|
|
11
|
+
| `RELEASE.md` | Maintainer release procedure | `package.json`, `CHANGELOG.md`, GitHub workflows | Runtime code or undocumented branch conventions |
|
|
12
|
+
| `commitlint.config.mjs` | Commit message rules | Conventional commit policy | Source-code linting or release branching rules |
|
|
13
|
+
| `src/main.ts` | Application bootstrap and component registration | `@koppajs/koppajs-core`, local `.kpa` modules | UI business logic, ad hoc DOM manipulation, network code |
|
|
14
|
+
| `src/app-view.kpa` | Root page layout and composition | Local markup, local CSS, child components | Global bootstrap concerns, unrelated feature orchestration |
|
|
15
|
+
| `src/counter-component.kpa` | Example local state and interaction | Local markup, local methods, local CSS | Shared infrastructure, global state, direct root DOM coordination |
|
|
16
|
+
| `src/style.css` | Global reset and truly global base rules | Standard CSS | Component-specific visual rules |
|
|
17
|
+
| `public/` | Static assets served as-is | Static files only | Source code or generated artifacts |
|
|
18
|
+
| `tests/unit/` | Isolated tests for helper and tooling logic | Vitest, local modules | Full browser expectations or long integration chains |
|
|
19
|
+
| `tests/integration/` | Bootstrap and boundary-level integration tests | Vitest, local modules, selective mocks | Browser-only smoke assertions |
|
|
20
|
+
| `tests/e2e/` | Real-browser smoke coverage | Playwright, preview server | Implementation-detail assertions |
|
|
21
|
+
| `vite.config.mjs` | Build and dev server integration, including the `.kpa` module export compatibility wrapper | Vite and the KoppaJS Vite plugin | Application runtime logic |
|
|
22
|
+
| `vitest.config.mjs` | Vitest orchestration merged with the Vite config | Vitest and Vite config | Application runtime logic |
|
|
23
|
+
| `playwright.config.ts` | Playwright orchestration against preview output | Playwright and preview server script | Application runtime logic |
|
|
24
|
+
| `.github/workflows/release.yml` | Tag-triggered validation and GitHub Release creation | GitHub Actions, `package.json`, validation scripts | npm publishing while `package.json` is `private` |
|
|
25
|
+
| `tsconfig.json` | TypeScript compiler behavior for source, tests, and TS config files | TypeScript compiler options | Application runtime logic |
|
|
26
|
+
|
|
27
|
+
## Boundary rules
|
|
28
|
+
|
|
29
|
+
- Registration happens in `src/main.ts`, not inside component modules.
|
|
30
|
+
- `app-view.kpa` may compose child components but should not become a global state hub by accident.
|
|
31
|
+
- Component-local behavior stays inside the component until reuse or complexity makes extraction worthwhile.
|
|
32
|
+
- Shared logic, once introduced, belongs in dedicated `.ts` modules with tests when justified.
|
|
33
|
+
- Vitest owns helper-level and bootstrap-level confidence; Playwright owns browser smoke confidence.
|
|
34
|
+
- Pre-commit checks stay limited to staged-file hygiene. Heavy validation belongs to `pnpm validate` and CI.
|
|
35
|
+
- Commit-message validation lives in `.husky/commit-msg` and `commitlint.config.mjs`, not in ad hoc contributor lore.
|
|
36
|
+
- Release metadata stays aligned across `package.json`, `CHANGELOG.md`, `RELEASE.md`, and `.github/workflows/release.yml`.
|
|
37
|
+
|
|
38
|
+
## Escalation rules
|
|
39
|
+
|
|
40
|
+
Before crossing existing boundaries, add a spec and ADR if the change introduces:
|
|
41
|
+
|
|
42
|
+
- routing,
|
|
43
|
+
- shared state,
|
|
44
|
+
- async workflows,
|
|
45
|
+
- persistence,
|
|
46
|
+
- more than one root entrypoint,
|
|
47
|
+
- npm publishing or deployment automation,
|
|
48
|
+
- new top-level source folders.
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
+
- a subsystem such as routing or data fetching is introduced,
|
|
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
|
+
- Do commit message examples and hook behavior still match `commitlint.config.mjs`?
|
|
38
|
+
- Is any omitted tooling, such as Stylelint, still intentionally omitted for good reason?
|
|
39
|
+
|
|
40
|
+
If any answer is "no", update the meta layer before considering the repository aligned.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Quality Gates
|
|
2
|
+
|
|
3
|
+
## Baseline gates
|
|
4
|
+
|
|
5
|
+
For the current repository scope, the baseline gates are:
|
|
6
|
+
|
|
7
|
+
- staged files: `lint-staged` via `.husky/pre-commit`
|
|
8
|
+
- commit messages: `commitlint` via `.husky/commit-msg`
|
|
9
|
+
- fast local repository check: `pnpm check`
|
|
10
|
+
- full repository validation: `pnpm validate`
|
|
11
|
+
- release candidate verification: `pnpm release:check`
|
|
12
|
+
- `pnpm typecheck`
|
|
13
|
+
- `pnpm build`
|
|
14
|
+
- `pnpm test:run`
|
|
15
|
+
- `pnpm test:e2e` for UI, bootstrap, or preview-sensitive changes
|
|
16
|
+
- tagged release automation: `.github/workflows/release.yml` reruns validation and checks tag/version alignment
|
|
17
|
+
|
|
18
|
+
## Gate escalation rules
|
|
19
|
+
|
|
20
|
+
Raise the quality bar when the repository grows:
|
|
21
|
+
|
|
22
|
+
- New extracted logic modules: add unit tests.
|
|
23
|
+
- Multi-component behavior: add integration or component tests.
|
|
24
|
+
- Routing, async workflows, persistence, or deployment-sensitive behavior: expand end-to-end coverage beyond the current smoke scope.
|
|
25
|
+
- If component-local `.kpa` styling grows more complex and a credible linting path appears, revisit the current decision to omit Stylelint.
|
|
26
|
+
|
|
27
|
+
## Review checklist
|
|
28
|
+
|
|
29
|
+
- Do setup instructions still work from a clean checkout?
|
|
30
|
+
- Does the documented architecture still match the code layout?
|
|
31
|
+
- Do specs still match observable behavior?
|
|
32
|
+
- Are current quality gates enough for the newest change?
|
|
33
|
+
- Do `CHANGELOG.md`, `RELEASE.md`, and the release workflow still agree on the release path?
|
|
34
|
+
- Do commit message rules and contributor examples still match `commitlint.config.mjs`?
|
|
35
|
+
- Are hooks still fast enough to help rather than hinder contributors?
|
|
36
|
+
|
|
37
|
+
## Ownership rule
|
|
38
|
+
|
|
39
|
+
Anyone changing code, tooling, or workflow is responsible for updating the quality gates if the risk profile changes.
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
## Required structure
|
|
15
|
+
|
|
16
|
+
Use [`TEMPLATE.md`](./TEMPLATE.md). Each spec should define:
|
|
17
|
+
|
|
18
|
+
- purpose
|
|
19
|
+
- behavior
|
|
20
|
+
- inputs
|
|
21
|
+
- outputs
|
|
22
|
+
- constraints
|
|
23
|
+
- edge cases
|
|
24
|
+
- acceptance criteria
|
|
25
|
+
|
|
26
|
+
## Lifecycle
|
|
27
|
+
|
|
28
|
+
- Draft or update the relevant spec before implementing a non-trivial change.
|
|
29
|
+
- Keep the spec narrow and testable.
|
|
30
|
+
- If implementation diverges from the spec, reconcile them immediately.
|
|
31
|
+
|
|
32
|
+
## Current specs
|
|
33
|
+
|
|
34
|
+
- [`app-bootstrap.md`](./app-bootstrap.md)
|
|
35
|
+
- [`counter-component.md`](./counter-component.md)
|
|
36
|
+
- [`quality-workflow.md`](./quality-workflow.md)
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Spec: Title
|
|
2
|
+
|
|
3
|
+
## Status
|
|
4
|
+
|
|
5
|
+
Draft | Approved | Superseded
|
|
6
|
+
|
|
7
|
+
## Purpose
|
|
8
|
+
|
|
9
|
+
Describe why this behavior exists.
|
|
10
|
+
|
|
11
|
+
## Behavior
|
|
12
|
+
|
|
13
|
+
Describe the observable behavior.
|
|
14
|
+
|
|
15
|
+
## Inputs
|
|
16
|
+
|
|
17
|
+
Describe user, system, or configuration inputs.
|
|
18
|
+
|
|
19
|
+
## Outputs
|
|
20
|
+
|
|
21
|
+
Describe rendered output, state changes, or side effects.
|
|
22
|
+
|
|
23
|
+
## Constraints
|
|
24
|
+
|
|
25
|
+
List constraints that implementation must respect.
|
|
26
|
+
|
|
27
|
+
## Edge cases
|
|
28
|
+
|
|
29
|
+
List the important boundary conditions.
|
|
30
|
+
|
|
31
|
+
## Acceptance criteria
|
|
32
|
+
|
|
33
|
+
- Criterion 1
|
|
34
|
+
- Criterion 2
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Spec: App bootstrap
|
|
2
|
+
|
|
3
|
+
## Status
|
|
4
|
+
|
|
5
|
+
Approved
|
|
6
|
+
|
|
7
|
+
## Purpose
|
|
8
|
+
|
|
9
|
+
Provide a predictable, minimal startup path for a standalone KoppaJS application.
|
|
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` and `counter-component` with KoppaJS Core.
|
|
17
|
+
- `src/main.ts` invokes `Core()` once to bootstrap the application.
|
|
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 registered `<counter-component>` available to the root view
|
|
28
|
+
|
|
29
|
+
## Constraints
|
|
30
|
+
|
|
31
|
+
- There must be a single bootstrap entrypoint.
|
|
32
|
+
- The root tag in `index.html` must stay aligned with the component registered in `src/main.ts`.
|
|
33
|
+
- No hidden self-registration inside component modules.
|
|
34
|
+
- Bootstrap must rely on the public KoppaJS root API via `Core()` rather than non-public setup helpers.
|
|
35
|
+
- No extra runtime dependencies are required beyond the declared npm packages.
|
|
36
|
+
|
|
37
|
+
## Edge cases
|
|
38
|
+
|
|
39
|
+
- If a component tag changes, both `index.html` and `src/main.ts` must be updated together.
|
|
40
|
+
- If more bootstrap behavior is added, it must not introduce a second source of truth for initialization.
|
|
41
|
+
|
|
42
|
+
## Acceptance criteria
|
|
43
|
+
|
|
44
|
+
- Opening the app through Vite renders the root view without manual DOM scripting.
|
|
45
|
+
- `src/main.ts` remains the only location that calls `Core()`.
|
|
46
|
+
- The root view can render the counter component immediately after bootstrap.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Spec: Counter component
|
|
2
|
+
|
|
3
|
+
## Status
|
|
4
|
+
|
|
5
|
+
Approved
|
|
6
|
+
|
|
7
|
+
## Purpose
|
|
8
|
+
|
|
9
|
+
Demonstrate local interactive state in a minimal KoppaJS component.
|
|
10
|
+
|
|
11
|
+
## Behavior
|
|
12
|
+
|
|
13
|
+
- The component renders a "Counter" label, a numeric count, and increment/decrement buttons.
|
|
14
|
+
- The initial count is `0`.
|
|
15
|
+
- Clicking the increment button increases the count by `1`.
|
|
16
|
+
- Clicking the decrement button decreases the count by `1`.
|
|
17
|
+
- The displayed count updates immediately after each click.
|
|
18
|
+
- The increment and decrement buttons expose stable accessible names.
|
|
19
|
+
- The rendered count is announced politely to assistive technology when it changes.
|
|
20
|
+
|
|
21
|
+
## Inputs
|
|
22
|
+
|
|
23
|
+
- User clicks on the increment button
|
|
24
|
+
- User clicks on the decrement button
|
|
25
|
+
|
|
26
|
+
## Outputs
|
|
27
|
+
|
|
28
|
+
- Updated numeric text rendered in the component
|
|
29
|
+
- No external side effects
|
|
30
|
+
|
|
31
|
+
## Constraints
|
|
32
|
+
|
|
33
|
+
- State is local to the component.
|
|
34
|
+
- The component performs no persistence, networking, or cross-component coordination.
|
|
35
|
+
- The component remains embeddable inside the root app shell.
|
|
36
|
+
|
|
37
|
+
## Edge cases
|
|
38
|
+
|
|
39
|
+
- Negative values are allowed.
|
|
40
|
+
- Repeated clicks continue to update the count linearly within normal JavaScript number behavior.
|
|
41
|
+
|
|
42
|
+
## Acceptance criteria
|
|
43
|
+
|
|
44
|
+
- The counter is visible inside the app shell when the starter loads.
|
|
45
|
+
- The first rendered value is `0`.
|
|
46
|
+
- A single click on `+` changes the value from `0` to `1`.
|
|
47
|
+
- A single click on `-` changes the value from `0` to `-1`.
|
|
48
|
+
- Assistive technology can distinguish the increment and decrement actions without relying on symbol glyphs alone.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Spec: Quality workflow
|
|
2
|
+
|
|
3
|
+
## Status
|
|
4
|
+
|
|
5
|
+
Approved
|
|
6
|
+
|
|
7
|
+
## Purpose
|
|
8
|
+
|
|
9
|
+
Keep the starter's tooling, tests, and contributor workflow consistent enough that regressions are caught early without turning a minimal example into a heavyweight platform.
|
|
10
|
+
|
|
11
|
+
## Behavior
|
|
12
|
+
|
|
13
|
+
- The repository exposes a fast local validation path through `pnpm check`.
|
|
14
|
+
- The repository exposes a fuller validation path through `pnpm validate`, which adds a real-browser smoke test.
|
|
15
|
+
- Staged files run through a fast `lint-staged` pre-commit hook.
|
|
16
|
+
- Commit messages are validated by `commitlint` in a `commit-msg` hook.
|
|
17
|
+
- Source, config, and test changes are checked by ESLint, Prettier, TypeScript, and Vitest.
|
|
18
|
+
- The real UI smoke path is checked by Playwright against `vite preview`.
|
|
19
|
+
- CI runs the same full validation flow as local contributors.
|
|
20
|
+
- Tagged releases rerun the full validation flow and verify tag/version alignment before a GitHub Release is created.
|
|
21
|
+
- Stylelint is intentionally absent until the repository has a credible way to lint embedded `.kpa` CSS without covering only the least relevant styling surface.
|
|
22
|
+
|
|
23
|
+
## Inputs
|
|
24
|
+
|
|
25
|
+
- Source, config, test, and documentation changes
|
|
26
|
+
- Staged files at commit time
|
|
27
|
+
- Commit messages at commit time
|
|
28
|
+
- Pull requests and pushes that trigger CI
|
|
29
|
+
- Version, changelog, and tag pushes that trigger the release workflow
|
|
30
|
+
|
|
31
|
+
## Outputs
|
|
32
|
+
|
|
33
|
+
- Consistent formatting on supported file types
|
|
34
|
+
- Conventional commit history for maintainable review and release preparation
|
|
35
|
+
- Type-safe source and TypeScript tooling files
|
|
36
|
+
- Automated confidence for the `.kpa` export workaround, bootstrap wiring, and the starter UI smoke path
|
|
37
|
+
- A guarded GitHub release path that fails when the pushed tag does not match `package.json`
|
|
38
|
+
- Fast feedback before commit and in CI
|
|
39
|
+
|
|
40
|
+
## Constraints
|
|
41
|
+
|
|
42
|
+
- Hooks must stay fast enough for normal local use.
|
|
43
|
+
- Playwright coverage must remain focused on smoke-level user journeys until the UI surface grows.
|
|
44
|
+
- Tooling should stay aligned with the starter's actual risk profile rather than generic best-practice checklists.
|
|
45
|
+
- Release automation must stay consistent with the repository remaining `private`; it may create GitHub Releases but must not imply npm publishing.
|
|
46
|
+
- Commit rules should stay simple enough that contributors can apply them without release tooling knowledge.
|
|
47
|
+
|
|
48
|
+
## Edge cases
|
|
49
|
+
|
|
50
|
+
- If browser binaries are not installed locally, contributors must install Chromium before running `pnpm test:e2e` or `pnpm validate`.
|
|
51
|
+
- If Stylelint is introduced later, it must cover the meaningful styling surface rather than only `src/style.css`.
|
|
52
|
+
- If the UI grows beyond a simple smoke surface, expand Playwright coverage deliberately and update this spec.
|
|
53
|
+
- If a pushed tag does not match `package.json`, the release workflow must fail before creating a release artifact.
|
|
54
|
+
- Auto-generated merge, revert, `fixup!`, and `squash!` commits may be exempted by the hook logic.
|
|
55
|
+
|
|
56
|
+
## Acceptance criteria
|
|
57
|
+
|
|
58
|
+
- `pnpm check` runs lint, format verification, type checking, Vitest, and build successfully on a clean checkout.
|
|
59
|
+
- `pnpm validate` reuses the built output to run the Playwright smoke test successfully.
|
|
60
|
+
- A commit with a staged lint or formatting error is blocked by the pre-commit hook.
|
|
61
|
+
- A non-conventional commit message is blocked by the `commit-msg` hook.
|
|
62
|
+
- A pushed `vX.Y.Z` tag is rejected by release automation when `package.json` contains a different version.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import js from "@eslint/js";
|
|
2
|
+
import globals from "globals";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import tseslint from "typescript-eslint";
|
|
5
|
+
|
|
6
|
+
const tsconfigRootDir = fileURLToPath(new URL(".", import.meta.url));
|
|
7
|
+
|
|
8
|
+
export default tseslint.config(
|
|
9
|
+
{
|
|
10
|
+
ignores: [
|
|
11
|
+
".ai/**",
|
|
12
|
+
"coverage/**",
|
|
13
|
+
"dist/**",
|
|
14
|
+
"node_modules/**",
|
|
15
|
+
"playwright-report/**",
|
|
16
|
+
"test-results/**",
|
|
17
|
+
],
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
files: ["**/*.{js,mjs,cjs}"],
|
|
21
|
+
extends: [js.configs.recommended],
|
|
22
|
+
languageOptions: {
|
|
23
|
+
globals: {
|
|
24
|
+
...globals.node,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
files: ["**/*.{ts,mts,cts}"],
|
|
30
|
+
extends: [...tseslint.configs.recommendedTypeChecked],
|
|
31
|
+
languageOptions: {
|
|
32
|
+
parserOptions: {
|
|
33
|
+
projectService: true,
|
|
34
|
+
tsconfigRootDir,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
files: ["src/**/*.ts"],
|
|
40
|
+
languageOptions: {
|
|
41
|
+
globals: {
|
|
42
|
+
...globals.browser,
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
files: ["tests/**/*.ts", "*.config.ts"],
|
|
48
|
+
languageOptions: {
|
|
49
|
+
globals: {
|
|
50
|
+
...globals.node,
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
);
|
package/template/package.json
CHANGED
|
@@ -1,21 +1,72 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "
|
|
2
|
+
"name": "__PROJECT_NAME__",
|
|
3
3
|
"version": "1.0.0",
|
|
4
4
|
"private": true,
|
|
5
|
-
"description": "
|
|
5
|
+
"description": "KoppaJS application scaffolded with create-koppajs.",
|
|
6
6
|
"author": "Bastian Bensch",
|
|
7
7
|
"license": "Apache-2.0",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"koppajs",
|
|
10
|
+
"koppa",
|
|
11
|
+
"starter",
|
|
12
|
+
"scaffold",
|
|
13
|
+
"vite",
|
|
14
|
+
"typescript",
|
|
15
|
+
"web-components"
|
|
16
|
+
],
|
|
17
|
+
"packageManager": "pnpm@10.12.1",
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": "^20.19.0 || ^22.13.0 || >=24.0.0",
|
|
20
|
+
"pnpm": ">=10"
|
|
21
|
+
},
|
|
8
22
|
"scripts": {
|
|
9
23
|
"dev": "vite --host",
|
|
10
|
-
"build": "tsc && vite build",
|
|
11
|
-
"
|
|
24
|
+
"build": "tsc --noEmit && vite build",
|
|
25
|
+
"lint": "eslint .",
|
|
26
|
+
"lint:fix": "eslint . --fix",
|
|
27
|
+
"format": "prettier . --write --ignore-unknown",
|
|
28
|
+
"format:check": "prettier . --check --ignore-unknown",
|
|
29
|
+
"test": "vitest run",
|
|
30
|
+
"test:watch": "vitest",
|
|
31
|
+
"test:run": "vitest run",
|
|
32
|
+
"test:coverage": "vitest run --coverage",
|
|
33
|
+
"test:e2e": "pnpm build && playwright test",
|
|
34
|
+
"test:e2e:headed": "pnpm build && playwright test --headed",
|
|
35
|
+
"test:e2e:ui": "pnpm build && playwright test --ui",
|
|
36
|
+
"check": "pnpm lint && pnpm format:check && pnpm typecheck && pnpm test:run && pnpm build",
|
|
37
|
+
"validate": "pnpm check && playwright test",
|
|
38
|
+
"release:check": "pnpm validate",
|
|
39
|
+
"typecheck": "tsc --noEmit",
|
|
40
|
+
"serve": "vite preview",
|
|
41
|
+
"serve:e2e": "vite preview --host 127.0.0.1 --strictPort --port 4173",
|
|
42
|
+
"prepare": "husky"
|
|
12
43
|
},
|
|
13
44
|
"dependencies": {
|
|
14
|
-
"@koppajs/koppajs-core": "^3.0.
|
|
45
|
+
"@koppajs/koppajs-core": "^3.0.2"
|
|
15
46
|
},
|
|
16
47
|
"devDependencies": {
|
|
48
|
+
"@commitlint/cli": "^20.1.0",
|
|
49
|
+
"@commitlint/config-conventional": "^20.0.0",
|
|
50
|
+
"@eslint/js": "^10.0.1",
|
|
17
51
|
"@koppajs/koppajs-vite-plugin": "^1.0.0",
|
|
52
|
+
"@playwright/test": "^1.58.2",
|
|
53
|
+
"@types/node": "^25.4.0",
|
|
54
|
+
"@vitest/coverage-v8": "^4.0.18",
|
|
55
|
+
"eslint": "^10.0.3",
|
|
56
|
+
"globals": "^17.4.0",
|
|
57
|
+
"husky": "^9.1.7",
|
|
58
|
+
"lint-staged": "^16.3.3",
|
|
59
|
+
"prettier": "^3.8.1",
|
|
18
60
|
"typescript": "^5.9.3",
|
|
19
|
-
"
|
|
61
|
+
"typescript-eslint": "^8.57.0",
|
|
62
|
+
"vite": "7.2.6",
|
|
63
|
+
"vitest": "^4.0.18"
|
|
64
|
+
},
|
|
65
|
+
"lint-staged": {
|
|
66
|
+
"*.{js,mjs,cjs,ts,mts,cts}": [
|
|
67
|
+
"eslint --fix",
|
|
68
|
+
"prettier --write"
|
|
69
|
+
],
|
|
70
|
+
"*.{css,html,json,md,yml,yaml}": "prettier --write"
|
|
20
71
|
}
|
|
21
72
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { defineConfig, devices } from "@playwright/test";
|
|
2
|
+
|
|
3
|
+
const port = 4173;
|
|
4
|
+
|
|
5
|
+
export default defineConfig({
|
|
6
|
+
testDir: "./tests/e2e",
|
|
7
|
+
fullyParallel: true,
|
|
8
|
+
forbidOnly: Boolean(process.env.CI),
|
|
9
|
+
retries: process.env.CI ? 2 : 0,
|
|
10
|
+
reporter: process.env.CI ? "github" : "list",
|
|
11
|
+
use: {
|
|
12
|
+
baseURL: `http://127.0.0.1:${port}`,
|
|
13
|
+
screenshot: "only-on-failure",
|
|
14
|
+
trace: "on-first-retry",
|
|
15
|
+
video: "retain-on-failure",
|
|
16
|
+
},
|
|
17
|
+
webServer: {
|
|
18
|
+
command: "pnpm serve:e2e",
|
|
19
|
+
url: `http://127.0.0.1:${port}`,
|
|
20
|
+
reuseExistingServer: !process.env.CI,
|
|
21
|
+
timeout: 120_000,
|
|
22
|
+
},
|
|
23
|
+
projects: [
|
|
24
|
+
{
|
|
25
|
+
name: "chromium",
|
|
26
|
+
use: {
|
|
27
|
+
...devices["Desktop Chrome"],
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
});
|