Skip to content

ecs-architecture: nested features, plugins and entries, with the samples restructured; a virtual list in the todo sample; pnpm 11 - #279

Merged
krisnye merged 4 commits into
mainfrom
ecs-todo-virtual-list
Nov 18, 2026

Conversation

@krisnye

@krisnye krisnye commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

This PR does three things:

  1. It reworks @adobe/ecs-architecture's standard and checker so an app's folder tree shows what each part is and what it builds on.
  2. It restructures the five samples to follow it.
  3. It adds a virtual list to the todo sample and moves both pnpm workspaces to pnpm 11.

The architecture standard (ecs/packages/ecs-architecture)

Folders

  • src/ is the root feature. Its layers (elements, model, ports, view) hold the foundation: infrastructure or data that isn't a subject of its own.
  • Every subject the app is about is a feature under features/, even when it's the only one.
  • A sub-feature nests in its parent's features/ when it builds on the parent's layers. A parent imports its own sub-features only in its plugins and indexes, to aggregate them, so its users take the whole subtree as one unit.
  • Every folder name says what it is: a layer, features/ or test/.

Public and private

  • A layer's root holds only public declarations, one export per file.
  • What only one declaration uses is its part. By default it's unexported in that declaration's file. It moves to a folder named for the declaration (plugin.todos-view/, function.frame/) only when a test reaches it or the file passes 400 lines (checked).
  • internal/ holds only what several public declarations use (checked).

Plugins, entries and the app

  • A layer whose systems the app adds together exports one plugin, plugin.<feature>-<layer>.ts, which lists them. There are no constant.systems.ts files any more.
  • The app is features/main. Entries, entry.<name>.ts, are the only modules that run code as they load: the page script, worker scripts and node scripts.

Tests

  • A test sits beside the file it tests and exports nothing.
  • What several tests share is a test feature, in the test/ of the lowest feature whose tests share it.
  • There are no *.test-helper.ts files.
  • A test import never counts as a use, so tests never widen a public interface.

Other changes

  • Modifiers before the kind are free-form, for the app's own grouping, e.g. persistent.component.done.ts.
  • Removed: the generated ARCHITECTURE.md diagrams, app folders found by name, and the systems and apps settings.

New checks: entries, runs-on-load, plugin naming, parts-reach, internal-single-use, file-too-long, test-exports, test-helper, parent-imports-sub-feature and the nested folder layout.

The standard, the agent rules and the guide are updated, and the repo's agent files are regenerated.

@adobe/ecs

Plugin.start adds nothing for plugins that have no systems, so it now works on a joined world, which can only add readonly systems. Its config argument may be left out when no plugin asks for one.

The samples

  • todo
    • The DOM helpers, the root resource and <virtual-list> are the root's foundation.
    • todos holds filter, completion and generate as sub-features, and todosView composes their plugins.
  • benchmark
    • The shared entity data is the root's model; cpu, gpu and main are features.
    • The reference implementation is a test feature of cpu.
  • particles, transfers, gpu-views: each has its subjects as features and an entry-started main. Their workers start from entries, and their build tests read Vite's manifest instead of matching file names.

Todo sample: a virtual list

The todo list now keeps only the rows in view, plus half a screen above and below, about 30 rows for 10,000 todos. Its new <virtual-list> element knows nothing of the ECS. It reuses rows that scroll out for those that scroll in, keeps the focused row, and asks the world for a new range only near its edges. At 10K todos, filtering half the todos (laid out) went from 17 ms to 1 ms, and creating and laying out all rows went from ~135 ms to ~9 ms.

pnpm 11

Both workspaces pin pnpm@11.28.12 through packageManager. Overrides moved into pnpm-workspace.yaml, the lockfiles are regenerated, and CI takes its pnpm version from packageManager.

Versions

  • @adobe/ecs 0.5.1 → 0.5.2: the Plugin.start fix.
  • @adobe/ecs-architecture 0.4.0 → 0.5.0: breaking, since apps, systems and diagrams are removed and the layout is new.
  • No @adobe/data package changed. The samples are private, so the repo doesn't bump them.

Verification

Locally:

  • All six packages typecheck and pass ecs-architecture check.
  • Their tests pass: architecture 120, todo 74, benchmark 53, particles 4, transfers 3, gpu-views 3.
  • ecs-sample-browser runs every sample in a real browser, 13/13.
  • ecs-guide's node tests pass, 44/44.

…pace.yaml, lockfiles regenerated, CI from packageManager
…he samples follow

The standard and its checker:
- src/ is the root feature: its layers hold the foundation, subjects are features in features/, sub-features
  nest inside what they build on, and a parent uses its sub-features only to aggregate them in its plugins
  and indexes; test features sit in the test/ of the lowest feature whose tests share them.
- A layer's systems are listed by its one plugin, plugin.<feature>-<layer>.ts; the app is features/main,
  started by entries, entry.<name>.ts, the only modules that run code as they load.
- A declaration's private parts are unexported in its file, or in a folder named for it when a test
  reaches them or the file passes 400 lines; internal/ holds only what several public declarations use.
- One export per file everywhere: tests export nothing, and there are no test helper files; tests never
  make an export public.
- Free-form modifiers before the kind (persistent.component.done.ts); diagrams and app folders removed.

@adobe/ecs: Plugin.start adds nothing for plugins without systems, so it starts on joined worlds, and
takes no config when no plugin asks for one.

The todo, particles, transfers, gpu-views and benchmark samples are restructured to the standard.
@krisnye krisnye changed the title ecs-todo-vanillajs: a virtual list, keeping only the rows near the view in the DOM ecs-architecture: nested features, plugins and entries, with the samples restructured; a virtual list in the todo sample; pnpm 11 Nov 18, 2026
…) and @adobe/ecs-architecture 0.5.0 (nested features, plugins, entries)
@krisnye
krisnye merged commit 08e102b into main Nov 18, 2026
3 checks passed
@krisnye
krisnye deleted the ecs-todo-virtual-list branch November 18, 2026 06:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant