From 3a9155697afdc038277a7fa8eb9121e028321aa3 Mon Sep 17 00:00:00 2001 From: bbassie <17990055+bbassie@users.noreply.github.com> Date: Wed, 9 Sep 2026 16:58:09 +0000 Subject: [PATCH 1/2] Reference exp_roles and exp_groups from the exp_scenario build 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 --- exp_scenario/tsconfig.node.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/exp_scenario/tsconfig.node.json b/exp_scenario/tsconfig.node.json index 3218f2e7..f3a03479 100644 --- a/exp_scenario/tsconfig.node.json +++ b/exp_scenario/tsconfig.node.json @@ -1,5 +1,9 @@ { "extends": "../tsconfig.node.json", + "references": [ + { "path": "../exp_groups/tsconfig.node.json" }, + { "path": "../exp_roles/tsconfig.node.json" }, + ], "include": ["./**/*.ts"], "exclude": ["test/*", "./dist/*"], } From 51786c5df90465c7aba4bd4f0069d8516dc2a468 Mon Sep 17 00:00:00 2001 From: bbassie <17990055+bbassie@users.noreply.github.com> Date: Wed, 9 Sep 2026 17:31:31 +0000 Subject: [PATCH 2/2] Export messages and controller types from exp_roles and exp_groups 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 --- exp_groups/index.ts | 3 +++ exp_roles/index.ts | 3 +++ exp_scenario/controller.ts | 8 ++++---- exp_scenario/seed.ts | 2 +- exp_scenario/test/controller.test.js | 6 +++--- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/exp_groups/index.ts b/exp_groups/index.ts index 524ac7d9..743f33b9 100644 --- a/exp_groups/index.ts +++ b/exp_groups/index.ts @@ -1,6 +1,9 @@ import * as lib from "@clusterio/lib"; import * as messages from "./messages"; +export * from "./messages"; +export type { ControllerPlugin } from "./controller"; + declare module "@clusterio/lib" { export interface InstanceConfigFields { "exp_groups.sync_mode": "enabled" | "disabled" | "bidirectional" diff --git a/exp_roles/index.ts b/exp_roles/index.ts index e3cb4093..e481fc8f 100644 --- a/exp_roles/index.ts +++ b/exp_roles/index.ts @@ -1,6 +1,9 @@ import * as lib from "@clusterio/lib"; import * as messages from "./messages"; +export * from "./messages"; +export type { ControllerPlugin } from "./controller"; + declare module "@clusterio/lib" { export interface InstanceConfigFields { "exp_roles.sync_mode": "disabled" | "enabled" | "bidirectional"; diff --git a/exp_scenario/controller.ts b/exp_scenario/controller.ts index 1af4d27b..cd04b3db 100644 --- a/exp_scenario/controller.ts +++ b/exp_scenario/controller.ts @@ -1,9 +1,9 @@ import * as lib from "@clusterio/lib"; import { BaseControllerPlugin } from "@clusterio/controller"; -import type { ControllerPlugin as RolesPlugin } from "@expcluster/roles/dist/node/controller"; -import type { ControllerPlugin as GroupsPlugin } from "@expcluster/permission-groups/dist/node/controller"; -import { RoleMetaRecord } from "@expcluster/roles/dist/node/messages"; -import { GroupRecord, GroupPermissions, RoleMappingRecord } from "@expcluster/permission-groups/dist/node/messages"; +import { RoleMetaRecord, type ControllerPlugin as RolesPlugin } from "@expcluster/roles"; +import { + GroupRecord, GroupPermissions, RoleMappingRecord, type ControllerPlugin as GroupsPlugin, +} from "@expcluster/permission-groups"; import * as messages from "./messages"; import { SeedRole, SeedGroup, seedRoles, seedGroups, flattenSeedPermissions } from "./seed"; diff --git a/exp_scenario/seed.ts b/exp_scenario/seed.ts index 62cc2ab6..37edbd63 100644 --- a/exp_scenario/seed.ts +++ b/exp_scenario/seed.ts @@ -1,4 +1,4 @@ -import { RoleColor } from "@expcluster/roles/dist/node/messages"; +import { RoleColor } from "@expcluster/roles"; /** * A role created by the seed, as the scenario defined it before roles moved to diff --git a/exp_scenario/test/controller.test.js b/exp_scenario/test/controller.test.js index a963b157..18ffedc4 100644 --- a/exp_scenario/test/controller.test.js +++ b/exp_scenario/test/controller.test.js @@ -5,11 +5,11 @@ const { Controller } = require("@clusterio/controller"); const { ControllerPlugin } = require("../dist/node/controller"); const messages = require("../dist/node/messages"); const { seedRoles, seedGroups } = require("../dist/node/seed"); -const roles = require("@expcluster/roles/dist/node"); -const groups = require("@expcluster/permission-groups/dist/node"); +const roles = require("@expcluster/roles"); +const groups = require("@expcluster/permission-groups"); const { ControllerPlugin: RolesPlugin } = require("@expcluster/roles/dist/node/controller"); const { ControllerPlugin: GroupsPlugin } = require("@expcluster/permission-groups/dist/node/controller"); -const { GroupRecord, GroupPermissions, RoleMappingRecord } = require("@expcluster/permission-groups/dist/node/messages"); +const { GroupRecord, GroupPermissions, RoleMappingRecord } = require("@expcluster/permission-groups"); // Importing this defines the permissions the seed grants require("../dist/node/permissions");