Load editor examples from ComlineProject/examples - #46
Merged
Conversation
Drops the inline `SAMPLE_FILES` string. `comline-examples` (github:ComlineProject/examples) is a git dependency of real `.ids` projects — chat, key/value, gateway, telemetry — bundled to one JSON in its `prepare`/`prepack`. `import examples from "comline-examples"`. - an **Examples** `<select>` in the header swaps the whole file set; it confirms first if you've edited (`dirty` flag on `onDocChanged`). - a fresh visit opens `examples[0]` (chat), same as before. - `src/examples.test.ts` compiles every example against this build's editor wasm, so `comline-core` drift is caught here. `tsconfig.json` gains `resolveJsonModule`; the test glob widens to `src/**`. 24 tests pass (20 sim + 4 examples); `yarn build` green.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces the single inline
SAMPLE_FILESschema with a set of real,compilable example projects served from a new repo.
ComlineProject/examplesA git dependency —
.idsprojects, each a directory with ameta.json(
title/blurb/entry/order) and its files.bundle.mjs(run inprepare/prepack, pure Node, no toolchain) walks them into oneexamples.json; only that file ships (filesin itspackage.json).Four to start: chat (the old sample), key/value (a failable read +
writes), gateway (two protocols, for the forward-behaviour demo),
telemetry (fan-in over datagram, for the fault sliders). All verified
to compile against the current editor wasm.
Playground
import examples from "comline-examples"— no schema strings inmain.ts.<select>swaps the whole file set; confirms firstif you've made edits (
dirty, set ononDocChanged).examples[0](chat) — unchanged behaviour.src/examples.test.ts: every example compiles with zero diagnosticsagainst this build's wasm, so
comline-coregrammar drift fails CIhere.
resolveJsonModuleadded; test glob →src/**..yarnrc.ymlallows the new git repo; Yarn's cache holds the builtarchive so
yarn installdoesn't re-run the bundle unless the SHA moves.24 tests pass (20 sim + 4 examples),
yarn buildgreen.Depends on ComlineProject/examples existing (it does — pinned at
f638949). To add/edit an example: PR that repo, then bump the SHA here.