Skip to content

Commit 5f831b6

Browse files
refactor: more modular. (#9)
* test: add specs before refactor.
1 parent 8c0c5f6 commit 5f831b6

20 files changed

Lines changed: 2993 additions & 2383 deletions

docs/build-and-deploy.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
This project uses two runtime modes:
44

55
- Local development mode: dynamic CDN resolution from `src/cdn.js` with esm.sh as default.
6-
- Production mode: JSPM-generated import map injected into `dist/index.html` and hosted on GitHub Pages.
6+
- Production mode: CDN-first build artifacts in `dist`, with `build:esm` as the current preferred deploy build.
77

88
## Local Development
99

@@ -51,8 +51,8 @@ npm run build:importmap-mode
5151

5252
Mode notes:
5353

54-
- `importMap`: Preferred production mode when JSPM has indexed the required graph.
55-
- `esm`: Stable fallback mode while waiting on JSPM indexing.
54+
- `importMap`: Import-map mode when JSPM has indexed the required graph.
55+
- `esm`: Current preferred deploy build mode.
5656
- `jspmGa`: Direct ga.jspm.io URL mode without import-map generation.
5757

5858
This runs two steps:
@@ -80,6 +80,14 @@ Preview the built site locally:
8080
npm run preview
8181
```
8282

83+
End-to-end tests run against a preview build by default:
84+
85+
```sh
86+
npm run test:e2e
87+
```
88+
89+
This command builds with `build:esm` first, then runs Playwright against the preview server.
90+
8391
## CI And Deployment
8492

8593
- CI workflow (`.github/workflows/ci.yml`) installs dependencies, runs lint, and runs `npm run build`.
@@ -91,7 +99,7 @@ Related docs:
9199

92100
- `docs/code-mirror.md` for CodeMirror CDN integration rules, fallback behavior, and validation checklist.
93101

94-
- In production, the preferred/default mode is import-map-based resolution (`window.__KNIGHTED_PRIMARY_CDN__ = "importMap"`).
102+
- In production, the current preferred deploy mode is ESM resolution (`window.__KNIGHTED_PRIMARY_CDN__ = "esm"`).
95103
- In `importMap` mode, runtime resolution is import-map first; if a specifier is missing from the generated map, runtime falls back through the CDN
96104
provider chain configured in `src/cdn.js`.
97105
- In `esm` and `jspmGa` modes, runtime resolution is handled entirely by the CDN provider chain configured in `src/cdn.js` without an import map.

docs/next-steps.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,10 @@ Focused follow-up work for `@knighted/develop`.
1515
- Prefer CDN-delivered tooling where possible and preserve graceful fallback behavior when unavailable.
1616

1717
4. **In-browser component type checking**
18-
- Explore TypeScript/JSX type checking for component source in-browser using CDN-delivered tooling.
19-
- Keep diagnostics responsive and surface clear inline/editor feedback without blocking the preview loop.
18+
- Add editor-linked diagnostics navigation so each issue can jump to the exact line/column in the component source.
19+
- Surface line/column context directly in the diagnostics UI (not just message text) to speed up triage.
20+
- Continue improving typecheck performance for first-run and large sources while keeping the preview loop non-blocking.
2021

2122
5. **In-browser component testing**
2223
- Explore authoring and running component-focused tests in-browser (for example, a Vitest-compatible flow) using CDN-delivered tooling.
2324
- Define a lightweight test UX that supports writing tests, running them on demand, and displaying results in-app.
24-
25-
6. **App runtime modularization**
26-
- Plan a refactor that splits `src/app.js` into scoped modules organized by functionality (for example: diagnostics, render pipeline, editor integration, UI controls, and persistence).
27-
- Preserve `src/app.js` as the main runtime orchestration entrypoint while moving implementation details into focused modules.
28-
- Split stylesheet concerns into focused files (for example: layout/shell, panel controls, diagnostics, editor overrides, dialogs/overlays) while keeping `src/styles.css` as the single entrypoint via ordered `@import` directives.
29-
- Define clear module boundaries and shared interfaces so behavior stays stable while maintainability and readability improve.

package-lock.json

Lines changed: 274 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)