Skip to content

Reference exp_roles and exp_groups from the exp_scenario build - #473

Merged
Cooldude2606 merged 2 commits into
explosivegaming:mainfrom
bbassie:fix/scenario-project-references
Sep 9, 2026
Merged

Reference exp_roles and exp_groups from the exp_scenario build#473
Cooldude2606 merged 2 commits into
explosivegaming:mainfrom
bbassie:fix/scenario-project-references

Conversation

@bbassie

@bbassie bbassie commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Since #457 exp_scenario imports types from @expcluster/roles and @expcluster/permission-groups. Their declaration files only exist once the two packages have been built, so building exp_scenario before them fails with TS2307: Cannot find module '@expcluster/roles/dist/node/controller' and four more like it. A plain pnpm install gets away with it because pnpm runs the prepare scripts in dependency order, but a filtered install, or tsc --build inside exp_scenario on a fresh clone, hits the error.

Two commits:

  1. Project references from exp_scenario's node tsconfig to the node tsconfigs of exp_roles and exp_groups, the same way the core clusterio plugins reference packages/lib. tsc --build now builds those two first when they are out of date.
  2. exp_roles and exp_groups re-export their messages and the ControllerPlugin type from the package index, so exp_scenario imports from "@expcluster/roles" instead of from "@expcluster/roles/dist/node/messages". The controller export is type only, so nothing from @clusterio/controller ends up in the web bundle (checked the emitted index chunk). The test keeps the deep require for the controller classes since those cannot be re-exported at runtime.

Verified by deleting every dist folder and running tsc --build in exp_scenario alone, then at the repo root, plus webpack for all three packages and the roles and scenario tap suites.

🤖 Generated with Claude Code

bbassie and others added 2 commits September 9, 2026 16:58
exp_scenario imports types from @expcluster/roles and
@expcluster/permission-groups through their dist folders, so building it
on its own before those packages are built fails with TS2307. A plain
pnpm install runs the prepare scripts in dependency order, but a filtered
install or running tsc --build in exp_scenario on a fresh clone does not.
Referencing the node projects of both packages makes tsc build them first.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
exp_scenario reached into @expcluster/roles/dist/node/* for the message
classes and the controller plugin type. The package index now re-exports
messages and the ControllerPlugin type, so consumers import from the
package name like they do with @clusterio/lib. The controller export is
type only, which keeps node code out of the web bundle. The test still
requires the controller classes from dist since they cannot be
re-exported at runtime.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

@Cooldude2606 Cooldude2606 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We cannot export the plugins from the index file as this prevents it being loaded into other contexts which are not "standalone".

@Cooldude2606 Cooldude2606 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nvm I failed to see that it was type export only. LGTM.

@Cooldude2606
Cooldude2606 merged commit 910285e into explosivegaming:main Sep 9, 2026
2 checks passed
Cooldude2606 pushed a commit that referenced this pull request Sep 11, 2026
The packages use workspace:^ and catalog: versions, so they only
resolve inside a clusterio checkout with this repository under
external_plugins. The workflow clones clusterio master, checks this
repository out into external_plugins/ExpCluster, runs pnpm install
(which runs every prepare script), then runs the tap suites.

A last step wipes dist and runs tsc --build in each package on its own.
pnpm install builds packages in dependency order, which is why the
missing project references fixed in #473 went unnoticed. On the tree
before #473 this step fails with the same five TS2307 errors.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.

2 participants