From 82dd9229fe872fb1f60f517e1521c79c411b9ced Mon Sep 17 00:00:00 2001 From: Clay Tercek <30105080+claytercek@users.noreply.github.com> Date: Fri, 31 Oct 2025 10:46:29 -0700 Subject: [PATCH 01/10] chore: enable noBarrelFile rule --- biome.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/biome.json b/biome.json index 4692321b..adae4fa5 100644 --- a/biome.json +++ b/biome.json @@ -31,6 +31,9 @@ "useNumberNamespace": "error", "noInferrableTypes": "error", "noUselessElse": "error" + }, + "performance": { + "noBarrelFile": "error" } } }, From 0a4616cd3f2ddaba9048d4af3725ea0a9a26d0f1 Mon Sep 17 00:00:00 2001 From: Clay Tercek <30105080+claytercek@users.noreply.github.com> Date: Fri, 31 Oct 2025 11:17:45 -0700 Subject: [PATCH 02/10] refactor(utils): remove barrel files from utils pkg --- packages/cli/src/commands/scaffold.ts | 2 +- packages/cli/src/commands/start.ts | 2 +- packages/cli/src/commands/status.ts | 2 +- packages/cli/src/commands/stop.ts | 2 +- packages/cli/src/launchpad-config.ts | 2 +- packages/cli/src/utils/command-utils.ts | 3 +- .../cli/src/utils/controller-execution.ts | 2 +- .../__tests__/content-plugin-driver.test.ts | 2 +- packages/content/src/content-commands.ts | 2 +- packages/content/src/content-config.ts | 4 +- packages/content/src/content-events.ts | 5 ++- packages/content/src/content-plugin-driver.ts | 4 +- packages/content/src/content-state.ts | 6 ++- .../content/src/fetching/fetch-context.ts | 3 +- packages/content/src/launchpad-content.ts | 21 +++++----- .../plugins/__tests__/plugins.test-utils.ts | 2 +- .../src/plugins/contentPluginHelpers.ts | 3 +- .../content/src/sources/airtable-source.ts | 2 +- packages/content/src/sources/source.ts | 2 +- packages/content/src/sources/strapi-source.ts | 2 +- .../src/utils/content-transform-utils.ts | 2 +- packages/content/src/utils/fetch-logger.ts | 2 +- packages/content/src/utils/fetch-paginated.ts | 2 +- .../content/src/utils/result-async-queue.ts | 2 +- .../__tests__/launchpad-controller.test.ts | 11 ++++- .../core/__tests__/command-dispatcher.test.ts | 2 +- .../src/core/__tests__/event-bus.test.ts | 6 +++ .../src/core/__tests__/state-store.test.ts | 3 +- .../controller/src/core/command-dispatcher.ts | 2 +- packages/controller/src/core/commands.ts | 2 +- .../controller/src/core/controller-config.ts | 2 +- packages/controller/src/core/event-bus.ts | 5 ++- packages/controller/src/core/state-store.ts | 3 +- packages/controller/src/core/transport.ts | 2 +- packages/controller/src/ipc/ipc-client.ts | 3 +- .../controller/src/launchpad-controller.ts | 6 ++- .../src/transports/ipc-transport.ts | 2 +- .../__tests__/monitor-plugin-driver.test.ts | 3 +- .../core/__tests__/process-manager.test.ts | 2 +- packages/monitor/src/core/app-manager.ts | 3 +- packages/monitor/src/core/bus-manager.ts | 2 +- .../monitor/src/core/monitor-plugin-driver.ts | 2 +- packages/monitor/src/core/process-manager.ts | 2 +- packages/monitor/src/launchpad-monitor.ts | 27 ++++++------- packages/monitor/src/monitor-commands.ts | 2 +- packages/monitor/src/monitor-config.ts | 2 +- packages/monitor/src/monitor-events.ts | 5 ++- packages/monitor/src/monitor-state.ts | 6 ++- .../src/utils/__tests__/sort-windows.test.ts | 2 +- packages/monitor/src/utils/sort-windows.ts | 2 +- packages/scaffold/src/index.ts | 2 +- packages/testing/src/test-utils.ts | 2 +- packages/utils/package.json | 30 ++++++++++++-- .../utils/src/__tests__/plugin-driver.test.ts | 2 +- packages/utils/src/controller-interfaces.ts | 7 +--- packages/utils/src/index.ts | 40 ------------------- packages/utils/src/plugin-driver.ts | 2 +- packages/utils/src/types.ts | 15 +++++++ 58 files changed, 158 insertions(+), 132 deletions(-) delete mode 100644 packages/utils/src/index.ts create mode 100644 packages/utils/src/types.ts diff --git a/packages/cli/src/commands/scaffold.ts b/packages/cli/src/commands/scaffold.ts index 5b7fe89a..8565bbbb 100644 --- a/packages/cli/src/commands/scaffold.ts +++ b/packages/cli/src/commands/scaffold.ts @@ -1,5 +1,5 @@ import { launchScaffold } from "@bluecadet/launchpad-scaffold"; -import { LogManager } from "@bluecadet/launchpad-utils"; +import { LogManager } from "@bluecadet/launchpad-utils/log-manager"; import type { GlobalLaunchpadArgs } from "../cli.js"; export async function scaffold(_argv: GlobalLaunchpadArgs) { diff --git a/packages/cli/src/commands/start.ts b/packages/cli/src/commands/start.ts index 2885617c..112a11f6 100644 --- a/packages/cli/src/commands/start.ts +++ b/packages/cli/src/commands/start.ts @@ -1,6 +1,6 @@ import { fork } from "node:child_process"; import fs from "node:fs"; -import type { BaseCommand } from "@bluecadet/launchpad-utils"; +import type { BaseCommand } from "@bluecadet/launchpad-utils/controller-interfaces"; import { fromPromise, ok, okAsync, type ResultAsync } from "neverthrow"; import type { GlobalLaunchpadArgs } from "../cli.js"; import { handleFatalError, initializeLogger, loadConfigAndEnv } from "../utils/command-utils.js"; diff --git a/packages/cli/src/commands/status.ts b/packages/cli/src/commands/status.ts index ac0569b6..0bf1eb01 100644 --- a/packages/cli/src/commands/status.ts +++ b/packages/cli/src/commands/status.ts @@ -3,7 +3,7 @@ */ import type { LaunchpadState } from "@bluecadet/launchpad-controller"; -import { onExit } from "@bluecadet/launchpad-utils"; +import { onExit } from "@bluecadet/launchpad-utils/on-exit"; import ansiEscapes from "ansi-escapes"; import chalk from "chalk"; import { okAsync, ResultAsync } from "neverthrow"; diff --git a/packages/cli/src/commands/stop.ts b/packages/cli/src/commands/stop.ts index 61d3fdef..4eefc443 100644 --- a/packages/cli/src/commands/stop.ts +++ b/packages/cli/src/commands/stop.ts @@ -1,6 +1,6 @@ import path from "node:path"; import { deletePidFile, isProcessRunning } from "@bluecadet/launchpad-controller"; -import { LogManager } from "@bluecadet/launchpad-utils"; +import { LogManager } from "@bluecadet/launchpad-utils/log-manager"; import { err, ok, type Result, ResultAsync } from "neverthrow"; import type { GlobalLaunchpadArgs } from "../cli.js"; import { loadConfigAndEnv } from "../utils/command-utils.js"; diff --git a/packages/cli/src/launchpad-config.ts b/packages/cli/src/launchpad-config.ts index 5a46b54e..9863a1d4 100644 --- a/packages/cli/src/launchpad-config.ts +++ b/packages/cli/src/launchpad-config.ts @@ -1,5 +1,5 @@ import { controllerConfigSchema } from "@bluecadet/launchpad-controller"; -import type { LaunchpadConfig } from "@bluecadet/launchpad-utils"; +import type { LaunchpadConfig } from "@bluecadet/launchpad-utils/types"; /** * Applies defaults to the provided launchpad config. diff --git a/packages/cli/src/utils/command-utils.ts b/packages/cli/src/utils/command-utils.ts index acba271a..ddc147b1 100644 --- a/packages/cli/src/utils/command-utils.ts +++ b/packages/cli/src/utils/command-utils.ts @@ -1,5 +1,6 @@ import path from "node:path"; -import { type Logger, LogManager, TTY_FIXED_END } from "@bluecadet/launchpad-utils"; +import { TTY_FIXED_END } from "@bluecadet/launchpad-utils/console-transport"; +import { type Logger, LogManager } from "@bluecadet/launchpad-utils/log-manager"; import chalk from "chalk"; import { errAsync, ok, ResultAsync } from "neverthrow"; import { ZodError } from "zod"; diff --git a/packages/cli/src/utils/controller-execution.ts b/packages/cli/src/utils/controller-execution.ts index 585ea550..5eef2886 100644 --- a/packages/cli/src/utils/controller-execution.ts +++ b/packages/cli/src/utils/controller-execution.ts @@ -10,7 +10,7 @@ import { IPCClient, LaunchpadController, } from "@bluecadet/launchpad-controller"; -import type { Logger } from "@bluecadet/launchpad-utils"; +import type { Logger } from "@bluecadet/launchpad-utils/log-manager"; import { errAsync, type ResultAsync } from "neverthrow"; import { DaemonNotRunningError, IPCConnectionError } from "../errors.js"; diff --git a/packages/content/src/__tests__/content-plugin-driver.test.ts b/packages/content/src/__tests__/content-plugin-driver.test.ts index 26858542..9508418b 100644 --- a/packages/content/src/__tests__/content-plugin-driver.test.ts +++ b/packages/content/src/__tests__/content-plugin-driver.test.ts @@ -1,5 +1,5 @@ import { createMockLogger } from "@bluecadet/launchpad-testing/test-utils.ts"; -import { PluginDriver } from "@bluecadet/launchpad-utils"; +import { PluginDriver } from "@bluecadet/launchpad-utils/plugin-driver"; import { describe, expect, it, vi } from "vitest"; import { contentConfigSchema } from "../content-config.js"; import { diff --git a/packages/content/src/content-commands.ts b/packages/content/src/content-commands.ts index 69b0467d..9083f33a 100644 --- a/packages/content/src/content-commands.ts +++ b/packages/content/src/content-commands.ts @@ -3,7 +3,7 @@ * These commands are dispatched via the controller's executeCommand() method. */ -import type { BaseCommand } from "@bluecadet/launchpad-utils"; +import type { BaseCommand } from "@bluecadet/launchpad-utils/controller-interfaces"; /** * Fetch content from all or specific sources diff --git a/packages/content/src/content-config.ts b/packages/content/src/content-config.ts index 314820ed..d6d308c8 100644 --- a/packages/content/src/content-config.ts +++ b/packages/content/src/content-config.ts @@ -1,6 +1,8 @@ import { z } from "zod"; import { contentPluginSchema } from "./content-plugin-driver.js"; import { type ContentSource, contentSourceSchema } from "./sources/source.js"; +// need to import so declaration merging works +import "@bluecadet/launchpad-utils/types"; export const DOWNLOAD_PATH_TOKEN = "%DOWNLOAD_PATH%"; export const TIMESTAMP_TOKEN = "%TIMESTAMP%"; @@ -74,7 +76,7 @@ export function defineContentConfig(config: ContentConfig) { } // Declaration merging to add content config to LaunchpadConfig -declare module "@bluecadet/launchpad-utils" { +declare module "@bluecadet/launchpad-utils/types" { interface LaunchpadConfig { /** * Content system configuration. diff --git a/packages/content/src/content-events.ts b/packages/content/src/content-events.ts index 21e2d664..6764582b 100644 --- a/packages/content/src/content-events.ts +++ b/packages/content/src/content-events.ts @@ -1,3 +1,6 @@ +// need to import so declaration merging works +import "@bluecadet/launchpad-utils/types"; + /** * Content subsystem events. * @@ -9,7 +12,7 @@ * but without type checking. */ -declare module "@bluecadet/launchpad-utils" { +declare module "@bluecadet/launchpad-utils/types" { interface LaunchpadEvents { // Fetch lifecycle "content:fetch:start": { diff --git a/packages/content/src/content-plugin-driver.ts b/packages/content/src/content-plugin-driver.ts index 17188e72..c44aa251 100644 --- a/packages/content/src/content-plugin-driver.ts +++ b/packages/content/src/content-plugin-driver.ts @@ -1,12 +1,12 @@ +import type { EventBus } from "@bluecadet/launchpad-utils/controller-interfaces"; import { type BaseHookContext, createPluginValidator, - type EventBus, HookContextProvider, type Plugin, type PluginDriver, type PluginError, -} from "@bluecadet/launchpad-utils"; +} from "@bluecadet/launchpad-utils/plugin-driver"; import { err, type ResultAsync } from "neverthrow"; import type { ResolvedContentConfig } from "./content-config.js"; import type { DataStore } from "./utils/data-store.js"; diff --git a/packages/content/src/content-state.ts b/packages/content/src/content-state.ts index 31a512ab..64aba83f 100644 --- a/packages/content/src/content-state.ts +++ b/packages/content/src/content-state.ts @@ -2,8 +2,10 @@ * Content subsystem state exported for public API. */ -import { PatchedStateManager } from "@bluecadet/launchpad-utils"; +import { PatchedStateManager } from "@bluecadet/launchpad-utils/state-patcher"; import type { ContentError } from "./content-plugin-driver.js"; +// need to import so declaration merging works +import "@bluecadet/launchpad-utils/types"; /** * Individual source fetch state with explicit phase tracking. @@ -73,7 +75,7 @@ export type ContentState = ContentPhase & { sources: Record; }; -declare module "@bluecadet/launchpad-utils" { +declare module "@bluecadet/launchpad-utils/types" { interface SubsystemsState { content: ContentState; } diff --git a/packages/content/src/fetching/fetch-context.ts b/packages/content/src/fetching/fetch-context.ts index 46a75dd8..899fca8b 100644 --- a/packages/content/src/fetching/fetch-context.ts +++ b/packages/content/src/fetching/fetch-context.ts @@ -4,7 +4,8 @@ * Everything should be traceable back to LaunchpadContent for clarity. */ -import type { EventBus, Logger } from "@bluecadet/launchpad-utils"; +import type { EventBus } from "@bluecadet/launchpad-utils/controller-interfaces"; +import type { Logger } from "@bluecadet/launchpad-utils/log-manager"; import type { ResolvedContentConfig } from "../content-config.js"; import type { ContentPluginDriver } from "../content-plugin-driver.js"; import type { ContentSource } from "../sources/source.js"; diff --git a/packages/content/src/launchpad-content.ts b/packages/content/src/launchpad-content.ts index bc94f5a3..758777c0 100644 --- a/packages/content/src/launchpad-content.ts +++ b/packages/content/src/launchpad-content.ts @@ -1,15 +1,14 @@ import path from "node:path"; -import { - type CommandExecutor, - type EventBus, - type EventBusAware, - type Logger, - LogManager, - onExit, - type PatchHandler, - PluginDriver, - type StateProvider, -} from "@bluecadet/launchpad-utils"; +import type { + CommandExecutor, + EventBus, + EventBusAware, + StateProvider, +} from "@bluecadet/launchpad-utils/controller-interfaces"; +import { type Logger, LogManager } from "@bluecadet/launchpad-utils/log-manager"; +import { onExit } from "@bluecadet/launchpad-utils/on-exit"; +import { PluginDriver } from "@bluecadet/launchpad-utils/plugin-driver"; +import type { PatchHandler } from "@bluecadet/launchpad-utils/state-patcher"; import { err, errAsync, ok, okAsync, ResultAsync } from "neverthrow"; import type { ContentCommand } from "./content-commands.js"; import { diff --git a/packages/content/src/plugins/__tests__/plugins.test-utils.ts b/packages/content/src/plugins/__tests__/plugins.test-utils.ts index d63b9da7..453d9ba3 100644 --- a/packages/content/src/plugins/__tests__/plugins.test-utils.ts +++ b/packages/content/src/plugins/__tests__/plugins.test-utils.ts @@ -1,6 +1,6 @@ import path from "node:path"; import { createMockLogger } from "@bluecadet/launchpad-testing/test-utils.ts"; -import type { Logger } from "@bluecadet/launchpad-utils"; +import type { Logger } from "@bluecadet/launchpad-utils/log-manager"; import { vol } from "memfs"; import { afterEach, vi } from "vitest"; import { type ContentConfig, contentConfigSchema } from "../../content-config.js"; diff --git a/packages/content/src/plugins/contentPluginHelpers.ts b/packages/content/src/plugins/contentPluginHelpers.ts index a9491c7d..13d398a6 100644 --- a/packages/content/src/plugins/contentPluginHelpers.ts +++ b/packages/content/src/plugins/contentPluginHelpers.ts @@ -1,4 +1,5 @@ -import { FixedConsoleLogger, type Logger } from "@bluecadet/launchpad-utils"; +import { FixedConsoleLogger } from "@bluecadet/launchpad-utils/console-transport"; +import type { Logger } from "@bluecadet/launchpad-utils/log-manager"; import chalk from "chalk"; import type { z } from "zod"; import type { Document } from "../utils/data-store.js"; diff --git a/packages/content/src/sources/airtable-source.ts b/packages/content/src/sources/airtable-source.ts index 6321f72c..6609537b 100644 --- a/packages/content/src/sources/airtable-source.ts +++ b/packages/content/src/sources/airtable-source.ts @@ -1,4 +1,4 @@ -import type { Logger } from "@bluecadet/launchpad-utils"; +import type { Logger } from "@bluecadet/launchpad-utils/log-manager"; import type Airtable from "airtable"; import { z } from "zod"; import { defineSource } from "./source.js"; diff --git a/packages/content/src/sources/source.ts b/packages/content/src/sources/source.ts index 53bdfac9..a995ec5c 100644 --- a/packages/content/src/sources/source.ts +++ b/packages/content/src/sources/source.ts @@ -1,4 +1,4 @@ -import type { Logger } from "@bluecadet/launchpad-utils"; +import type { Logger } from "@bluecadet/launchpad-utils/log-manager"; import { z } from "zod"; import type { DataStore } from "../utils/data-store.js"; diff --git a/packages/content/src/sources/strapi-source.ts b/packages/content/src/sources/strapi-source.ts index 3a2c0661..439393d6 100644 --- a/packages/content/src/sources/strapi-source.ts +++ b/packages/content/src/sources/strapi-source.ts @@ -1,4 +1,4 @@ -import type { Logger } from "@bluecadet/launchpad-utils"; +import type { Logger } from "@bluecadet/launchpad-utils/log-manager"; import ky from "ky"; import qs from "qs"; import { z } from "zod"; diff --git a/packages/content/src/utils/content-transform-utils.ts b/packages/content/src/utils/content-transform-utils.ts index 2cd695b2..2b7afa37 100644 --- a/packages/content/src/utils/content-transform-utils.ts +++ b/packages/content/src/utils/content-transform-utils.ts @@ -1,4 +1,4 @@ -import type { Logger } from "@bluecadet/launchpad-utils"; +import type { Logger } from "@bluecadet/launchpad-utils/log-manager"; import chalk from "chalk"; import { ok, type Result } from "neverthrow"; import type { DataKeys, DataStore, Document } from "./data-store.js"; diff --git a/packages/content/src/utils/fetch-logger.ts b/packages/content/src/utils/fetch-logger.ts index f51064c2..de458aae 100644 --- a/packages/content/src/utils/fetch-logger.ts +++ b/packages/content/src/utils/fetch-logger.ts @@ -1,4 +1,4 @@ -import { FixedConsoleLogger, NO_TTY } from "@bluecadet/launchpad-utils"; +import { FixedConsoleLogger, NO_TTY } from "@bluecadet/launchpad-utils/console-transport"; import chalk from "chalk"; import type { ResultAsync } from "neverthrow"; diff --git a/packages/content/src/utils/fetch-paginated.ts b/packages/content/src/utils/fetch-paginated.ts index 49e93cc8..bbfbface 100644 --- a/packages/content/src/utils/fetch-paginated.ts +++ b/packages/content/src/utils/fetch-paginated.ts @@ -1,4 +1,4 @@ -import type { Logger } from "@bluecadet/launchpad-utils"; +import type { Logger } from "@bluecadet/launchpad-utils/log-manager"; export type FetchPaginatedOptions = { /** diff --git a/packages/content/src/utils/result-async-queue.ts b/packages/content/src/utils/result-async-queue.ts index 477e8217..4c993a19 100644 --- a/packages/content/src/utils/result-async-queue.ts +++ b/packages/content/src/utils/result-async-queue.ts @@ -1,4 +1,4 @@ -import type { Logger } from "@bluecadet/launchpad-utils"; +import type { Logger } from "@bluecadet/launchpad-utils/log-manager"; import chalk from "chalk"; import { ok, Result, ResultAsync } from "neverthrow"; import PQueue from "p-queue"; diff --git a/packages/controller/src/__tests__/launchpad-controller.test.ts b/packages/controller/src/__tests__/launchpad-controller.test.ts index 125d1bc8..45c9fa6f 100644 --- a/packages/controller/src/__tests__/launchpad-controller.test.ts +++ b/packages/controller/src/__tests__/launchpad-controller.test.ts @@ -1,9 +1,16 @@ import { createMockLogger } from "@bluecadet/launchpad-testing/test-utils.ts"; -import type { BaseCommand, Subsystem } from "@bluecadet/launchpad-utils"; +import type { BaseCommand, Subsystem } from "@bluecadet/launchpad-utils/controller-interfaces"; +import type { LaunchpadEvents } from "@bluecadet/launchpad-utils/types"; import { okAsync } from "neverthrow"; import { describe, expect, it, vi } from "vitest"; import { LaunchpadController } from "../launchpad-controller.js"; +declare module "@bluecadet/launchpad-utils/types" { + interface SubsystemsState { + [test: string]: any; + } +} + describe("LaunchpadController", () => { const rootLogger = createMockLogger(); @@ -361,7 +368,7 @@ describe("LaunchpadController", () => { it("should emit events and aggregate state across subsystems", async () => { const controller = createController(); const eventBus = controller.getEventBus(); - const events: string[] = []; + const events: (keyof LaunchpadEvents)[] = []; eventBus.onAny((event) => events.push(event)); diff --git a/packages/controller/src/core/__tests__/command-dispatcher.test.ts b/packages/controller/src/core/__tests__/command-dispatcher.test.ts index c0c0535a..f9c45b83 100644 --- a/packages/controller/src/core/__tests__/command-dispatcher.test.ts +++ b/packages/controller/src/core/__tests__/command-dispatcher.test.ts @@ -1,4 +1,4 @@ -import type { BaseCommand, Subsystem } from "@bluecadet/launchpad-utils"; +import type { BaseCommand, Subsystem } from "@bluecadet/launchpad-utils/controller-interfaces"; import { errAsync, okAsync } from "neverthrow"; import { describe, expect, it, vi } from "vitest"; import { CommandDispatcher } from "../command-dispatcher.js"; diff --git a/packages/controller/src/core/__tests__/event-bus.test.ts b/packages/controller/src/core/__tests__/event-bus.test.ts index 996696a0..9e87c269 100644 --- a/packages/controller/src/core/__tests__/event-bus.test.ts +++ b/packages/controller/src/core/__tests__/event-bus.test.ts @@ -1,6 +1,12 @@ import { describe, expect, it, vi } from "vitest"; import { EventBus } from "../event-bus.js"; +declare module "@bluecadet/launchpad-utils/types" { + interface LaunchpadEvents { + [name: string]: any; + } +} + describe("EventBus", () => { describe("emit and on", () => { it("should emit events to subscribers", () => { diff --git a/packages/controller/src/core/__tests__/state-store.test.ts b/packages/controller/src/core/__tests__/state-store.test.ts index 88af68a5..ee426667 100644 --- a/packages/controller/src/core/__tests__/state-store.test.ts +++ b/packages/controller/src/core/__tests__/state-store.test.ts @@ -1,4 +1,5 @@ -import type { PatchHandler, Subsystem } from "@bluecadet/launchpad-utils"; +import type { Subsystem } from "@bluecadet/launchpad-utils/controller-interfaces"; +import type { PatchHandler } from "@bluecadet/launchpad-utils/state-patcher"; import type { Patch } from "immer"; import { describe, expect, it, vi } from "vitest"; import { StateStore } from "../state-store.js"; diff --git a/packages/controller/src/core/command-dispatcher.ts b/packages/controller/src/core/command-dispatcher.ts index 82c16058..953e2562 100644 --- a/packages/controller/src/core/command-dispatcher.ts +++ b/packages/controller/src/core/command-dispatcher.ts @@ -1,4 +1,4 @@ -import type { BaseCommand, Subsystem } from "@bluecadet/launchpad-utils"; +import type { BaseCommand, Subsystem } from "@bluecadet/launchpad-utils/controller-interfaces"; import { errAsync, type ResultAsync } from "neverthrow"; import { CommandExecutionError } from "../errors.js"; import type { EventBus } from "./event-bus.js"; diff --git a/packages/controller/src/core/commands.ts b/packages/controller/src/core/commands.ts index 297bd986..ca243a75 100644 --- a/packages/controller/src/core/commands.ts +++ b/packages/controller/src/core/commands.ts @@ -1,4 +1,4 @@ -import type { BaseCommand } from "@bluecadet/launchpad-utils"; +import type { BaseCommand } from "@bluecadet/launchpad-utils/controller-interfaces"; /** * System commands (controller-owned). diff --git a/packages/controller/src/core/controller-config.ts b/packages/controller/src/core/controller-config.ts index e390b613..8d459152 100644 --- a/packages/controller/src/core/controller-config.ts +++ b/packages/controller/src/core/controller-config.ts @@ -32,7 +32,7 @@ export const controllerConfigSchema = z export type ControllerConfig = z.infer; // Declaration merging to add controller config to LaunchpadConfig -declare module "@bluecadet/launchpad-utils" { +declare module "@bluecadet/launchpad-utils/types" { interface LaunchpadConfig { /** * Controller system configuration. diff --git a/packages/controller/src/core/event-bus.ts b/packages/controller/src/core/event-bus.ts index be4d6635..5d06edc2 100644 --- a/packages/controller/src/core/event-bus.ts +++ b/packages/controller/src/core/event-bus.ts @@ -1,5 +1,6 @@ import { EventEmitter } from "node:events"; -import type { EventBus as IEventBus, LaunchpadEvents } from "@bluecadet/launchpad-utils"; +import type { EventBus as IEventBus } from "@bluecadet/launchpad-utils/controller-interfaces"; +import type { LaunchpadEvents } from "@bluecadet/launchpad-utils/types"; /** * Core controller events. @@ -7,7 +8,7 @@ import type { EventBus as IEventBus, LaunchpadEvents } from "@bluecadet/launchpa * Subsystems can augment this interface via declaration merging * */ -declare module "@bluecadet/launchpad-utils" { +declare module "@bluecadet/launchpad-utils/types" { interface LaunchpadEvents { // Command lifecycle events (controller-owned) "command:start": { commandType: string; [key: string]: unknown }; diff --git a/packages/controller/src/core/state-store.ts b/packages/controller/src/core/state-store.ts index 8ae5c307..d37640c5 100644 --- a/packages/controller/src/core/state-store.ts +++ b/packages/controller/src/core/state-store.ts @@ -1,4 +1,5 @@ -import type { Subsystem, SubsystemsState } from "@bluecadet/launchpad-utils"; +import type { Subsystem } from "@bluecadet/launchpad-utils/controller-interfaces"; +import type { SubsystemsState } from "@bluecadet/launchpad-utils/types"; import type { Patch } from "immer"; /** diff --git a/packages/controller/src/core/transport.ts b/packages/controller/src/core/transport.ts index d6ae5d11..20f77361 100644 --- a/packages/controller/src/core/transport.ts +++ b/packages/controller/src/core/transport.ts @@ -4,7 +4,7 @@ * (CLI, web dashboard, OSC, etc.) */ -import type { Logger } from "@bluecadet/launchpad-utils"; +import type { Logger } from "@bluecadet/launchpad-utils/log-manager"; import type { ResultAsync } from "neverthrow"; import type { CommandDispatcher } from "./command-dispatcher.js"; import type { EventBus } from "./event-bus.js"; diff --git a/packages/controller/src/ipc/ipc-client.ts b/packages/controller/src/ipc/ipc-client.ts index eacd69d8..6899a600 100644 --- a/packages/controller/src/ipc/ipc-client.ts +++ b/packages/controller/src/ipc/ipc-client.ts @@ -4,7 +4,8 @@ */ import net from "node:net"; -import type { BaseCommand, LaunchpadEvents } from "@bluecadet/launchpad-utils"; +import type { BaseCommand } from "@bluecadet/launchpad-utils/controller-interfaces"; +import type { LaunchpadEvents } from "@bluecadet/launchpad-utils/types"; import { applyPatches, enablePatches, type Patch } from "immer"; import { errAsync, okAsync, ResultAsync } from "neverthrow"; import { EventBus } from "../core/event-bus.js"; diff --git a/packages/controller/src/launchpad-controller.ts b/packages/controller/src/launchpad-controller.ts index bcd141b7..cac94eea 100644 --- a/packages/controller/src/launchpad-controller.ts +++ b/packages/controller/src/launchpad-controller.ts @@ -1,6 +1,8 @@ import path from "node:path"; -import type { BaseCommand, Logger, Subsystem } from "@bluecadet/launchpad-utils"; -import { LogManager, onExit } from "@bluecadet/launchpad-utils"; +import type { BaseCommand, Subsystem } from "@bluecadet/launchpad-utils/controller-interfaces"; +import type { Logger } from "@bluecadet/launchpad-utils/log-manager"; +import { LogManager } from "@bluecadet/launchpad-utils/log-manager"; +import { onExit } from "@bluecadet/launchpad-utils/on-exit"; import { errAsync, okAsync, ResultAsync } from "neverthrow"; import { CommandDispatcher } from "./core/command-dispatcher.js"; import type { ControllerConfig, ControllerMode } from "./core/controller-config.js"; diff --git a/packages/controller/src/transports/ipc-transport.ts b/packages/controller/src/transports/ipc-transport.ts index 30fbbfd1..ee8fbb55 100644 --- a/packages/controller/src/transports/ipc-transport.ts +++ b/packages/controller/src/transports/ipc-transport.ts @@ -6,7 +6,7 @@ import fs from "node:fs"; import net from "node:net"; import path from "node:path"; -import type { LaunchpadEvents } from "@bluecadet/launchpad-utils"; +import type { LaunchpadEvents } from "@bluecadet/launchpad-utils/types"; import chalk from "chalk"; import type { Patch } from "immer"; import { ResultAsync } from "neverthrow"; diff --git a/packages/monitor/src/core/__tests__/monitor-plugin-driver.test.ts b/packages/monitor/src/core/__tests__/monitor-plugin-driver.test.ts index ecf28e04..424171ca 100644 --- a/packages/monitor/src/core/__tests__/monitor-plugin-driver.test.ts +++ b/packages/monitor/src/core/__tests__/monitor-plugin-driver.test.ts @@ -1,5 +1,6 @@ import { createMockLogger } from "@bluecadet/launchpad-testing/test-utils.ts"; -import { type Logger, PluginDriver } from "@bluecadet/launchpad-utils"; +import type { Logger } from "@bluecadet/launchpad-utils/log-manager"; +import { PluginDriver } from "@bluecadet/launchpad-utils/plugin-driver"; import { beforeEach, describe, expect, it, vi } from "vitest"; import type LaunchpadMonitor from "../../launchpad-monitor.js"; import { type MonitorPlugin, MonitorPluginDriver } from "../monitor-plugin-driver.js"; diff --git a/packages/monitor/src/core/__tests__/process-manager.test.ts b/packages/monitor/src/core/__tests__/process-manager.test.ts index 98a48985..b46adbac 100644 --- a/packages/monitor/src/core/__tests__/process-manager.test.ts +++ b/packages/monitor/src/core/__tests__/process-manager.test.ts @@ -1,5 +1,5 @@ import { createMockLogger } from "@bluecadet/launchpad-testing/test-utils.ts"; -import type { Logger } from "@bluecadet/launchpad-utils"; +import type { Logger } from "@bluecadet/launchpad-utils/log-manager"; import pm2 from "pm2"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import { ProcessManager } from "../process-manager.js"; diff --git a/packages/monitor/src/core/app-manager.ts b/packages/monitor/src/core/app-manager.ts index daf00c0d..b7aa50af 100644 --- a/packages/monitor/src/core/app-manager.ts +++ b/packages/monitor/src/core/app-manager.ts @@ -1,5 +1,6 @@ import path from "node:path"; -import type { EventBus, Logger } from "@bluecadet/launchpad-utils"; +import type { EventBus } from "@bluecadet/launchpad-utils/controller-interfaces"; +import type { Logger } from "@bluecadet/launchpad-utils/log-manager"; import { err, errAsync, ok, okAsync, type Result, ResultAsync } from "neverthrow"; import type pm2 from "pm2"; import type { ResolvedAppConfig, ResolvedMonitorConfig } from "../monitor-config.js"; diff --git a/packages/monitor/src/core/bus-manager.ts b/packages/monitor/src/core/bus-manager.ts index 4241ce65..c766a671 100644 --- a/packages/monitor/src/core/bus-manager.ts +++ b/packages/monitor/src/core/bus-manager.ts @@ -1,4 +1,4 @@ -import { type Logger, LogManager } from "@bluecadet/launchpad-utils"; +import { type Logger, LogManager } from "@bluecadet/launchpad-utils/log-manager"; import type { SubEmitterSocket } from "axon"; import { err, ok, type Result, ResultAsync } from "neverthrow"; import pm2 from "pm2"; diff --git a/packages/monitor/src/core/monitor-plugin-driver.ts b/packages/monitor/src/core/monitor-plugin-driver.ts index e5b6e258..00357737 100644 --- a/packages/monitor/src/core/monitor-plugin-driver.ts +++ b/packages/monitor/src/core/monitor-plugin-driver.ts @@ -4,7 +4,7 @@ import { HookContextProvider, type Plugin, type PluginDriver, -} from "@bluecadet/launchpad-utils"; +} from "@bluecadet/launchpad-utils/plugin-driver"; import type pm2 from "pm2"; import type LaunchpadMonitor from "../launchpad-monitor.js"; diff --git a/packages/monitor/src/core/process-manager.ts b/packages/monitor/src/core/process-manager.ts index 87dfb16a..a5b1d29a 100644 --- a/packages/monitor/src/core/process-manager.ts +++ b/packages/monitor/src/core/process-manager.ts @@ -1,4 +1,4 @@ -import type { Logger } from "@bluecadet/launchpad-utils"; +import type { Logger } from "@bluecadet/launchpad-utils/log-manager"; import { err, ok, okAsync, Result, ResultAsync } from "neverthrow"; import pm2 from "pm2"; diff --git a/packages/monitor/src/launchpad-monitor.ts b/packages/monitor/src/launchpad-monitor.ts index 203aee11..9548c496 100644 --- a/packages/monitor/src/launchpad-monitor.ts +++ b/packages/monitor/src/launchpad-monitor.ts @@ -1,15 +1,14 @@ -import { - type CommandExecutor, - type Disconnectable, - type EventBus, - type EventBusAware, - type Logger, - LogManager, - onExit, - type PatchHandler, - PluginDriver, - type StateProvider, -} from "@bluecadet/launchpad-utils"; +import type { + CommandExecutor, + Disconnectable, + EventBus, + EventBusAware, + StateProvider, +} from "@bluecadet/launchpad-utils/controller-interfaces"; +import { type Logger, LogManager } from "@bluecadet/launchpad-utils/log-manager"; +import { onExit } from "@bluecadet/launchpad-utils/on-exit"; +import { PluginDriver } from "@bluecadet/launchpad-utils/plugin-driver"; +import type { PatchHandler } from "@bluecadet/launchpad-utils/state-patcher"; import autoBind from "auto-bind"; import { spawn } from "cross-spawn"; import { errAsync, okAsync, ResultAsync } from "neverthrow"; @@ -151,10 +150,8 @@ class LaunchpadMonitor return this.shutdown(command.exitCode); default: { - // TypeScript exhaustiveness check - const exhaustiveCheck: never = command; return errAsync( - new Error(`Unknown monitor command type: ${(exhaustiveCheck as MonitorCommand).type}`), + new Error(`Unknown monitor command type: ${(command as MonitorCommand).type}`), ); } } diff --git a/packages/monitor/src/monitor-commands.ts b/packages/monitor/src/monitor-commands.ts index 7260b274..9c136c28 100644 --- a/packages/monitor/src/monitor-commands.ts +++ b/packages/monitor/src/monitor-commands.ts @@ -3,7 +3,7 @@ * These commands are dispatched via the controller's executeCommand() method. */ -import type { BaseCommand } from "@bluecadet/launchpad-utils"; +import type { BaseCommand } from "@bluecadet/launchpad-utils/controller-interfaces"; /** * Connect to PM2 daemon diff --git a/packages/monitor/src/monitor-config.ts b/packages/monitor/src/monitor-config.ts index e79a41f4..60268cf1 100644 --- a/packages/monitor/src/monitor-config.ts +++ b/packages/monitor/src/monitor-config.ts @@ -152,7 +152,7 @@ export function defineMonitorConfig(config: MonitorConfig) { } // Declaration merging to add monitor config to LaunchpadConfig -declare module "@bluecadet/launchpad-utils" { +declare module "@bluecadet/launchpad-utils/types" { interface LaunchpadConfig { /** * Monitor system configuration. diff --git a/packages/monitor/src/monitor-events.ts b/packages/monitor/src/monitor-events.ts index 24bf27b5..07e3f3bd 100644 --- a/packages/monitor/src/monitor-events.ts +++ b/packages/monitor/src/monitor-events.ts @@ -1,3 +1,6 @@ +// Need to import so that declaration merging works +import "@bluecadet/launchpad-utils/types"; + /** * Monitor subsystem events. * @@ -9,7 +12,7 @@ * but without type checking. */ -declare module "@bluecadet/launchpad-utils" { +declare module "@bluecadet/launchpad-utils/types" { interface LaunchpadEvents { // Connection lifecycle "monitor:connect:start": Record; diff --git a/packages/monitor/src/monitor-state.ts b/packages/monitor/src/monitor-state.ts index b0ba5161..01928c66 100644 --- a/packages/monitor/src/monitor-state.ts +++ b/packages/monitor/src/monitor-state.ts @@ -3,7 +3,9 @@ * This represents the current state of the monitor system. */ -import { PatchedStateManager } from "@bluecadet/launchpad-utils"; +import { PatchedStateManager } from "@bluecadet/launchpad-utils/state-patcher"; +// Need to import so that declaration merging works +import "@bluecadet/launchpad-utils/types"; export type MonitorAppStatus = "online" | "offline" | "errored"; @@ -31,7 +33,7 @@ export type MonitorState = { }; }; -declare module "@bluecadet/launchpad-utils" { +declare module "@bluecadet/launchpad-utils/types" { interface SubsystemsState { monitor: MonitorState; } diff --git a/packages/monitor/src/utils/__tests__/sort-windows.test.ts b/packages/monitor/src/utils/__tests__/sort-windows.test.ts index 559da56a..dbec4863 100644 --- a/packages/monitor/src/utils/__tests__/sort-windows.test.ts +++ b/packages/monitor/src/utils/__tests__/sort-windows.test.ts @@ -1,6 +1,6 @@ import { afterEach } from "node:test"; import { createMockLogger } from "@bluecadet/launchpad-testing/test-utils.ts"; -import type { Logger } from "@bluecadet/launchpad-utils"; +import type { Logger } from "@bluecadet/launchpad-utils/log-manager"; import { type Window, windowManager } from "node-window-manager"; import semver from "semver"; import { beforeEach, describe, expect, it, vi } from "vitest"; diff --git a/packages/monitor/src/utils/sort-windows.ts b/packages/monitor/src/utils/sort-windows.ts index 2bf41907..6c91b0ac 100644 --- a/packages/monitor/src/utils/sort-windows.ts +++ b/packages/monitor/src/utils/sort-windows.ts @@ -1,4 +1,4 @@ -import type { Logger } from "@bluecadet/launchpad-utils"; +import type { Logger } from "@bluecadet/launchpad-utils/log-manager"; import chalk from "chalk"; import { windowManager } from "node-window-manager"; import semver from "semver"; diff --git a/packages/scaffold/src/index.ts b/packages/scaffold/src/index.ts index 04aa85d4..8437acda 100755 --- a/packages/scaffold/src/index.ts +++ b/packages/scaffold/src/index.ts @@ -1,5 +1,5 @@ import * as path from "node:path"; -import { type Logger, LogManager } from "@bluecadet/launchpad-utils"; +import { type Logger, LogManager } from "@bluecadet/launchpad-utils/log-manager"; import * as sudo from "sudo-prompt"; export function launchScaffold(parentLogger: Logger) { diff --git a/packages/testing/src/test-utils.ts b/packages/testing/src/test-utils.ts index dcbcde7f..07bf1096 100644 --- a/packages/testing/src/test-utils.ts +++ b/packages/testing/src/test-utils.ts @@ -1,4 +1,4 @@ -import type { EventBus } from "@bluecadet/launchpad-utils"; +import type { EventBus } from "@bluecadet/launchpad-utils/controller-interfaces"; import { vi } from "vitest"; type MockLogger = { diff --git a/packages/utils/package.json b/packages/utils/package.json index 77ba922e..838f29aa 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -4,9 +4,33 @@ "description": "Common utilities used by multiple launchpad modules", "type": "module", "exports": { - ".": { - "types": "./dist/index.d.ts", - "default": "./dist/index.js" + "./console-transport": { + "types": "./dist/console-transport.d.ts", + "default": "./dist/console-transport.js" + }, + "./log-manager": { + "types": "./dist/log-manager.d.ts", + "default": "./dist/log-manager.js" + }, + "./plugin-driver": { + "types": "./dist/plugin-driver.d.ts", + "default": "./dist/plugin-driver.js" + }, + "./state-patcher": { + "types": "./dist/state-patcher.d.ts", + "default": "./dist/state-patcher.js" + }, + "./controller-interfaces": { + "types": "./dist/controller-interfaces.d.ts", + "default": "./dist/controller-interfaces.js" + }, + "./types": { + "types": "./dist/types.d.ts", + "default": "./dist/types.js" + }, + "./on-exit": { + "types": "./dist/on-exit.d.ts", + "default": "./dist/on-exit.js" } }, "files": [ diff --git a/packages/utils/src/__tests__/plugin-driver.test.ts b/packages/utils/src/__tests__/plugin-driver.test.ts index 0a5a9555..ac9cfe64 100644 --- a/packages/utils/src/__tests__/plugin-driver.test.ts +++ b/packages/utils/src/__tests__/plugin-driver.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it, vi } from "vitest"; import type { HookSet, Plugin } from "../plugin-driver.js"; -import PluginDriver, { HookContextProvider, PluginError } from "../plugin-driver.js"; +import { HookContextProvider, PluginDriver, PluginError } from "../plugin-driver.js"; import { createMockLogger } from "./test-utils.js"; describe("PluginDriver", () => { diff --git a/packages/utils/src/controller-interfaces.ts b/packages/utils/src/controller-interfaces.ts index a7bee7e5..67c0e337 100644 --- a/packages/utils/src/controller-interfaces.ts +++ b/packages/utils/src/controller-interfaces.ts @@ -1,11 +1,6 @@ import type { ResultAsync } from "neverthrow"; import type { PatchHandler } from "./state-patcher.js"; - -// biome-ignore lint/suspicious/noEmptyInterface: this will be augmented via declaration merging -export interface LaunchpadEvents {} - -// biome-ignore lint/suspicious/noEmptyInterface: this will be augmented via declaration merging -export interface SubsystemsState {} +import type { LaunchpadEvents } from "./types.js"; /** * EventBus interface for inter-subsystem communication. diff --git a/packages/utils/src/index.ts b/packages/utils/src/index.ts deleted file mode 100644 index ba5091eb..00000000 --- a/packages/utils/src/index.ts +++ /dev/null @@ -1,40 +0,0 @@ -import type { LogConfig } from "./log-manager.js"; - -export { - FixedConsoleLogger, - NO_TTY, - TTY_FIXED, - TTY_FIXED_END, - TTY_ONLY, -} from "./console-transport.js"; -export type { - BaseCommand, - CommandExecutor, - Disconnectable, - EventBus, - EventBusAware, - LaunchpadEvents, - StateProvider, - Subsystem, - SubsystemsState, -} from "./controller-interfaces.js"; -export type { Logger } from "./log-manager.js"; -export { LogManager, logConfigSchema } from "./log-manager.js"; -export { onExit } from "./on-exit.js"; -export type { BaseHookContext, HookSet, Plugin } from "./plugin-driver.js"; -export { - createPluginValidator, - default as PluginDriver, - HookContextProvider, - PluginError, -} from "./plugin-driver.js"; -export type { LogConfig }; -export { PatchedStateManager, type PatchHandler } from "./state-patcher.js"; - -// this will be augmented via declaration merging -export interface LaunchpadConfig { - /** - * Logging configuration. - */ - logging?: LogConfig; -} diff --git a/packages/utils/src/plugin-driver.ts b/packages/utils/src/plugin-driver.ts index d9201731..8f2e435f 100644 --- a/packages/utils/src/plugin-driver.ts +++ b/packages/utils/src/plugin-driver.ts @@ -61,7 +61,7 @@ export function createPluginValidator(validHookKeys: (keyof T }) as z.ZodType>; } -export default class PluginDriver { +export class PluginDriver { #plugins: Plugin[] = []; readonly #baseHookContexts = new Map, BaseHookContext>(); readonly #baseLogger: Logger; diff --git a/packages/utils/src/types.ts b/packages/utils/src/types.ts new file mode 100644 index 00000000..6bba645d --- /dev/null +++ b/packages/utils/src/types.ts @@ -0,0 +1,15 @@ +import type { LogConfig } from "./log-manager.js"; + +// this will be augmented via declaration merging +export interface LaunchpadConfig { + /** + * Logging configuration. + */ + logging?: LogConfig; +} + +// biome-ignore lint/suspicious/noEmptyInterface: this will be augmented via declaration merging +export interface LaunchpadEvents {} + +// biome-ignore lint/suspicious/noEmptyInterface: this will be augmented via declaration merging +export interface SubsystemsState {} From 4c878c1c76e8b324d136a10ab1ac1294418c7028 Mon Sep 17 00:00:00 2001 From: Clay Tercek <30105080+claytercek@users.noreply.github.com> Date: Fri, 31 Oct 2025 11:43:12 -0700 Subject: [PATCH 03/10] refactor(content): remove content pkg barrel files --- packages/content/package.json | 80 ++++++++++++++++++- ...-driver.test.ts => content-plugin.test.ts} | 6 +- .../src/__tests__/content-state.test.ts | 2 +- .../src/__tests__/launchpad-content.test.ts | 4 +- packages/content/src/content-config.ts | 4 +- ...ent-plugin-driver.ts => content-plugin.ts} | 0 packages/content/src/content-state.ts | 2 +- .../fetching/__tests__/fetch-context.test.ts | 4 +- .../fetching/__tests__/fetch-stages.test.ts | 6 +- .../content/src/fetching/fetch-context.ts | 4 +- packages/content/src/fetching/fetch-stages.ts | 4 +- packages/content/src/index.ts | 13 --- packages/content/src/launchpad-content.ts | 4 +- packages/content/src/plugins/index.ts | 8 -- packages/content/src/plugins/md-to-html.ts | 2 +- .../content/src/plugins/media-downloader.ts | 4 +- .../src/plugins/sanity-image-url-transform.ts | 2 +- .../content/src/plugins/sanity-to-html.ts | 2 +- .../content/src/plugins/sanity-to-markdown.ts | 2 +- .../content/src/plugins/sanity-to-plain.ts | 2 +- packages/content/src/plugins/sharp.ts | 2 +- packages/content/src/plugins/symlink.ts | 2 +- packages/content/src/{sources => }/source.ts | 2 +- .../content/src/sources/airtable-source.ts | 2 +- .../content/src/sources/contentful-source.ts | 2 +- packages/content/src/sources/index.ts | 6 -- packages/content/src/sources/json-source.ts | 2 +- packages/content/src/sources/sanity-source.ts | 2 +- packages/content/src/sources/strapi-source.ts | 2 +- 29 files changed, 111 insertions(+), 66 deletions(-) rename packages/content/src/__tests__/{content-plugin-driver.test.ts => content-plugin.test.ts} (98%) rename packages/content/src/{content-plugin-driver.ts => content-plugin.ts} (100%) delete mode 100755 packages/content/src/index.ts delete mode 100644 packages/content/src/plugins/index.ts rename packages/content/src/{sources => }/source.ts (97%) delete mode 100644 packages/content/src/sources/index.ts diff --git a/packages/content/package.json b/packages/content/package.json index 184752c6..2a0817f7 100644 --- a/packages/content/package.json +++ b/packages/content/package.json @@ -9,8 +9,84 @@ ], "exports": { ".": { - "types": "./dist/index.d.ts", - "default": "./dist/index.js" + "types": "./dist/launchpad-content.d.ts", + "default": "./dist/launchpad-content.js" + }, + "./commands": { + "types": "./dist/content-commands.d.ts", + "default": "./dist/content-commands.js" + }, + "./config": { + "types": "./dist/content-config.d.ts", + "default": "./dist/content-config.js" + }, + "./events": { + "types": "./dist/content-events.d.ts", + "default": "./dist/content-events.js" + }, + "./state": { + "types": "./dist/content-state.d.ts", + "default": "./dist/content-state.js" + }, + "./plugin": { + "types": "./dist/content-plugin.d.ts", + "default": "./dist/content-plugin.js" + }, + "./plugins/md-to-html": { + "types": "./dist/plugins/md-to-html.d.ts", + "default": "./dist/plugins/md-to-html.js" + }, + "./plugins/media-downloader": { + "types": "./dist/plugins/media-downloader.d.ts", + "default": "./dist/plugins/media-downloader.js" + }, + "./plugins/sanity-image-url-transform": { + "types": "./dist/plugins/sanity-image-url-transform.d.ts", + "default": "./dist/plugins/sanity-image-url-transform.js" + }, + "./plugins/sanity-to-html": { + "types": "./dist/plugins/sanity-to-html.d.ts", + "default": "./dist/plugins/sanity-to-html.js" + }, + "./plugins/sanity-to-markdown": { + "types": "./dist/plugins/sanity-to-markdown.d.ts", + "default": "./dist/plugins/sanity-to-markdown.js" + }, + "./plugins/sanity-to-plain": { + "types": "./dist/plugins/sanity-to-plain.d.ts", + "default": "./dist/plugins/sanity-to-plain.js" + }, + "./plugins/sharp": { + "types": "./dist/plugins/sharp.d.ts", + "default": "./dist/plugins/sharp.js" + }, + "./plugins/symlink": { + "types": "./dist/plugins/symlink.d.ts", + "default": "./dist/plugins/symlink.js" + }, + "./source": { + "types": "./dist/source.d.ts", + "default": "./dist/source.js" + }, + "./sources/airtable": { + "types": "./dist/sources/airtable-source.d.ts", + "default": "./dist/sources/airtable-source.js" + }, + "./sources/contentful": { + "types": "./dist/sources/contentful-source.d.ts", + "default": "./dist/sources/contentful-source.js" + }, + "./sources/json": { + "types": "./dist/sources/json-source.d.ts", + "default": "./dist/sources/json-source.js" + }, + "./sources/sanity": { + "types": "./dist/sources/sanity-source.d.ts", + "default": "./dist/sources/sanity-source.js" + }, + "./sources/strapi": { + "types": "./dist/sources/strapi-source.d.ts", + "default": "./dist/sources/strapi-source.js" }, "./package.json": "./package.json" }, diff --git a/packages/content/src/__tests__/content-plugin-driver.test.ts b/packages/content/src/__tests__/content-plugin.test.ts similarity index 98% rename from packages/content/src/__tests__/content-plugin-driver.test.ts rename to packages/content/src/__tests__/content-plugin.test.ts index 9508418b..277fe2ae 100644 --- a/packages/content/src/__tests__/content-plugin-driver.test.ts +++ b/packages/content/src/__tests__/content-plugin.test.ts @@ -2,11 +2,7 @@ import { createMockLogger } from "@bluecadet/launchpad-testing/test-utils.ts"; import { PluginDriver } from "@bluecadet/launchpad-utils/plugin-driver"; import { describe, expect, it, vi } from "vitest"; import { contentConfigSchema } from "../content-config.js"; -import { - ContentError, - ContentPluginDriver, - defineContentPlugin, -} from "../content-plugin-driver.js"; +import { ContentError, ContentPluginDriver, defineContentPlugin } from "../content-plugin.js"; import { DataStore } from "../utils/data-store.js"; describe("ContentPluginDriver", () => { diff --git a/packages/content/src/__tests__/content-state.test.ts b/packages/content/src/__tests__/content-state.test.ts index 39ae6e6a..a4dd6d18 100644 --- a/packages/content/src/__tests__/content-state.test.ts +++ b/packages/content/src/__tests__/content-state.test.ts @@ -2,7 +2,7 @@ import { createMockEventBus, createMockLogger } from "@bluecadet/launchpad-testi import { vol } from "memfs"; import { afterEach, describe, expect, it, vi } from "vitest"; import LaunchpadContent from "../launchpad-content.js"; -import { defineSource } from "../sources/source.js"; +import { defineSource } from "../source.js"; describe("ContentState", () => { afterEach(() => { diff --git a/packages/content/src/__tests__/launchpad-content.test.ts b/packages/content/src/__tests__/launchpad-content.test.ts index d6980f33..2cca8759 100644 --- a/packages/content/src/__tests__/launchpad-content.test.ts +++ b/packages/content/src/__tests__/launchpad-content.test.ts @@ -2,9 +2,9 @@ import path from "node:path"; import { createMockLogger } from "@bluecadet/launchpad-testing/test-utils.ts"; import { vol } from "memfs"; import { afterEach, describe, expect, it, vi } from "vitest"; -import { ContentError, type ContentPlugin } from "../content-plugin-driver.js"; +import { ContentError, type ContentPlugin } from "../content-plugin.js"; import LaunchpadContent from "../launchpad-content.js"; -import { defineSource } from "../sources/source.js"; +import { defineSource } from "../source.js"; describe("LaunchpadContent", () => { afterEach(() => { diff --git a/packages/content/src/content-config.ts b/packages/content/src/content-config.ts index d6d308c8..02a722ac 100644 --- a/packages/content/src/content-config.ts +++ b/packages/content/src/content-config.ts @@ -1,6 +1,6 @@ import { z } from "zod"; -import { contentPluginSchema } from "./content-plugin-driver.js"; -import { type ContentSource, contentSourceSchema } from "./sources/source.js"; +import { contentPluginSchema } from "./content-plugin.js"; +import { type ContentSource, contentSourceSchema } from "./source.js"; // need to import so declaration merging works import "@bluecadet/launchpad-utils/types"; diff --git a/packages/content/src/content-plugin-driver.ts b/packages/content/src/content-plugin.ts similarity index 100% rename from packages/content/src/content-plugin-driver.ts rename to packages/content/src/content-plugin.ts diff --git a/packages/content/src/content-state.ts b/packages/content/src/content-state.ts index 64aba83f..93dab91e 100644 --- a/packages/content/src/content-state.ts +++ b/packages/content/src/content-state.ts @@ -3,7 +3,7 @@ */ import { PatchedStateManager } from "@bluecadet/launchpad-utils/state-patcher"; -import type { ContentError } from "./content-plugin-driver.js"; +import type { ContentError } from "./content-plugin.js"; // need to import so declaration merging works import "@bluecadet/launchpad-utils/types"; diff --git a/packages/content/src/fetching/__tests__/fetch-context.test.ts b/packages/content/src/fetching/__tests__/fetch-context.test.ts index ec6e3071..10fbeef5 100644 --- a/packages/content/src/fetching/__tests__/fetch-context.test.ts +++ b/packages/content/src/fetching/__tests__/fetch-context.test.ts @@ -1,8 +1,8 @@ import { createMockEventBus, createMockLogger } from "@bluecadet/launchpad-testing/test-utils.ts"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import type { ResolvedContentConfig } from "../../content-config.js"; -import type { ContentPluginDriver } from "../../content-plugin-driver.js"; -import { defineSource } from "../../sources/source.js"; +import type { ContentPluginDriver } from "../../content-plugin.js"; +import { defineSource } from "../../source.js"; import type { DataStore } from "../../utils/data-store.js"; import type { FetchStageContext } from "../fetch-context.js"; diff --git a/packages/content/src/fetching/__tests__/fetch-stages.test.ts b/packages/content/src/fetching/__tests__/fetch-stages.test.ts index f6819c5c..463e6a6a 100644 --- a/packages/content/src/fetching/__tests__/fetch-stages.test.ts +++ b/packages/content/src/fetching/__tests__/fetch-stages.test.ts @@ -3,9 +3,9 @@ import { vol } from "memfs"; import { errAsync, okAsync } from "neverthrow"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import type { ResolvedContentConfig } from "../../content-config.js"; -import type { ContentPluginDriver } from "../../content-plugin-driver.js"; -import { ContentError } from "../../content-plugin-driver.js"; -import { defineSource } from "../../sources/source.js"; +import type { ContentPluginDriver } from "../../content-plugin.js"; +import { ContentError } from "../../content-plugin.js"; +import { defineSource } from "../../source.js"; import type { DataStore } from "../../utils/data-store.js"; import type { FetchStageContext } from "../fetch-context.js"; import { diff --git a/packages/content/src/fetching/fetch-context.ts b/packages/content/src/fetching/fetch-context.ts index 899fca8b..e228aa89 100644 --- a/packages/content/src/fetching/fetch-context.ts +++ b/packages/content/src/fetching/fetch-context.ts @@ -7,8 +7,8 @@ import type { EventBus } from "@bluecadet/launchpad-utils/controller-interfaces"; import type { Logger } from "@bluecadet/launchpad-utils/log-manager"; import type { ResolvedContentConfig } from "../content-config.js"; -import type { ContentPluginDriver } from "../content-plugin-driver.js"; -import type { ContentSource } from "../sources/source.js"; +import type { ContentPluginDriver } from "../content-plugin.js"; +import type { ContentSource } from "../source.js"; import type { DataStore } from "../utils/data-store.js"; /** diff --git a/packages/content/src/fetching/fetch-stages.ts b/packages/content/src/fetching/fetch-stages.ts index 17630fd7..edc89dcd 100644 --- a/packages/content/src/fetching/fetch-stages.ts +++ b/packages/content/src/fetching/fetch-stages.ts @@ -7,8 +7,8 @@ import chalk from "chalk"; import { errAsync, okAsync, ResultAsync } from "neverthrow"; -import { ContentError } from "../content-plugin-driver.js"; -import type { ContentSource } from "../sources/source.js"; +import { ContentError } from "../content-plugin.js"; +import type { ContentSource } from "../source.js"; import { FetchLogger } from "../utils/fetch-logger.js"; import * as FileUtils from "../utils/file-utils.js"; import type { FetchStageContext } from "./fetch-context.js"; diff --git a/packages/content/src/index.ts b/packages/content/src/index.ts deleted file mode 100755 index f2fb37eb..00000000 --- a/packages/content/src/index.ts +++ /dev/null @@ -1,13 +0,0 @@ -import LaunchpadContent from "./launchpad-content.js"; - -export * from "./content-commands.js"; -export * from "./content-config.js"; -export * from "./content-events.js"; -export * from "./content-plugin-driver.js"; -export * from "./content-state.js"; -export * from "./launchpad-content.js"; -export * from "./plugins/index.js"; -export * from "./sources/index.js"; -export * from "./utils/file-utils.js"; - -export default LaunchpadContent; diff --git a/packages/content/src/launchpad-content.ts b/packages/content/src/launchpad-content.ts index 758777c0..7a1ed30f 100644 --- a/packages/content/src/launchpad-content.ts +++ b/packages/content/src/launchpad-content.ts @@ -18,7 +18,7 @@ import { type ResolvedContentConfig, TIMESTAMP_TOKEN, } from "./content-config.js"; -import { ContentError, ContentPluginDriver } from "./content-plugin-driver.js"; +import { ContentError, ContentPluginDriver } from "./content-plugin.js"; import { type ContentState, ContentStateManager } from "./content-state.js"; import { backupStage, @@ -31,7 +31,7 @@ import { finalizingStage, setupHooksStage, } from "./fetching/fetch-stages.js"; -import type { ContentSource } from "./sources/source.js"; +import type { ContentSource } from "./source.js"; import { DataStore } from "./utils/data-store.js"; import * as FileUtils from "./utils/file-utils.js"; diff --git a/packages/content/src/plugins/index.ts b/packages/content/src/plugins/index.ts deleted file mode 100644 index a85c0176..00000000 --- a/packages/content/src/plugins/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -export { default as mdToHtml } from "./md-to-html.js"; -export { default as mediaDownloader } from "./media-downloader.js"; -export { default as sanityImageUrlTransform } from "./sanity-image-url-transform.js"; -export { default as sanityToHtml } from "./sanity-to-html.js"; -export { default as sanityToMd } from "./sanity-to-markdown.js"; -export { default as sanityToPlain } from "./sanity-to-plain.js"; -export { default as sharp } from "./sharp.js"; -export { default as symlink } from "./symlink.js"; diff --git a/packages/content/src/plugins/md-to-html.ts b/packages/content/src/plugins/md-to-html.ts index d5bd3dd8..a084bb92 100644 --- a/packages/content/src/plugins/md-to-html.ts +++ b/packages/content/src/plugins/md-to-html.ts @@ -2,7 +2,7 @@ import MarkdownIt from "markdown-it"; import sanitizeHtml from "sanitize-html"; import { z } from "zod"; -import { defineContentPlugin } from "../content-plugin-driver.js"; +import { defineContentPlugin } from "../content-plugin.js"; import { applyTransformToFiles } from "../utils/content-transform-utils.js"; import { dataKeysSchema } from "../utils/data-store.js"; import markdownItItalicBold from "../utils/markdown-it-italic-bold.js"; diff --git a/packages/content/src/plugins/media-downloader.ts b/packages/content/src/plugins/media-downloader.ts index 1289bce1..dfa3ba1d 100644 --- a/packages/content/src/plugins/media-downloader.ts +++ b/packages/content/src/plugins/media-downloader.ts @@ -5,7 +5,7 @@ import { pipeline } from "node:stream/promises"; import chalk from "chalk"; import { errAsync, ok, okAsync, ResultAsync } from "neverthrow"; import { z } from "zod"; -import { type ContentHookContext, defineContentPlugin } from "../content-plugin-driver.js"; +import { type ContentHookContext, defineContentPlugin } from "../content-plugin.js"; import type { DataStore } from "../utils/data-store.js"; import * as FileUtils from "../utils/file-utils.js"; import ResultAsyncQueue from "../utils/result-async-queue.js"; @@ -14,7 +14,7 @@ import { CacheProgressLogger, parsePluginConfig, queryOrUpdate } from "./content const DEFAULT_MEDIA_PATTERN = /https?.*\.(jpe?g|png|webp|avi|mov|mp4|mpg|mpeg|webm)(\?.*)?$/i; -declare module "../content-plugin-driver.js" { +declare module "../content-plugin.js" { interface ContentHookArgs { "plugin:media-downloader:mediaDownloaded": { url: string; sourceId: string; localPath: string }; } diff --git a/packages/content/src/plugins/sanity-image-url-transform.ts b/packages/content/src/plugins/sanity-image-url-transform.ts index f3ab9cc6..b2494316 100644 --- a/packages/content/src/plugins/sanity-image-url-transform.ts +++ b/packages/content/src/plugins/sanity-image-url-transform.ts @@ -6,7 +6,7 @@ import type { SanityReference, } from "@sanity/image-url/lib/types/types.js"; import { z } from "zod"; -import { defineContentPlugin } from "../content-plugin-driver.js"; +import { defineContentPlugin } from "../content-plugin.js"; import { applyTransformToFiles } from "../utils/content-transform-utils.js"; import { dataKeysSchema } from "../utils/data-store.js"; import { parsePluginConfig } from "./contentPluginHelpers.js"; diff --git a/packages/content/src/plugins/sanity-to-html.ts b/packages/content/src/plugins/sanity-to-html.ts index 46b85ca7..33bffe8b 100644 --- a/packages/content/src/plugins/sanity-to-html.ts +++ b/packages/content/src/plugins/sanity-to-html.ts @@ -1,5 +1,5 @@ import { z } from "zod"; -import { defineContentPlugin } from "../content-plugin-driver.js"; +import { defineContentPlugin } from "../content-plugin.js"; import { applyTransformToFiles, isBlockContent } from "../utils/content-transform-utils.js"; import { dataKeysSchema } from "../utils/data-store.js"; import { parsePluginConfig } from "./contentPluginHelpers.js"; diff --git a/packages/content/src/plugins/sanity-to-markdown.ts b/packages/content/src/plugins/sanity-to-markdown.ts index 44d5771d..47094315 100644 --- a/packages/content/src/plugins/sanity-to-markdown.ts +++ b/packages/content/src/plugins/sanity-to-markdown.ts @@ -1,5 +1,5 @@ import { z } from "zod"; -import { defineContentPlugin } from "../content-plugin-driver.js"; +import { defineContentPlugin } from "../content-plugin.js"; import { applyTransformToFiles, isBlockContent } from "../utils/content-transform-utils.js"; import { dataKeysSchema } from "../utils/data-store.js"; import { parsePluginConfig } from "./contentPluginHelpers.js"; diff --git a/packages/content/src/plugins/sanity-to-plain.ts b/packages/content/src/plugins/sanity-to-plain.ts index 02d41f50..439b4367 100644 --- a/packages/content/src/plugins/sanity-to-plain.ts +++ b/packages/content/src/plugins/sanity-to-plain.ts @@ -1,5 +1,5 @@ import { z } from "zod"; -import { defineContentPlugin } from "../content-plugin-driver.js"; +import { defineContentPlugin } from "../content-plugin.js"; import { applyTransformToFiles, isBlockContent } from "../utils/content-transform-utils.js"; import { dataKeysSchema } from "../utils/data-store.js"; import { parsePluginConfig } from "./contentPluginHelpers.js"; diff --git a/packages/content/src/plugins/sharp.ts b/packages/content/src/plugins/sharp.ts index 557643f2..3f1886e1 100644 --- a/packages/content/src/plugins/sharp.ts +++ b/packages/content/src/plugins/sharp.ts @@ -5,7 +5,7 @@ import chalk from "chalk"; import PQueue from "p-queue"; import type SharpType from "sharp"; import { z } from "zod"; -import { defineContentPlugin } from "../content-plugin-driver.js"; +import { defineContentPlugin } from "../content-plugin.js"; import { getMatchingDocuments, regexToJSONPathQuery } from "../utils/content-transform-utils.js"; import { dataKeysSchema } from "../utils/data-store.js"; import * as FileUtils from "../utils/file-utils.js"; diff --git a/packages/content/src/plugins/symlink.ts b/packages/content/src/plugins/symlink.ts index dd7160dd..737414b6 100644 --- a/packages/content/src/plugins/symlink.ts +++ b/packages/content/src/plugins/symlink.ts @@ -2,7 +2,7 @@ import fs from "node:fs/promises"; import path from "node:path"; import chalk from "chalk"; import { z } from "zod"; -import { defineContentPlugin } from "../content-plugin-driver.js"; +import { defineContentPlugin } from "../content-plugin.js"; import { parsePluginConfig } from "./contentPluginHelpers.js"; const symlinkSchema = z.object({ diff --git a/packages/content/src/sources/source.ts b/packages/content/src/source.ts similarity index 97% rename from packages/content/src/sources/source.ts rename to packages/content/src/source.ts index a995ec5c..65bb9759 100644 --- a/packages/content/src/sources/source.ts +++ b/packages/content/src/source.ts @@ -1,6 +1,6 @@ import type { Logger } from "@bluecadet/launchpad-utils/log-manager"; import { z } from "zod"; -import type { DataStore } from "../utils/data-store.js"; +import type { DataStore } from "./utils/data-store.js"; /** * Context object passed to the `fetch` method of a source. diff --git a/packages/content/src/sources/airtable-source.ts b/packages/content/src/sources/airtable-source.ts index 6609537b..0a5f3db4 100644 --- a/packages/content/src/sources/airtable-source.ts +++ b/packages/content/src/sources/airtable-source.ts @@ -1,7 +1,7 @@ import type { Logger } from "@bluecadet/launchpad-utils/log-manager"; import type Airtable from "airtable"; import { z } from "zod"; -import { defineSource } from "./source.js"; +import { defineSource } from "../source.js"; const airtableSourceSchema = z.object({ /** Required field to identify this source. Will be used as download path. */ diff --git a/packages/content/src/sources/contentful-source.ts b/packages/content/src/sources/contentful-source.ts index 4d853686..9cd9455c 100644 --- a/packages/content/src/sources/contentful-source.ts +++ b/packages/content/src/sources/contentful-source.ts @@ -1,7 +1,7 @@ import type { Asset, Entry } from "contentful"; import { z } from "zod"; +import { defineSource } from "../source.js"; import { fetchPaginated } from "../utils/fetch-paginated.js"; -import { defineSource } from "./source.js"; // If deliveryToken is provided, then previewToken is optional. const contentfulCredentialsSchema = z.union( diff --git a/packages/content/src/sources/index.ts b/packages/content/src/sources/index.ts deleted file mode 100644 index c8f568ea..00000000 --- a/packages/content/src/sources/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -export { default as airtableSource } from "./airtable-source.js"; -export { default as contentfulSource } from "./contentful-source.js"; -export { default as jsonSource } from "./json-source.js"; -export { default as sanitySource } from "./sanity-source.js"; -export * from "./source.js"; -export { default as strapiSource } from "./strapi-source.js"; diff --git a/packages/content/src/sources/json-source.ts b/packages/content/src/sources/json-source.ts index 71c26f84..8ffec61d 100644 --- a/packages/content/src/sources/json-source.ts +++ b/packages/content/src/sources/json-source.ts @@ -1,7 +1,7 @@ import chalk from "chalk"; import ky from "ky"; import { z } from "zod"; -import { defineSource } from "./source.js"; +import { defineSource } from "../source.js"; const jsonSourceSchema = z.object({ /** required field to identify this source. Will be used as download path. */ diff --git a/packages/content/src/sources/sanity-source.ts b/packages/content/src/sources/sanity-source.ts index 766bf659..6992f4ba 100644 --- a/packages/content/src/sources/sanity-source.ts +++ b/packages/content/src/sources/sanity-source.ts @@ -1,6 +1,6 @@ import { z } from "zod"; +import { defineSource } from "../source.js"; import { fetchPaginated } from "../utils/fetch-paginated.js"; -import { defineSource } from "./source.js"; const sanitySourceSchema = z.object({ /** Required field to identify this source. Will be used as download path. */ diff --git a/packages/content/src/sources/strapi-source.ts b/packages/content/src/sources/strapi-source.ts index 439393d6..c5202f15 100644 --- a/packages/content/src/sources/strapi-source.ts +++ b/packages/content/src/sources/strapi-source.ts @@ -2,8 +2,8 @@ import type { Logger } from "@bluecadet/launchpad-utils/log-manager"; import ky from "ky"; import qs from "qs"; import { z } from "zod"; +import { defineSource } from "../source.js"; import { fetchPaginated } from "../utils/fetch-paginated.js"; -import { defineSource } from "./source.js"; const strapiCredentialsSchema = z.union( [ From d99a4da566a6c83a36449179b0a12ac33634c851 Mon Sep 17 00:00:00 2001 From: Clay Tercek <30105080+claytercek@users.noreply.github.com> Date: Fri, 31 Oct 2025 11:46:01 -0700 Subject: [PATCH 04/10] refactor(monitor): remove monitor pkg barrel files --- packages/monitor/package.json | 20 +++++++++++++++++-- .../src/__tests__/launchpad-monitor.test.ts | 2 +- .../monitor-plugin.test.ts} | 4 ++-- .../src/__tests__/monitor-state.test.ts | 2 +- packages/monitor/src/index.ts | 11 ---------- packages/monitor/src/launchpad-monitor.ts | 2 +- packages/monitor/src/monitor-config.ts | 2 +- ...tor-plugin-driver.ts => monitor-plugin.ts} | 2 +- 8 files changed, 25 insertions(+), 20 deletions(-) rename packages/monitor/src/{core/__tests__/monitor-plugin-driver.test.ts => __tests__/monitor-plugin.test.ts} (97%) delete mode 100755 packages/monitor/src/index.ts rename packages/monitor/src/{core/monitor-plugin-driver.ts => monitor-plugin.ts} (98%) diff --git a/packages/monitor/package.json b/packages/monitor/package.json index a0f4b8f6..c7867f45 100644 --- a/packages/monitor/package.json +++ b/packages/monitor/package.json @@ -9,8 +9,24 @@ ], "exports": { ".": { - "types": "./dist/index.d.ts", - "default": "./dist/index.js" + "types": "./dist/launchpad-monitor.d.ts", + "default": "./dist/launchpad-monitor.js" + }, + "./plugin": { + "types": "./dist/monitor-plugin.d.ts", + "default": "./dist/monitor-plugin.js" + }, + "./commands": { + "types": "./dist/monitor-commands.d.ts", + "default": "./dist/monitor-commands.js" + }, + "./config": { + "types": "./dist/monitor-config.d.ts", + "default": "./dist/monitor-config.js" + }, + "./events": { + "types": "./dist/monitor-events.d.ts", + "default": "./dist/monitor-events.js" }, "./state": { "types": "./dist/monitor-state.d.ts", diff --git a/packages/monitor/src/__tests__/launchpad-monitor.test.ts b/packages/monitor/src/__tests__/launchpad-monitor.test.ts index 68e465bd..1c7da747 100644 --- a/packages/monitor/src/__tests__/launchpad-monitor.test.ts +++ b/packages/monitor/src/__tests__/launchpad-monitor.test.ts @@ -2,9 +2,9 @@ import { createMockLogger } from "@bluecadet/launchpad-testing/test-utils.ts"; import { okAsync } from "neverthrow"; import { describe, expect, it, vi } from "vitest"; import { AppManager } from "../core/app-manager.js"; -import type { MonitorPlugin } from "../core/monitor-plugin-driver.js"; import LaunchpadMonitor from "../launchpad-monitor.js"; import type { MonitorConfig } from "../monitor-config.js"; +import type { MonitorPlugin } from "../monitor-plugin.js"; // Mock process.exit to prevent tests from actually exiting // @ts-expect-error - mockImplementation returns undefined diff --git a/packages/monitor/src/core/__tests__/monitor-plugin-driver.test.ts b/packages/monitor/src/__tests__/monitor-plugin.test.ts similarity index 97% rename from packages/monitor/src/core/__tests__/monitor-plugin-driver.test.ts rename to packages/monitor/src/__tests__/monitor-plugin.test.ts index 424171ca..245e2e26 100644 --- a/packages/monitor/src/core/__tests__/monitor-plugin-driver.test.ts +++ b/packages/monitor/src/__tests__/monitor-plugin.test.ts @@ -2,8 +2,8 @@ import { createMockLogger } from "@bluecadet/launchpad-testing/test-utils.ts"; import type { Logger } from "@bluecadet/launchpad-utils/log-manager"; import { PluginDriver } from "@bluecadet/launchpad-utils/plugin-driver"; import { beforeEach, describe, expect, it, vi } from "vitest"; -import type LaunchpadMonitor from "../../launchpad-monitor.js"; -import { type MonitorPlugin, MonitorPluginDriver } from "../monitor-plugin-driver.js"; +import type LaunchpadMonitor from "../launchpad-monitor.js"; +import { type MonitorPlugin, MonitorPluginDriver } from "../monitor-plugin.js"; describe("MonitorPluginDriver", () => { let monitorPluginDriver: MonitorPluginDriver; diff --git a/packages/monitor/src/__tests__/monitor-state.test.ts b/packages/monitor/src/__tests__/monitor-state.test.ts index 8eb27e1b..f502ff1e 100644 --- a/packages/monitor/src/__tests__/monitor-state.test.ts +++ b/packages/monitor/src/__tests__/monitor-state.test.ts @@ -3,9 +3,9 @@ import { errAsync, okAsync } from "neverthrow"; import type pm2 from "pm2"; import { beforeEach, describe, expect, it, vi } from "vitest"; import { AppManager } from "../core/app-manager.js"; -import type { MonitorPlugin } from "../core/monitor-plugin-driver.js"; import LaunchpadMonitor from "../launchpad-monitor.js"; import type { MonitorConfig } from "../monitor-config.js"; +import type { MonitorPlugin } from "../monitor-plugin.js"; // Mock process.exit to prevent tests from actually exiting // @ts-expect-error - mockImplementation returns undefined diff --git a/packages/monitor/src/index.ts b/packages/monitor/src/index.ts deleted file mode 100755 index dfce5281..00000000 --- a/packages/monitor/src/index.ts +++ /dev/null @@ -1,11 +0,0 @@ -import LaunchpadMonitor from "./launchpad-monitor.js"; - -export * from "./core/monitor-plugin-driver.js"; -// export * from './windows-api.js'; // Includes optional dependencies, so not exported here -export * from "./launchpad-monitor.js"; -export * from "./monitor-commands.js"; -export * from "./monitor-config.js"; -export * from "./monitor-events.js"; -export * from "./monitor-state.js"; - -export default LaunchpadMonitor; diff --git a/packages/monitor/src/launchpad-monitor.ts b/packages/monitor/src/launchpad-monitor.ts index 9548c496..c454ecf7 100644 --- a/packages/monitor/src/launchpad-monitor.ts +++ b/packages/monitor/src/launchpad-monitor.ts @@ -15,7 +15,6 @@ import { errAsync, okAsync, ResultAsync } from "neverthrow"; import type pm2 from "pm2"; import { AppManager } from "./core/app-manager.js"; import { BusManager } from "./core/bus-manager.js"; -import { MonitorPluginDriver } from "./core/monitor-plugin-driver.js"; import { ProcessManager } from "./core/process-manager.js"; import type { MonitorCommand } from "./monitor-commands.js"; import { @@ -23,6 +22,7 @@ import { monitorConfigSchema, type ResolvedMonitorConfig, } from "./monitor-config.js"; +import { MonitorPluginDriver } from "./monitor-plugin.js"; import { type MonitorState, MonitorStateManager } from "./monitor-state.js"; class LaunchpadMonitor diff --git a/packages/monitor/src/monitor-config.ts b/packages/monitor/src/monitor-config.ts index 60268cf1..c88fac33 100644 --- a/packages/monitor/src/monitor-config.ts +++ b/packages/monitor/src/monitor-config.ts @@ -1,6 +1,6 @@ import type { StartOptions } from "pm2"; import { z } from "zod"; -import { monitorPluginSchema } from "./core/monitor-plugin-driver.js"; +import { monitorPluginSchema } from "./monitor-plugin.js"; const windowsApiConfigSchema = z.object({ /** diff --git a/packages/monitor/src/core/monitor-plugin-driver.ts b/packages/monitor/src/monitor-plugin.ts similarity index 98% rename from packages/monitor/src/core/monitor-plugin-driver.ts rename to packages/monitor/src/monitor-plugin.ts index 00357737..06971a79 100644 --- a/packages/monitor/src/core/monitor-plugin-driver.ts +++ b/packages/monitor/src/monitor-plugin.ts @@ -6,7 +6,7 @@ import { type PluginDriver, } from "@bluecadet/launchpad-utils/plugin-driver"; import type pm2 from "pm2"; -import type LaunchpadMonitor from "../launchpad-monitor.js"; +import type LaunchpadMonitor from "./launchpad-monitor.js"; type MonitorHookContext = { /** From 99fec1e30647c4504c52e2b3c88642a14d0efc0a Mon Sep 17 00:00:00 2001 From: Clay Tercek <30105080+claytercek@users.noreply.github.com> Date: Fri, 31 Oct 2025 12:52:48 -0700 Subject: [PATCH 05/10] refactor(controller): remove controller pkg barrel files --- packages/cli/src/commands/stop.ts | 2 +- packages/cli/src/launchpad-config.ts | 2 +- .../__tests__/controller-execution.test.ts | 14 +++++--- .../cli/src/utils/controller-execution.ts | 10 +++--- packages/controller/package.json | 20 +++++++++-- .../{ipc => }/__tests__/ipc-client.test.ts | 6 ++-- .../pid-utils.test.ts} | 4 +-- .../src/{core => }/controller-config.ts | 0 packages/controller/src/index.ts | 35 ------------------- .../controller/src/{ipc => }/ipc-client.ts | 12 +++---- .../controller/src/launchpad-controller.ts | 10 +++--- .../src/{core/pid-manager.ts => pid-utils.ts} | 0 .../controller/src/{core => }/transport.ts | 13 +++++-- .../__tests__/ipc-transport.test.ts | 4 +-- .../src/transports/ipc-transport.ts | 6 ++-- .../__tests__/ipc-serializer.test.ts | 0 .../__tests__/ipc-utils.test.ts | 0 .../src/{ipc => utils}/ipc-serializer.ts | 0 .../src/{ipc => utils}/ipc-utils.ts | 0 19 files changed, 65 insertions(+), 73 deletions(-) rename packages/controller/src/{ipc => }/__tests__/ipc-client.test.ts (99%) rename packages/controller/src/{core/__tests__/pid-manager.test.ts => __tests__/pid-utils.test.ts} (99%) rename packages/controller/src/{core => }/controller-config.ts (100%) delete mode 100644 packages/controller/src/index.ts rename packages/controller/src/{ipc => }/ipc-client.ts (97%) rename packages/controller/src/{core/pid-manager.ts => pid-utils.ts} (100%) rename packages/controller/src/{core => }/transport.ts (77%) rename packages/controller/src/{ipc => utils}/__tests__/ipc-serializer.test.ts (100%) rename packages/controller/src/{ipc => utils}/__tests__/ipc-utils.test.ts (100%) rename packages/controller/src/{ipc => utils}/ipc-serializer.ts (100%) rename packages/controller/src/{ipc => utils}/ipc-utils.ts (100%) diff --git a/packages/cli/src/commands/stop.ts b/packages/cli/src/commands/stop.ts index 4eefc443..7e284e39 100644 --- a/packages/cli/src/commands/stop.ts +++ b/packages/cli/src/commands/stop.ts @@ -1,5 +1,5 @@ import path from "node:path"; -import { deletePidFile, isProcessRunning } from "@bluecadet/launchpad-controller"; +import { deletePidFile, isProcessRunning } from "@bluecadet/launchpad-controller/pid-utils"; import { LogManager } from "@bluecadet/launchpad-utils/log-manager"; import { err, ok, type Result, ResultAsync } from "neverthrow"; import type { GlobalLaunchpadArgs } from "../cli.js"; diff --git a/packages/cli/src/launchpad-config.ts b/packages/cli/src/launchpad-config.ts index 9863a1d4..0b56a906 100644 --- a/packages/cli/src/launchpad-config.ts +++ b/packages/cli/src/launchpad-config.ts @@ -1,4 +1,4 @@ -import { controllerConfigSchema } from "@bluecadet/launchpad-controller"; +import { controllerConfigSchema } from "@bluecadet/launchpad-controller/config"; import type { LaunchpadConfig } from "@bluecadet/launchpad-utils/types"; /** diff --git a/packages/cli/src/utils/__tests__/controller-execution.test.ts b/packages/cli/src/utils/__tests__/controller-execution.test.ts index 254012b6..1c8a4fab 100644 --- a/packages/cli/src/utils/__tests__/controller-execution.test.ts +++ b/packages/cli/src/utils/__tests__/controller-execution.test.ts @@ -1,5 +1,5 @@ import path from "node:path"; -import type { ControllerConfig } from "@bluecadet/launchpad-controller"; +import type { ControllerConfig } from "@bluecadet/launchpad-controller/config"; import { createMockLogger } from "@bluecadet/launchpad-testing/test-utils.ts"; import { fs } from "memfs"; import { err, errAsync, ok, okAsync } from "neverthrow"; @@ -11,15 +11,19 @@ import { } from "../controller-execution.js"; vi.mock("@bluecadet/launchpad-controller", () => ({ - IPCClient: vi.fn(), LaunchpadController: vi.fn(), +})); +vi.mock("@bluecadet/launchpad-controller/ipc-client", () => ({ + IPCClient: vi.fn(), +})); +vi.mock("@bluecadet/launchpad-controller/pid-utils", () => ({ getDaemonPid: vi.fn(), })); // Import mocked modules -import * as ControllerModule from "@bluecadet/launchpad-controller"; - -const { IPCClient, LaunchpadController, getDaemonPid } = ControllerModule; +import { LaunchpadController } from "@bluecadet/launchpad-controller"; +import { IPCClient } from "@bluecadet/launchpad-controller/ipc-client"; +import { getDaemonPid } from "@bluecadet/launchpad-controller/pid-utils"; describe("controller-execution", () => { const baseDir = "/test/base"; diff --git a/packages/cli/src/utils/controller-execution.ts b/packages/cli/src/utils/controller-execution.ts index 5eef2886..6b613266 100644 --- a/packages/cli/src/utils/controller-execution.ts +++ b/packages/cli/src/utils/controller-execution.ts @@ -4,12 +4,10 @@ */ import path from "node:path"; -import { - type ControllerConfig, - getDaemonPid, - IPCClient, - LaunchpadController, -} from "@bluecadet/launchpad-controller"; +import { LaunchpadController } from "@bluecadet/launchpad-controller"; +import type { ControllerConfig } from "@bluecadet/launchpad-controller/config"; +import { IPCClient } from "@bluecadet/launchpad-controller/ipc-client"; +import { getDaemonPid } from "@bluecadet/launchpad-controller/pid-utils"; import type { Logger } from "@bluecadet/launchpad-utils/log-manager"; import { errAsync, type ResultAsync } from "neverthrow"; import { DaemonNotRunningError, IPCConnectionError } from "../errors.js"; diff --git a/packages/controller/package.json b/packages/controller/package.json index 9f73e912..e784a020 100644 --- a/packages/controller/package.json +++ b/packages/controller/package.json @@ -9,8 +9,24 @@ ], "exports": { ".": { - "types": "./dist/index.d.ts", - "default": "./dist/index.js" + "types": "./dist/launchpad-controller.d.ts", + "default": "./dist/launchpad-controller.js" + }, + "./config": { + "types": "./dist/controller-config.d.ts", + "default": "./dist/controller-config.js" + }, + "./ipc-client": { + "types": "./dist/ipc-client.d.ts", + "default": "./dist/ipc-client.js" + }, + "./pid-utils": { + "types": "./dist/pid-utils.d.ts", + "default": "./dist/pid-utils.js" + }, + "./transport": { + "types": "./dist/transport.d.ts", + "default": "./dist/transport.js" }, "./transports/ipc": { "types": "./dist/transports/ipc.d.ts", diff --git a/packages/controller/src/ipc/__tests__/ipc-client.test.ts b/packages/controller/src/__tests__/ipc-client.test.ts similarity index 99% rename from packages/controller/src/ipc/__tests__/ipc-client.test.ts rename to packages/controller/src/__tests__/ipc-client.test.ts index aacf87a5..eefe1849 100644 --- a/packages/controller/src/ipc/__tests__/ipc-client.test.ts +++ b/packages/controller/src/__tests__/ipc-client.test.ts @@ -1,9 +1,9 @@ import net from "node:net"; import { afterEach, describe, expect, it, vi } from "vitest"; -import type { IPCEvent, IPCResponse } from "../../transports/ipc-transport.js"; import { IPCClient } from "../ipc-client.js"; -import { IPCSerializer } from "../ipc-serializer.js"; -import { getOSSocketPath } from "../ipc-utils.js"; +import type { IPCEvent, IPCResponse } from "../transports/ipc-transport.js"; +import { IPCSerializer } from "../utils/ipc-serializer.js"; +import { getOSSocketPath } from "../utils/ipc-utils.js"; type Cb = (...args: any[]) => void; diff --git a/packages/controller/src/core/__tests__/pid-manager.test.ts b/packages/controller/src/__tests__/pid-utils.test.ts similarity index 99% rename from packages/controller/src/core/__tests__/pid-manager.test.ts rename to packages/controller/src/__tests__/pid-utils.test.ts index ac3f6cf4..98f02a17 100644 --- a/packages/controller/src/core/__tests__/pid-manager.test.ts +++ b/packages/controller/src/__tests__/pid-utils.test.ts @@ -7,9 +7,9 @@ import { isProcessRunning, readPidFile, writePidFile, -} from "../pid-manager.js"; +} from "../pid-utils.js"; -describe("pid-manager", () => { +describe("pid-utils", () => { describe("writePidFile", () => { it("should write PID to file", () => { const result = writePidFile("/test/pid", 12345); diff --git a/packages/controller/src/core/controller-config.ts b/packages/controller/src/controller-config.ts similarity index 100% rename from packages/controller/src/core/controller-config.ts rename to packages/controller/src/controller-config.ts diff --git a/packages/controller/src/index.ts b/packages/controller/src/index.ts deleted file mode 100644 index f9c27634..00000000 --- a/packages/controller/src/index.ts +++ /dev/null @@ -1,35 +0,0 @@ -// Command dispatcher -export { CommandDispatcher } from "./core/command-dispatcher.js"; - -// Core types -export type { Command, CommandType } from "./core/commands.js"; -export type { - ControllerConfig, - ControllerMode, -} from "./core/controller-config.js"; -export { controllerConfigSchema } from "./core/controller-config.js"; - -// Event bus -export { EventBus } from "./core/event-bus.js"; -export { - deletePidFile, - getDaemonPid, - isProcessRunning, - readPidFile, - writePidFile, -} from "./core/pid-manager.js"; -// State store -export type { - LaunchpadState, - SystemState, -} from "./core/state-store.js"; -export { StateStore } from "./core/state-store.js"; -// Transport system (for future transports like WebSocket, OSC) -export type { Transport, TransportContext } from "./core/transport.js"; -// IPC client and types for CLI -export { IPCClient } from "./ipc/ipc-client.js"; -export { LaunchpadController } from "./launchpad-controller.js"; -export type { - IPCMessage, - IPCResponse, -} from "./transports/ipc-transport.js"; diff --git a/packages/controller/src/ipc/ipc-client.ts b/packages/controller/src/ipc-client.ts similarity index 97% rename from packages/controller/src/ipc/ipc-client.ts rename to packages/controller/src/ipc-client.ts index 6899a600..c81d2ea1 100644 --- a/packages/controller/src/ipc/ipc-client.ts +++ b/packages/controller/src/ipc-client.ts @@ -8,12 +8,12 @@ import type { BaseCommand } from "@bluecadet/launchpad-utils/controller-interfac import type { LaunchpadEvents } from "@bluecadet/launchpad-utils/types"; import { applyPatches, enablePatches, type Patch } from "immer"; import { errAsync, okAsync, ResultAsync } from "neverthrow"; -import { EventBus } from "../core/event-bus.js"; -import type { LaunchpadState } from "../core/state-store.js"; -import { IPCConnectionError, IPCMessageError, IPCTimeoutError } from "../errors.js"; -import type { IPCBroadcastMessage, IPCMessage, IPCResponse } from "../transports/ipc-transport.js"; -import { IPCSerializer } from "./ipc-serializer.js"; -import { getOSSocketPath } from "./ipc-utils.js"; +import { EventBus } from "./core/event-bus.js"; +import type { LaunchpadState } from "./core/state-store.js"; +import { IPCConnectionError, IPCMessageError, IPCTimeoutError } from "./errors.js"; +import type { IPCBroadcastMessage, IPCMessage, IPCResponse } from "./transports/ipc-transport.js"; +import { IPCSerializer } from "./utils/ipc-serializer.js"; +import { getOSSocketPath } from "./utils/ipc-utils.js"; enablePatches(); diff --git a/packages/controller/src/launchpad-controller.ts b/packages/controller/src/launchpad-controller.ts index cac94eea..aa20716d 100644 --- a/packages/controller/src/launchpad-controller.ts +++ b/packages/controller/src/launchpad-controller.ts @@ -4,14 +4,16 @@ import type { Logger } from "@bluecadet/launchpad-utils/log-manager"; import { LogManager } from "@bluecadet/launchpad-utils/log-manager"; import { onExit } from "@bluecadet/launchpad-utils/on-exit"; import { errAsync, okAsync, ResultAsync } from "neverthrow"; +import type { ControllerConfig, ControllerMode } from "./controller-config.js"; import { CommandDispatcher } from "./core/command-dispatcher.js"; -import type { ControllerConfig, ControllerMode } from "./core/controller-config.js"; import { EventBus } from "./core/event-bus.js"; -import { deletePidFile, getDaemonPid, writePidFile } from "./core/pid-manager.js"; -import { StateStore } from "./core/state-store.js"; -import type { Transport } from "./core/transport.js"; +import { type LaunchpadState, StateStore } from "./core/state-store.js"; +import { deletePidFile, getDaemonPid, writePidFile } from "./pid-utils.js"; +import type { Transport } from "./transport.js"; import { createIPCTransport } from "./transports/ipc-transport.js"; +export type { LaunchpadState }; + /** * LaunchpadController is the central orchestrator for Launchpad. * diff --git a/packages/controller/src/core/pid-manager.ts b/packages/controller/src/pid-utils.ts similarity index 100% rename from packages/controller/src/core/pid-manager.ts rename to packages/controller/src/pid-utils.ts diff --git a/packages/controller/src/core/transport.ts b/packages/controller/src/transport.ts similarity index 77% rename from packages/controller/src/core/transport.ts rename to packages/controller/src/transport.ts index 20f77361..2f1cb781 100644 --- a/packages/controller/src/core/transport.ts +++ b/packages/controller/src/transport.ts @@ -6,9 +6,9 @@ import type { Logger } from "@bluecadet/launchpad-utils/log-manager"; import type { ResultAsync } from "neverthrow"; -import type { CommandDispatcher } from "./command-dispatcher.js"; -import type { EventBus } from "./event-bus.js"; -import type { StateStore } from "./state-store.js"; +import type { CommandDispatcher } from "./core/command-dispatcher.js"; +import type { EventBus } from "./core/event-bus.js"; +import type { StateStore } from "./core/state-store.js"; /** * Context passed to transports on start/stop @@ -46,3 +46,10 @@ export interface Transport { */ stop(ctx: TransportContext): ResultAsync; } + +/** + * This function doesn't do anything, just a helper for typing transports + */ +export function defineTransport(transport: T): T { + return transport; +} diff --git a/packages/controller/src/transports/__tests__/ipc-transport.test.ts b/packages/controller/src/transports/__tests__/ipc-transport.test.ts index da4fb2ad..9b32bf86 100644 --- a/packages/controller/src/transports/__tests__/ipc-transport.test.ts +++ b/packages/controller/src/transports/__tests__/ipc-transport.test.ts @@ -3,8 +3,8 @@ import { createMockEventBus, createMockLogger } from "@bluecadet/launchpad-testi import { fs } from "memfs"; import { okAsync } from "neverthrow"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; -import type { Transport, TransportContext } from "../../core/transport.js"; -import { IPCSerializer } from "../../ipc/ipc-serializer.js"; +import type { Transport, TransportContext } from "../../transport.js"; +import { IPCSerializer } from "../../utils/ipc-serializer.js"; import { createIPCTransport, type IPCMessage, type IPCResponse } from "../ipc-transport.js"; type Cb = (...args: any[]) => void; diff --git a/packages/controller/src/transports/ipc-transport.ts b/packages/controller/src/transports/ipc-transport.ts index ee8fbb55..b808d679 100644 --- a/packages/controller/src/transports/ipc-transport.ts +++ b/packages/controller/src/transports/ipc-transport.ts @@ -11,15 +11,15 @@ import chalk from "chalk"; import type { Patch } from "immer"; import { ResultAsync } from "neverthrow"; import type { VersionedLaunchpadState } from "../core/state-store.js"; -import type { Transport, TransportContext } from "../core/transport.js"; import { CommandExecutionError, IPCMessageError, StateAccessError, TransportError, } from "../errors.js"; -import { IPCSerializer } from "../ipc/ipc-serializer.js"; -import { getOSSocketPath } from "../ipc/ipc-utils.js"; +import type { Transport, TransportContext } from "../transport.js"; +import { IPCSerializer } from "../utils/ipc-serializer.js"; +import { getOSSocketPath } from "../utils/ipc-utils.js"; export type IPCTransportOptions = { /** Path to the Unix socket file */ diff --git a/packages/controller/src/ipc/__tests__/ipc-serializer.test.ts b/packages/controller/src/utils/__tests__/ipc-serializer.test.ts similarity index 100% rename from packages/controller/src/ipc/__tests__/ipc-serializer.test.ts rename to packages/controller/src/utils/__tests__/ipc-serializer.test.ts diff --git a/packages/controller/src/ipc/__tests__/ipc-utils.test.ts b/packages/controller/src/utils/__tests__/ipc-utils.test.ts similarity index 100% rename from packages/controller/src/ipc/__tests__/ipc-utils.test.ts rename to packages/controller/src/utils/__tests__/ipc-utils.test.ts diff --git a/packages/controller/src/ipc/ipc-serializer.ts b/packages/controller/src/utils/ipc-serializer.ts similarity index 100% rename from packages/controller/src/ipc/ipc-serializer.ts rename to packages/controller/src/utils/ipc-serializer.ts diff --git a/packages/controller/src/ipc/ipc-utils.ts b/packages/controller/src/utils/ipc-utils.ts similarity index 100% rename from packages/controller/src/ipc/ipc-utils.ts rename to packages/controller/src/utils/ipc-utils.ts From d8e1be62faab94736e5c55c0a30d0ce597e5f7f6 Mon Sep 17 00:00:00 2001 From: Clay Tercek <30105080+claytercek@users.noreply.github.com> Date: Fri, 31 Oct 2025 12:54:42 -0700 Subject: [PATCH 06/10] refactor(cli): remove cli pkg barrel files --- packages/cli/package.json | 4 ++-- packages/cli/src/cli.ts | 2 -- packages/cli/src/index.ts | 1 - 3 files changed, 2 insertions(+), 5 deletions(-) delete mode 100644 packages/cli/src/index.ts diff --git a/packages/cli/package.json b/packages/cli/package.json index 4abafc20..c879fdcc 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -12,8 +12,8 @@ }, "exports": { ".": { - "types": "./dist/index.d.ts", - "default": "./dist/index.js" + "types": "./dist/launchpad-config.d.ts", + "default": "./dist/launchpad-config.js" }, "./package.json": "./package.json" }, diff --git a/packages/cli/src/cli.ts b/packages/cli/src/cli.ts index 7a41dce2..bc8ee565 100755 --- a/packages/cli/src/cli.ts +++ b/packages/cli/src/cli.ts @@ -3,8 +3,6 @@ import { hideBin } from "yargs/helpers"; import yargs from "yargs/yargs"; -export { defineConfig } from "./launchpad-config.js"; - export type GlobalLaunchpadArgs = { config?: string; env?: (string | number)[]; diff --git a/packages/cli/src/index.ts b/packages/cli/src/index.ts deleted file mode 100644 index 7215fc45..00000000 --- a/packages/cli/src/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { defineConfig } from "./launchpad-config.js"; From dc75185d5236bff6d8ef25efcae47fa1e2853b1b Mon Sep 17 00:00:00 2001 From: Clay Tercek <30105080+claytercek@users.noreply.github.com> Date: Mon, 3 Nov 2025 10:13:02 -0800 Subject: [PATCH 07/10] refactor(launchpad): add re-export generation to launchpad package --- biome.json | 2 +- packages/launchpad/README.md | 1 + packages/launchpad/biome.json | 12 +++ packages/launchpad/package.json | 144 +++++++++++++++++++++++-- packages/launchpad/scripts/generate.ts | 89 +++++++++++++++ packages/launchpad/src/index.ts | 4 - packages/launchpad/tsconfig.json | 5 +- 7 files changed, 243 insertions(+), 14 deletions(-) create mode 100644 packages/launchpad/biome.json create mode 100644 packages/launchpad/scripts/generate.ts delete mode 100644 packages/launchpad/src/index.ts diff --git a/biome.json b/biome.json index adae4fa5..d45c2448 100644 --- a/biome.json +++ b/biome.json @@ -7,7 +7,7 @@ }, "files": { "ignoreUnknown": false, - "includes": ["**/src/**/*.ts", "**/docs/**/*.ts", "**/docs/**/*.mts"] + "includes": ["**/src/**/*.ts", "**/docs/**/*.ts", "**/docs/**/*.mts", "**/scripts/**/*.ts"] }, "formatter": { "enabled": true, diff --git a/packages/launchpad/README.md b/packages/launchpad/README.md index 0134f091..6c4f7cbd 100644 --- a/packages/launchpad/README.md +++ b/packages/launchpad/README.md @@ -18,6 +18,7 @@ This will install all core packages: - `@bluecadet/launchpad-cli`: Command line interface - `@bluecadet/launchpad-content`: Content management - `@bluecadet/launchpad-monitor`: Process monitoring +- `@bluecadet/launchpad-controller`: Central orchestration and event system - `@bluecadet/launchpad-scaffold`: System configuration ## Basic Usage diff --git a/packages/launchpad/biome.json b/packages/launchpad/biome.json new file mode 100644 index 00000000..49c9b550 --- /dev/null +++ b/packages/launchpad/biome.json @@ -0,0 +1,12 @@ +{ + "$schema": "https://biomejs.dev/schemas/2.0.6/schema.json", + "root": false, + "extends": "//", + "linter": { + "rules": { + "performance": { + "noBarrelFile": "off" + } + } + } +} diff --git a/packages/launchpad/package.json b/packages/launchpad/package.json index 36a1a2b9..c9238960 100644 --- a/packages/launchpad/package.json +++ b/packages/launchpad/package.json @@ -8,7 +8,8 @@ "type": "module", "scripts": { "start": "node index.js", - "test": "cd test && node test.js" + "generate": "node --experimental-strip-types ./scripts/generate.ts", + "build": "tsc -b && npm run generate" }, "repository": { "type": "git", @@ -23,11 +24,142 @@ "dist/**/*.d.ts" ], "exports": { - ".": { - "types": "./dist/index.d.ts", - "default": "./dist/index.js" + "./cli": { + "default": "./dist/cli/index.js", + "types": "./dist/cli/index.d.ts" }, - "./package.json": "./package.json" + "./content": { + "default": "./dist/content/index.js", + "types": "./dist/content/index.d.ts" + }, + "./content/commands": { + "default": "./dist/content/commands.js", + "types": "./dist/content/commands.d.ts" + }, + "./content/config": { + "default": "./dist/content/config.js", + "types": "./dist/content/config.d.ts" + }, + "./content/events": { + "default": "./dist/content/events.js", + "types": "./dist/content/events.d.ts" + }, + "./content/state": { + "default": "./dist/content/state.js", + "types": "./dist/content/state.d.ts" + }, + "./content/plugin": { + "default": "./dist/content/plugin.js", + "types": "./dist/content/plugin.d.ts" + }, + "./content/plugins/md-to-html": { + "default": "./dist/content/plugins/md-to-html.js", + "types": "./dist/content/plugins/md-to-html.d.ts" + }, + "./content/plugins/media-downloader": { + "default": "./dist/content/plugins/media-downloader.js", + "types": "./dist/content/plugins/media-downloader.d.ts" + }, + "./content/plugins/sanity-image-url-transform": { + "default": "./dist/content/plugins/sanity-image-url-transform.js", + "types": "./dist/content/plugins/sanity-image-url-transform.d.ts" + }, + "./content/plugins/sanity-to-html": { + "default": "./dist/content/plugins/sanity-to-html.js", + "types": "./dist/content/plugins/sanity-to-html.d.ts" + }, + "./content/plugins/sanity-to-markdown": { + "default": "./dist/content/plugins/sanity-to-markdown.js", + "types": "./dist/content/plugins/sanity-to-markdown.d.ts" + }, + "./content/plugins/sanity-to-plain": { + "default": "./dist/content/plugins/sanity-to-plain.js", + "types": "./dist/content/plugins/sanity-to-plain.d.ts" + }, + "./content/plugins/sharp": { + "default": "./dist/content/plugins/sharp.js", + "types": "./dist/content/plugins/sharp.d.ts" + }, + "./content/plugins/symlink": { + "default": "./dist/content/plugins/symlink.js", + "types": "./dist/content/plugins/symlink.d.ts" + }, + "./content/source": { + "default": "./dist/content/source.js", + "types": "./dist/content/source.d.ts" + }, + "./content/sources/airtable": { + "default": "./dist/content/sources/airtable.js", + "types": "./dist/content/sources/airtable.d.ts" + }, + "./content/sources/contentful": { + "default": "./dist/content/sources/contentful.js", + "types": "./dist/content/sources/contentful.d.ts" + }, + "./content/sources/json": { + "default": "./dist/content/sources/json.js", + "types": "./dist/content/sources/json.d.ts" + }, + "./content/sources/sanity": { + "default": "./dist/content/sources/sanity.js", + "types": "./dist/content/sources/sanity.d.ts" + }, + "./content/sources/strapi": { + "default": "./dist/content/sources/strapi.js", + "types": "./dist/content/sources/strapi.d.ts" + }, + "./controller": { + "default": "./dist/controller/index.js", + "types": "./dist/controller/index.d.ts" + }, + "./controller/config": { + "default": "./dist/controller/config.js", + "types": "./dist/controller/config.d.ts" + }, + "./controller/ipc-client": { + "default": "./dist/controller/ipc-client.js", + "types": "./dist/controller/ipc-client.d.ts" + }, + "./controller/pid-utils": { + "default": "./dist/controller/pid-utils.js", + "types": "./dist/controller/pid-utils.d.ts" + }, + "./controller/transport": { + "default": "./dist/controller/transport.js", + "types": "./dist/controller/transport.d.ts" + }, + "./controller/transports/ipc": { + "default": "./dist/controller/transports/ipc.js", + "types": "./dist/controller/transports/ipc.d.ts" + }, + "./monitor": { + "default": "./dist/monitor/index.js", + "types": "./dist/monitor/index.d.ts" + }, + "./monitor/plugin": { + "default": "./dist/monitor/plugin.js", + "types": "./dist/monitor/plugin.d.ts" + }, + "./monitor/commands": { + "default": "./dist/monitor/commands.js", + "types": "./dist/monitor/commands.d.ts" + }, + "./monitor/config": { + "default": "./dist/monitor/config.js", + "types": "./dist/monitor/config.d.ts" + }, + "./monitor/events": { + "default": "./dist/monitor/events.js", + "types": "./dist/monitor/events.d.ts" + }, + "./monitor/state": { + "default": "./dist/monitor/state.js", + "types": "./dist/monitor/state.d.ts" + }, + "./scaffold": { + "default": "./dist/scaffold/index.js", + "types": "./dist/scaffold/index.d.ts" + } }, "maintainers": [ { @@ -89,4 +221,4 @@ "tools", "windows-desktop" ] -} +} \ No newline at end of file diff --git a/packages/launchpad/scripts/generate.ts b/packages/launchpad/scripts/generate.ts new file mode 100644 index 00000000..f8bb694e --- /dev/null +++ b/packages/launchpad/scripts/generate.ts @@ -0,0 +1,89 @@ +import fs from "node:fs"; +import path from "node:path"; + +// Clear dist folder +const distPath = path.resolve(import.meta.dirname, "..", "dist"); +if (fs.existsSync(distPath)) { + fs.rmSync(distPath, { recursive: true, force: true }); +} + +// Define your packages +const packages = [ + { name: "@bluecadet/launchpad-cli", alias: "cli" }, + { name: "@bluecadet/launchpad-content", alias: "content" }, + { name: "@bluecadet/launchpad-controller", alias: "controller" }, + { name: "@bluecadet/launchpad-monitor", alias: "monitor" }, + { name: "@bluecadet/launchpad-scaffold", alias: "scaffold" }, +]; + +const reExports: Record = {}; + +// for each export in the package.json of each package, generate a corresponding .js and .d.ts file +for (const pkg of packages) { + try { + const packageJson = (await import(`${pkg.name}/package.json`, { with: { type: "json" } })) + .default; + const exports = packageJson.exports; + + for (const exportPath in exports) { + if (exportPath === "./package.json") { + continue; // Skip package.json export + } + + let exportKey = exportPath; + if (exportKey.startsWith("./")) { + exportKey = exportKey.slice(2); + } + if (exportKey === "." || exportKey === "") { + exportKey = "index"; + } + + const jsFilePath = path.resolve( + import.meta.dirname, + "..", + "dist", + pkg.alias, + `${exportKey}.js`, + ); + const dtsFilePath = path.resolve( + import.meta.dirname, + "..", + "dist", + pkg.alias, + `${exportKey}.d.ts`, + ); + + // Create directory if it doesn't exist + const dir = path.dirname(jsFilePath); + if (!fs.existsSync(dir)) { + fs.mkdirSync(dir, { recursive: true }); + } + + const exportPathForImport = exportKey === "index" ? "" : `/${exportKey.replace(/\.js$/, "")}`; + + const content = `export * from "${pkg.name}${exportPathForImport}";\n`; + + // Generate .js file with re-export + fs.writeFileSync(jsFilePath, content, "utf-8"); + // Generate .d.ts file with re-export + fs.writeFileSync(dtsFilePath, content, "utf-8"); + + reExports[`./${pkg.alias}${exportPathForImport}`] = { + default: `./dist/${pkg.alias}/${exportKey}.js`, + types: `./dist/${pkg.alias}/${exportKey}.d.ts`, + }; + } + } catch (error) { + console.error(`Error processing package ${pkg.name}:`); + console.error(error); + } +} + +const mainPackageJsonPath = path.resolve(import.meta.dirname, "../package.json"); +const mainPackageJson = JSON.parse(fs.readFileSync(mainPackageJsonPath, "utf-8")); + +// Update main package.json exports +mainPackageJson.exports = reExports; + +// Write the updated main package.json back to disk +fs.writeFileSync(mainPackageJsonPath, JSON.stringify(mainPackageJson, null, 2), "utf-8"); diff --git a/packages/launchpad/src/index.ts b/packages/launchpad/src/index.ts deleted file mode 100644 index a4f22312..00000000 --- a/packages/launchpad/src/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from "@bluecadet/launchpad-cli"; -export * from "@bluecadet/launchpad-content"; -export * from "@bluecadet/launchpad-controller"; -export * from "@bluecadet/launchpad-monitor"; diff --git a/packages/launchpad/tsconfig.json b/packages/launchpad/tsconfig.json index da0908e2..12689c31 100644 --- a/packages/launchpad/tsconfig.json +++ b/packages/launchpad/tsconfig.json @@ -1,11 +1,10 @@ { "extends": "@bluecadet/launchpad-tsconfig/base.json", "compilerOptions": { - "outDir": "dist", - "rootDir": "src" + "noEmit": true }, "include": [ - "src/**/*.ts" + "scripts/**/*.ts" ], "exclude": [ "**/*.test.ts", From 44c350dab4bec08e09e7b4ba3003434e73a79efc Mon Sep 17 00:00:00 2001 From: Clay Tercek <30105080+claytercek@users.noreply.github.com> Date: Mon, 3 Nov 2025 10:32:48 -0800 Subject: [PATCH 08/10] docs: update docs to use new import paths --- docs/src/guides/downloading-media.md | 5 +++-- docs/src/guides/fetching-content.md | 2 +- docs/src/guides/getting-started.md | 7 ++++++- docs/src/recipes/custom-content-source.md | 4 ++-- docs/src/recipes/transforming-sanity-images.md | 11 ++++++----- docs/src/reference/cli/config-loading.md | 2 +- docs/src/reference/content/index.md | 2 +- docs/src/reference/content/plugins/md-to-html.md | 2 +- .../src/reference/content/plugins/media-downloader.md | 2 +- .../content/plugins/sanity-image-url-transform.md | 2 +- docs/src/reference/content/plugins/sanity-to-html.md | 2 +- docs/src/reference/content/plugins/sanity-to-md.md | 2 +- docs/src/reference/content/plugins/sanity-to-plain.md | 2 +- docs/src/reference/content/plugins/sharp.md | 2 +- docs/src/reference/content/plugins/symlink.md | 2 +- docs/src/reference/content/sources/airtable-source.md | 2 +- .../reference/content/sources/contentful-source.md | 2 +- docs/src/reference/content/sources/index.md | 2 +- docs/src/reference/content/sources/json-source.md | 2 +- docs/src/reference/content/sources/sanity-source.md | 2 +- docs/src/reference/content/sources/strapi-source.md | 2 +- docs/src/reference/controller/events.md | 2 -- docs/src/reference/monitor/index.md | 2 +- docs/src/reference/scaffold/index.md | 2 +- 24 files changed, 36 insertions(+), 31 deletions(-) diff --git a/docs/src/guides/downloading-media.md b/docs/src/guides/downloading-media.md index d4d39789..8f127b42 100644 --- a/docs/src/guides/downloading-media.md +++ b/docs/src/guides/downloading-media.md @@ -17,7 +17,7 @@ First, add the `mediaDownloader` plugin to your configuration: ```ts import { defineConfig } from '@bluecadet/launchpad-cli'; -import { mediaDownloader } from '@bluecadet/launchpad-content'; +import { mediaDownloader } from '@bluecadet/launchpad-content/plugins/media-downloader'; export default defineConfig({ content: { @@ -49,7 +49,8 @@ Add the sharp plugin *after* the media downloader: ```ts{8-13} import { defineConfig } from '@bluecadet/launchpad-cli'; -import { mediaDownloader, sharp } from '@bluecadet/launchpad-content'; +import { mediaDownloader } from '@bluecadet/launchpad-content/plugins/media-downloader'; +import { sharp } from '@bluecadet/launchpad-content/plugins/sharp'; export default defineConfig({ content: { diff --git a/docs/src/guides/fetching-content.md b/docs/src/guides/fetching-content.md index 6ad72115..b85afcdd 100644 --- a/docs/src/guides/fetching-content.md +++ b/docs/src/guides/fetching-content.md @@ -9,7 +9,7 @@ Content fetching requires a `ContentConfig` object in your Launchpad configurati ```js // launchpad.config.js import { defineConfig } from '@bluecadet/launchpad-cli'; -import { jsonSource } from '@bluecadet/launchpad-content'; +import { jsonSource } from '@bluecadet/launchpad-content/sources/json'; export default defineConfig({ content: { diff --git a/docs/src/guides/getting-started.md b/docs/src/guides/getting-started.md index 0e5a8512..2c03b61f 100644 --- a/docs/src/guides/getting-started.md +++ b/docs/src/guides/getting-started.md @@ -24,6 +24,11 @@ Alternatively, install everything at once: npm install @bluecadet/launchpad ``` +> [!TIP] +> These docs assume you have installed the packages individually. If you installed the monorepo package (`@bluecadet/launchpad`), you can adjust the import paths by replacing `@bluecadet/launchpad-` with `@bluecadet/launchpad/`. +> +> For example, `@bluecadet/launchpad-content/plugins/sharp` becomes `@bluecadet/launchpad/content/plugins/sharp`. + ## Basic Setup 1. Create a configuration file: @@ -31,7 +36,7 @@ npm install @bluecadet/launchpad ```js // launchpad.config.js (or launchpad.config.ts, launchpad.config.mjs, etc.) import { defineConfig } from '@bluecadet/launchpad-cli'; -import { jsonSource } from '@bluecadet/launchpad-content'; +import { jsonSource } from '@bluecadet/launchpad-content/sources/json'; export default defineConfig({ content: { diff --git a/docs/src/recipes/custom-content-source.md b/docs/src/recipes/custom-content-source.md index 8629c5ff..00089d97 100644 --- a/docs/src/recipes/custom-content-source.md +++ b/docs/src/recipes/custom-content-source.md @@ -16,7 +16,7 @@ Content sources in Launchpad: Here's a minimal content source example: ```typescript -import { defineSource } from '@bluecadet/launchpad-content'; +import { defineSource } from '@bluecadet/launchpad-content/source'; export default defineSource({ id: 'my-custom-source', @@ -34,7 +34,7 @@ export default defineSource({ Let's create a source that fetches data from a REST API: ```typescript -import { defineSource } from '@bluecadet/launchpad-content'; +import { defineSource } from '@bluecadet/launchpad-content/source'; const myApiSource = defineSource({ id: 'api-source', diff --git a/docs/src/recipes/transforming-sanity-images.md b/docs/src/recipes/transforming-sanity-images.md index a6f57c10..cac1de87 100644 --- a/docs/src/recipes/transforming-sanity-images.md +++ b/docs/src/recipes/transforming-sanity-images.md @@ -7,8 +7,8 @@ When working with Sanity.io images, you can leverage Sanity's built-in image tra First, ensure your GROQ query includes all necessary image fields: ```typescript{12-17} -import { defineConfig } from '@bluecadet/launchpad-core'; -import { sanitySource } from '@bluecadet/launchpad-content'; +import { defineConfig } from '@bluecadet/launchpad-cli'; +import { sanitySource } from '@bluecadet/launchpad-content/sources/sanity'; export default defineConfig({ content: { @@ -40,9 +40,10 @@ The `asset->` reference is crucial for accessing the full image data, including Add the `sanityImageUrlTransform` plugin to transform image references into URLs: -```typescript{14-22} -import { defineConfig } from '@bluecadet/launchpad-core'; -import { sanityImageUrlTransform, sanitySource } from '@bluecadet/launchpad-content'; +```typescript{15-23} +import { defineConfig } from '@bluecadet/launchpad-cli'; +import { sanitySource } from '@bluecadet/launchpad-content/sources/sanity'; +import { sanityImageUrlTransform } from '@bluecadet/launchpad-content/plugins/sanity-image-url-transform'; export default defineConfig({ content: { diff --git a/docs/src/reference/cli/config-loading.md b/docs/src/reference/cli/config-loading.md index 088f5247..05b4dfae 100644 --- a/docs/src/reference/cli/config-loading.md +++ b/docs/src/reference/cli/config-loading.md @@ -56,7 +56,7 @@ When using TypeScript or an editor with TypeScript support (like VS Code), the ` ```js import { defineConfig } from '@bluecadet/launchpad-cli'; -import { jsonSource } from '@bluecadet/launchpad-content'; +import { jsonSource } from '@bluecadet/launchpad-content/sources/json'; export default defineConfig({ content: { diff --git a/docs/src/reference/content/index.md b/docs/src/reference/content/index.md index c1709623..4563132e 100644 --- a/docs/src/reference/content/index.md +++ b/docs/src/reference/content/index.md @@ -36,7 +36,7 @@ The content package is a powerful tool for downloading, transforming, and managi npm install @bluecadet/launchpad-content ``` -## Basic Usage +## JS API Usage ```typescript import LaunchpadContent from '@bluecadet/launchpad-content'; diff --git a/docs/src/reference/content/plugins/md-to-html.md b/docs/src/reference/content/plugins/md-to-html.md index e330d4ab..e4bb6821 100644 --- a/docs/src/reference/content/plugins/md-to-html.md +++ b/docs/src/reference/content/plugins/md-to-html.md @@ -7,7 +7,7 @@ The `mdToHtml` plugin is used to transform Markdown content into HTML. It suppor To use the `mdToHtml` plugin, include it in the list of content plugins in your configuration: ```typescript{1,6-8} -import { mdToHtml } from '@bluecadet/launchpad-content'; +import { mdToHtml } from '@bluecadet/launchpad-content/plugins/md-to-html'; export default defineConfig({ content: { diff --git a/docs/src/reference/content/plugins/media-downloader.md b/docs/src/reference/content/plugins/media-downloader.md index 05f50a4f..77c733f5 100644 --- a/docs/src/reference/content/plugins/media-downloader.md +++ b/docs/src/reference/content/plugins/media-downloader.md @@ -9,7 +9,7 @@ Downloaded media files are colocated with the sources that reference them. To use the `mediaDownloader` plugin, include it in the list of content plugins in your configuration: ```typescript{1,6-8} -import { mediaDownloader } from '@bluecadet/launchpad-content'; +import { mediaDownloader } from '@bluecadet/launchpad-content/plugins/media-downloader'; export default defineConfig({ content: { diff --git a/docs/src/reference/content/plugins/sanity-image-url-transform.md b/docs/src/reference/content/plugins/sanity-image-url-transform.md index fb333cc3..cc71b6f3 100644 --- a/docs/src/reference/content/plugins/sanity-image-url-transform.md +++ b/docs/src/reference/content/plugins/sanity-image-url-transform.md @@ -7,7 +7,7 @@ The `sanityImageUrlTransform` plugin transforms Sanity image references into usa To use the `sanityImageUrlTransform` plugin, include it in your configuration before your `mediaDownloader` plugin: ```typescript{1,6-12} -import { sanityImageUrlTransform } from '@bluecadet/launchpad-content'; +import { sanityImageUrlTransform } from '@bluecadet/launchpad-content/plugins/sanity-image-url-transform'; export default defineConfig({ content: { diff --git a/docs/src/reference/content/plugins/sanity-to-html.md b/docs/src/reference/content/plugins/sanity-to-html.md index ba18d264..0420c940 100644 --- a/docs/src/reference/content/plugins/sanity-to-html.md +++ b/docs/src/reference/content/plugins/sanity-to-html.md @@ -7,7 +7,7 @@ The `sanityToHtml` plugin is used to transform Sanity.io Portable Text content i To use the `sanityToHtml` plugin, include it in the list of content plugins in your configuration: ```typescript{1,6-8} -import { sanityToHtml } from '@bluecadet/launchpad-content'; +import { sanityToHtml } from '@bluecadet/launchpad-content/plugins/sanity-to-html'; export default defineConfig({ content: { diff --git a/docs/src/reference/content/plugins/sanity-to-md.md b/docs/src/reference/content/plugins/sanity-to-md.md index 8d254acc..f9466714 100644 --- a/docs/src/reference/content/plugins/sanity-to-md.md +++ b/docs/src/reference/content/plugins/sanity-to-md.md @@ -7,7 +7,7 @@ The `sanityToMd` plugin is used to transform Sanity.io Portable Text content int To use the `sanityToMd` plugin, include it in the list of content plugins in your configuration: ```typescript{1,6-8} -import { sanityToMd } from '@bluecadet/launchpad-content'; +import { sanityToMd } from '@bluecadet/launchpad-content/plugins/sanity-to-md'; export default defineConfig({ content: { diff --git a/docs/src/reference/content/plugins/sanity-to-plain.md b/docs/src/reference/content/plugins/sanity-to-plain.md index 5953f57e..b00efa92 100644 --- a/docs/src/reference/content/plugins/sanity-to-plain.md +++ b/docs/src/reference/content/plugins/sanity-to-plain.md @@ -7,7 +7,7 @@ The `sanityToPlain` plugin is used to transform Sanity.io Portable Text content To use the `sanityToPlain` plugin, include it in the list of content plugins in your configuration: ```typescript{1,6-8} -import { sanityToPlain } from '@bluecadet/launchpad-content'; +import { sanityToPlain } from '@bluecadet/launchpad-content/plugins/sanity-to-plain'; export default defineConfig({ content: { diff --git a/docs/src/reference/content/plugins/sharp.md b/docs/src/reference/content/plugins/sharp.md index a2ac9e6d..b2748255 100644 --- a/docs/src/reference/content/plugins/sharp.md +++ b/docs/src/reference/content/plugins/sharp.md @@ -7,7 +7,7 @@ The `sharp` plugin is used to transform downloaded images using the [Sharp](http To use the `sharp` plugin, include it in the list of content plugins after the mediaDownloader in your configuration: ```typescript{1,7-12} -import { sharp } from '@bluecadet/launchpad-content'; +import { sharp } from '@bluecadet/launchpad-content/plugins/sharp'; export default defineConfig({ content: { diff --git a/docs/src/reference/content/plugins/symlink.md b/docs/src/reference/content/plugins/symlink.md index 66295cb5..c2071c58 100644 --- a/docs/src/reference/content/plugins/symlink.md +++ b/docs/src/reference/content/plugins/symlink.md @@ -5,7 +5,7 @@ The `symlink` plugin is used to create symbolic links between files or directori ## Usage ```typescript -import { symlink } from '@bluecadet/launchpad-content'; +import { symlink } from '@bluecadet/launchpad-content/plugins/symlink'; export default defineConfig({ content: { diff --git a/docs/src/reference/content/sources/airtable-source.md b/docs/src/reference/content/sources/airtable-source.md index e8caa1b9..c0ec78ec 100644 --- a/docs/src/reference/content/sources/airtable-source.md +++ b/docs/src/reference/content/sources/airtable-source.md @@ -7,7 +7,7 @@ The `airtableSource` content source is used to fetch data from Airtable. It supp To use the `airtableSource` content source, include it in the list of content sources in your configuration: ```typescript{1,6-12} -import { airtableSource } from '@bluecadet/launchpad-content'; +import { airtableSource } from '@bluecadet/launchpad-content/sources/airtable'; export default defineConfig({ content: { diff --git a/docs/src/reference/content/sources/contentful-source.md b/docs/src/reference/content/sources/contentful-source.md index 635ce654..a2ea6071 100644 --- a/docs/src/reference/content/sources/contentful-source.md +++ b/docs/src/reference/content/sources/contentful-source.md @@ -7,7 +7,7 @@ The `contentfulSource` content source is used to fetch entries and assets from C To use the `contentfulSource` content source, include it in the list of content sources in your configuration: ```typescript{1,6-13} -import { contentfulSource } from '@bluecadet/launchpad-content'; +import { contentfulSource } from '@bluecadet/launchpad-content/sources/contentful'; export default defineConfig({ content: { diff --git a/docs/src/reference/content/sources/index.md b/docs/src/reference/content/sources/index.md index d5be4a9c..03976a3c 100644 --- a/docs/src/reference/content/sources/index.md +++ b/docs/src/reference/content/sources/index.md @@ -50,7 +50,7 @@ The fetched data, either as a promise returning a single document or an async it To define a custom content source, use the `defineSource` function: ```typescript -import { defineSource } from '@bluecadet/launchpad-content'; +import { defineSource } from '@bluecadet/launchpad-content/source'; export default defineSource({ id: 'myCustomSource', diff --git a/docs/src/reference/content/sources/json-source.md b/docs/src/reference/content/sources/json-source.md index cb596f5b..3ccd8f98 100644 --- a/docs/src/reference/content/sources/json-source.md +++ b/docs/src/reference/content/sources/json-source.md @@ -7,7 +7,7 @@ The `jsonSource` content source is used to fetch data from JSON endpoints via HT To use the `jsonSource` content source, include it in the list of content sources in your configuration: ```typescript{1,6-13} -import { jsonSource } from '@bluecadet/launchpad-content'; +import { jsonSource } from '@bluecadet/launchpad-content/sources/json'; export default defineConfig({ content: { diff --git a/docs/src/reference/content/sources/sanity-source.md b/docs/src/reference/content/sources/sanity-source.md index 54aa4565..96119ac3 100644 --- a/docs/src/reference/content/sources/sanity-source.md +++ b/docs/src/reference/content/sources/sanity-source.md @@ -7,7 +7,7 @@ The `sanitySource` content source is used to fetch data from Sanity.io. It suppo To use the `sanitySource` content source, include it in the list of content sources in your configuration: ```typescript{1,6-15} -import { sanitySource } from '@bluecadet/launchpad-content'; +import { sanitySource } from '@bluecadet/launchpad-content/sources/sanity'; export default defineConfig({ content: { diff --git a/docs/src/reference/content/sources/strapi-source.md b/docs/src/reference/content/sources/strapi-source.md index 691d92c3..9cbd32d2 100644 --- a/docs/src/reference/content/sources/strapi-source.md +++ b/docs/src/reference/content/sources/strapi-source.md @@ -7,7 +7,7 @@ The `strapiSource` content source is used to fetch data from Strapi CMS. It supp To use the `strapiSource` content source, include it in the list of content sources in your configuration: ```typescript{1,6-13} -import { strapiSource } from '@bluecadet/launchpad-content'; +import { strapiSource } from '@bluecadet/launchpad-content/sources/strapi'; export default defineConfig({ content: { diff --git a/docs/src/reference/controller/events.md b/docs/src/reference/controller/events.md index 1a47fe4e..cb64d0f7 100644 --- a/docs/src/reference/controller/events.md +++ b/docs/src/reference/controller/events.md @@ -12,8 +12,6 @@ Events are fully type-safe through TypeScript declaration merging. Each subsyste ```typescript import { LaunchpadController } from '@bluecadet/launchpad-controller'; -import '@bluecadet/launchpad-content'; // Import content event types -import '@bluecadet/launchpad-monitor'; // Import monitor event types const controller = new LaunchpadController(config, logger); const eventBus = controller.getEventBus(); diff --git a/docs/src/reference/monitor/index.md b/docs/src/reference/monitor/index.md index 243f7d81..cf2856e1 100644 --- a/docs/src/reference/monitor/index.md +++ b/docs/src/reference/monitor/index.md @@ -40,7 +40,7 @@ The monitor package is a robust process management and monitoring tool designed npm install @bluecadet/launchpad-monitor ``` -## Basic Usage +## JS API Usage ```typescript import LaunchpadMonitor from '@bluecadet/launchpad-monitor'; diff --git a/docs/src/reference/scaffold/index.md b/docs/src/reference/scaffold/index.md index 1c9ca4a0..5f16647d 100644 --- a/docs/src/reference/scaffold/index.md +++ b/docs/src/reference/scaffold/index.md @@ -51,7 +51,7 @@ npx launchpad scaffold > [!NOTE] Note: > The scaffold package primarily consists of PowerShell scripts and batch files. The npm package provides minimal JavaScript adapters to enable programmatic usage through the JavaScript API shown below. -## JavaScript API Usage +## JS API Usage ```typescript import { launchScaffold } from '@bluecadet/launchpad-scaffold'; From ef6420e435651dc3349be93cd85b8746c284b640 Mon Sep 17 00:00:00 2001 From: Clay Tercek <30105080+claytercek@users.noreply.github.com> Date: Mon, 3 Nov 2025 10:35:50 -0800 Subject: [PATCH 09/10] chore: add changeset for barrel file removal --- .changeset/little-buses-worry.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .changeset/little-buses-worry.md diff --git a/.changeset/little-buses-worry.md b/.changeset/little-buses-worry.md new file mode 100644 index 00000000..0a6ed61f --- /dev/null +++ b/.changeset/little-buses-worry.md @@ -0,0 +1,11 @@ +--- +"@bluecadet/launchpad-controller": major +"@bluecadet/launchpad": major +"@bluecadet/launchpad-scaffold": major +"@bluecadet/launchpad-content": major +"@bluecadet/launchpad-monitor": major +"@bluecadet/launchpad-utils": major +"@bluecadet/launchpad-cli": major +--- + +Remove barrel files. All packages no longer have an index export file that re-exports the public APIs. Instead, those APIs are accessible directly. This updates nearly all import paths across the entire launchpad ecosystem. From a2e6914731e9a7730d5cc7440253113689fdfa18 Mon Sep 17 00:00:00 2001 From: Clay Tercek <30105080+claytercek@users.noreply.github.com> Date: Fri, 7 Nov 2025 09:59:15 -0500 Subject: [PATCH 10/10] re-add barrel files for common imports After profiling, it turns out that removing barrel files really doesn't have a performance impact for this use. We're keeping the more specific import paths, but als adding back some barrels for convenience. --- .changeset/little-buses-worry.md | 2 +- biome.json | 3 --- docs/src/reference/content/index.md | 2 +- docs/src/reference/monitor/index.md | 2 +- packages/cli/src/commands/content.ts | 2 +- packages/cli/src/commands/monitor.ts | 2 +- packages/cli/src/commands/start.ts | 4 ++-- packages/cli/src/commands/stop.ts | 2 +- packages/cli/src/utils/config.ts | 5 ++++- packages/content/package.json | 12 ++++++++++++ packages/content/src/index.ts | 4 ++++ packages/content/src/plugins/index.ts | 8 ++++++++ packages/content/src/sources/index.ts | 5 +++++ packages/monitor/package.json | 4 ++++ packages/monitor/src/index.ts | 2 ++ 15 files changed, 47 insertions(+), 12 deletions(-) create mode 100644 packages/content/src/index.ts create mode 100644 packages/content/src/plugins/index.ts create mode 100644 packages/content/src/sources/index.ts create mode 100644 packages/monitor/src/index.ts diff --git a/.changeset/little-buses-worry.md b/.changeset/little-buses-worry.md index 0a6ed61f..45da1f94 100644 --- a/.changeset/little-buses-worry.md +++ b/.changeset/little-buses-worry.md @@ -8,4 +8,4 @@ "@bluecadet/launchpad-cli": major --- -Remove barrel files. All packages no longer have an index export file that re-exports the public APIs. Instead, those APIs are accessible directly. This updates nearly all import paths across the entire launchpad ecosystem. +Refactor package exports. Removed most re-exports from the index files, and added additional package export paths. Also refactored the launchpad meta package to generate export paths that match the individual packages. This updates nearly all import paths across the entire launchpad ecosystem. diff --git a/biome.json b/biome.json index d45c2448..8c94191d 100644 --- a/biome.json +++ b/biome.json @@ -31,9 +31,6 @@ "useNumberNamespace": "error", "noInferrableTypes": "error", "noUselessElse": "error" - }, - "performance": { - "noBarrelFile": "error" } } }, diff --git a/docs/src/reference/content/index.md b/docs/src/reference/content/index.md index 4563132e..8f33214c 100644 --- a/docs/src/reference/content/index.md +++ b/docs/src/reference/content/index.md @@ -39,7 +39,7 @@ npm install @bluecadet/launchpad-content ## JS API Usage ```typescript -import LaunchpadContent from '@bluecadet/launchpad-content'; +import { LaunchpadContent } from '@bluecadet/launchpad-content'; const content = LaunchpadContent({ sources: [ diff --git a/docs/src/reference/monitor/index.md b/docs/src/reference/monitor/index.md index cf2856e1..c0098f59 100644 --- a/docs/src/reference/monitor/index.md +++ b/docs/src/reference/monitor/index.md @@ -43,7 +43,7 @@ npm install @bluecadet/launchpad-monitor ## JS API Usage ```typescript -import LaunchpadMonitor from '@bluecadet/launchpad-monitor'; +import { LaunchpadMonitor } from '@bluecadet/launchpad-monitor'; const monitor = new LaunchpadMonitor({ apps: [ diff --git a/packages/cli/src/commands/content.ts b/packages/cli/src/commands/content.ts index 417c7f26..05a55ff7 100644 --- a/packages/cli/src/commands/content.ts +++ b/packages/cli/src/commands/content.ts @@ -25,7 +25,7 @@ export function content(argv: GlobalLaunchpadArgs) { }, otherwise: (controller) => { // No daemon - need to instantiate subsystem and register it - return importLaunchpadContent().andThen(({ default: LaunchpadContent }) => { + return importLaunchpadContent().andThen(({ LaunchpadContent }) => { const contentInstance = new LaunchpadContent(configContent, rootLogger, dir); controller.registerSubsystem("content", contentInstance); diff --git a/packages/cli/src/commands/monitor.ts b/packages/cli/src/commands/monitor.ts index 6eb5e940..6cee4cc0 100644 --- a/packages/cli/src/commands/monitor.ts +++ b/packages/cli/src/commands/monitor.ts @@ -27,7 +27,7 @@ export function monitor(argv: GlobalLaunchpadArgs) { }, otherwise: (controller) => { // No daemon - need to instantiate subsystem and register it - return importLaunchpadMonitor().andThen(({ default: LaunchpadMonitor }) => { + return importLaunchpadMonitor().andThen(({ LaunchpadMonitor }) => { const monitorInstance = new LaunchpadMonitor(configMonitor, rootLogger, dir); controller.registerSubsystem("monitor", monitorInstance); diff --git a/packages/cli/src/commands/start.ts b/packages/cli/src/commands/start.ts index 112a11f6..f33481e1 100644 --- a/packages/cli/src/commands/start.ts +++ b/packages/cli/src/commands/start.ts @@ -110,7 +110,7 @@ function startForeground(argv: GlobalLaunchpadArgs): ResultAsync { startupCommands.push({ type: "content.fetch" }); const contentConfig = config.content; - return importLaunchpadContent().andThen(({ default: LaunchpadContent }) => { + return importLaunchpadContent().andThen(({ LaunchpadContent }) => { const contentInstance = new LaunchpadContent(contentConfig, rootLogger, dir); controller.registerSubsystem("content", contentInstance); return contentInstance.loadSources(); @@ -124,7 +124,7 @@ function startForeground(argv: GlobalLaunchpadArgs): ResultAsync { startupCommands.push({ type: "monitor.connect" }, { type: "monitor.start" }); const monitorConfig = config.monitor; - return importLaunchpadMonitor().andThen(({ default: LaunchpadMonitor }) => { + return importLaunchpadMonitor().andThen(({ LaunchpadMonitor }) => { const monitorInstance = new LaunchpadMonitor(monitorConfig, rootLogger, dir); controller.registerSubsystem("monitor", monitorInstance); return ok(); diff --git a/packages/cli/src/commands/stop.ts b/packages/cli/src/commands/stop.ts index 7e284e39..4134d981 100644 --- a/packages/cli/src/commands/stop.ts +++ b/packages/cli/src/commands/stop.ts @@ -67,7 +67,7 @@ export function stop(argv: GlobalLaunchpadArgs) { console.log("Launchpad is not running."); console.log("Found monitor configuration, attempting to kill monitor process..."); - return importLaunchpadMonitor().andThen(({ default: LaunchpadMonitor }) => { + return importLaunchpadMonitor().andThen(({ LaunchpadMonitor }) => { const logger = LogManager.configureRootLogger(); return LaunchpadMonitor.kill(logger); }); diff --git a/packages/cli/src/utils/config.ts b/packages/cli/src/utils/config.ts index 3b660adf..beed031a 100644 --- a/packages/cli/src/utils/config.ts +++ b/packages/cli/src/utils/config.ts @@ -59,7 +59,10 @@ export async function loadConfigFromFile(configPath: string): Promise