From 5b4b1282f8efc7dd2eee5d549ed15946e9ecebd9 Mon Sep 17 00:00:00 2001 From: Till-JS <101404291+Till-JS@users.noreply.github.com> Date: Sun, 1 Feb 2026 03:40:05 +0100 Subject: [PATCH] build(bot-services): add build step for Node.js v25 compatibility - Add build script to compile TypeScript to dist/ - Update index.ts exports to use explicit .js extensions - Update package.json exports to point to compiled JavaScript files - Requires running 'pnpm --filter @manacore/bot-services build' before consuming Co-Authored-By: Claude Opus 4.5 --- packages/bot-services/package.json | 68 +++++++++++++++++++++++------- packages/bot-services/src/index.ts | 50 +++++++++++----------- 2 files changed, 78 insertions(+), 40 deletions(-) diff --git a/packages/bot-services/package.json b/packages/bot-services/package.json index 0c138462f..1f43aa8a2 100644 --- a/packages/bot-services/package.json +++ b/packages/bot-services/package.json @@ -3,26 +3,64 @@ "version": "0.1.0", "private": true, "description": "Shared business logic services for Matrix bots and Gateway", - "main": "./src/index.ts", - "types": "./src/index.ts", + "main": "./dist/index.js", + "types": "./dist/index.d.ts", "exports": { - ".": "./src/index.ts", - "./todo": "./src/todo/index.ts", - "./calendar": "./src/calendar/index.ts", - "./clock": "./src/clock/index.ts", - "./ai": "./src/ai/index.ts", - "./session": "./src/session/index.ts", - "./transcription": "./src/transcription/index.ts", - "./nutrition": "./src/nutrition/index.ts", - "./quotes": "./src/quotes/index.ts", - "./stats": "./src/stats/index.ts", - "./docs": "./src/docs/index.ts", - "./shared": "./src/shared/index.ts" + ".": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + }, + "./todo": { + "types": "./dist/todo/index.d.ts", + "default": "./dist/todo/index.js" + }, + "./calendar": { + "types": "./dist/calendar/index.d.ts", + "default": "./dist/calendar/index.js" + }, + "./clock": { + "types": "./dist/clock/index.d.ts", + "default": "./dist/clock/index.js" + }, + "./ai": { + "types": "./dist/ai/index.d.ts", + "default": "./dist/ai/index.js" + }, + "./session": { + "types": "./dist/session/index.d.ts", + "default": "./dist/session/index.js" + }, + "./transcription": { + "types": "./dist/transcription/index.d.ts", + "default": "./dist/transcription/index.js" + }, + "./nutrition": { + "types": "./dist/nutrition/index.d.ts", + "default": "./dist/nutrition/index.js" + }, + "./quotes": { + "types": "./dist/quotes/index.d.ts", + "default": "./dist/quotes/index.js" + }, + "./stats": { + "types": "./dist/stats/index.d.ts", + "default": "./dist/stats/index.js" + }, + "./docs": { + "types": "./dist/docs/index.d.ts", + "default": "./dist/docs/index.js" + }, + "./shared": { + "types": "./dist/shared/index.d.ts", + "default": "./dist/shared/index.js" + } }, "scripts": { + "build": "tsc", "type-check": "tsc --noEmit", "clean": "rm -rf dist", - "lint": "eslint ." + "lint": "eslint .", + "prepublishOnly": "pnpm build" }, "dependencies": { "@nestjs/common": "^11.0.20", diff --git a/packages/bot-services/src/index.ts b/packages/bot-services/src/index.ts index cf7fda0f3..285347752 100644 --- a/packages/bot-services/src/index.ts +++ b/packages/bot-services/src/index.ts @@ -27,7 +27,7 @@ // ===== Core Services ===== // Todo -export { TodoModule, TodoModuleOptions, TodoService, TODO_STORAGE_PROVIDER } from './todo'; +export { TodoModule, TodoModuleOptions, TodoService, TODO_STORAGE_PROVIDER } from './todo/index.js'; export type { Task, Project, @@ -37,7 +37,7 @@ export type { TaskFilter, TodoStats, ParsedTaskInput, -} from './todo'; +} from './todo/index.js'; // Calendar export { @@ -45,7 +45,7 @@ export { CalendarModuleOptions, CalendarService, CALENDAR_STORAGE_PROVIDER, -} from './calendar'; +} from './calendar/index.js'; export type { CalendarEvent, Calendar, @@ -54,10 +54,10 @@ export type { UpdateEventInput, EventFilter, ParsedEventInput, -} from './calendar'; +} from './calendar/index.js'; // AI (Ollama) -export { AiModule, AiModuleOptions, AiService } from './ai'; +export { AiModule, AiModuleOptions, AiService } from './ai/index.js'; export type { OllamaModel, ChatMessage, @@ -67,11 +67,11 @@ export type { AiServiceConfig, UserAiSession, SystemPromptPreset, -} from './ai'; -export { SYSTEM_PROMPTS, VISION_MODELS, NON_CHAT_MODELS } from './ai'; +} from './ai/index.js'; +export { SYSTEM_PROMPTS, VISION_MODELS, NON_CHAT_MODELS } from './ai/index.js'; // Clock -export { ClockModule, ClockModuleOptions, ClockService } from './clock'; +export { ClockModule, ClockModuleOptions, ClockService } from './clock/index.js'; export type { Timer, Alarm, @@ -82,7 +82,7 @@ export type { CreateWorldClockInput, ClockServiceConfig, TimeTrackingSummary, -} from './clock'; +} from './clock/index.js'; // Session (User authentication via mana-core-auth) export { @@ -90,34 +90,34 @@ export { SessionService, SESSION_MODULE_OPTIONS, DEFAULT_SESSION_EXPIRY_MS, -} from './session'; -export type { UserSession, LoginResult, SessionStats, SessionModuleOptions } from './session'; +} from './session/index.js'; +export type { UserSession, LoginResult, SessionStats, SessionModuleOptions } from './session/index.js'; // Transcription (Speech-to-Text via mana-stt) -export { TranscriptionModule, TranscriptionService, STT_MODULE_OPTIONS } from './transcription'; +export { TranscriptionModule, TranscriptionService, STT_MODULE_OPTIONS } from './transcription/index.js'; export type { SttResponse, TranscriptionOptions, TranscriptionModuleOptions, -} from './transcription'; +} from './transcription/index.js'; // ===== Placeholder Services (to be implemented) ===== -export { NutritionModule } from './nutrition'; -export type { NutritionServiceConfig, Meal, NutritionSummary } from './nutrition'; +export { NutritionModule } from './nutrition/index.js'; +export type { NutritionServiceConfig, Meal, NutritionSummary } from './nutrition/index.js'; -export { QuotesModule } from './quotes'; -export type { QuotesServiceConfig, Quote } from './quotes'; +export { QuotesModule } from './quotes/index.js'; +export type { QuotesServiceConfig, Quote } from './quotes/index.js'; -export { StatsModule } from './stats'; -export type { StatsServiceConfig, AnalyticsReport } from './stats'; +export { StatsModule } from './stats/index.js'; +export type { StatsServiceConfig, AnalyticsReport } from './stats/index.js'; -export { DocsModule } from './docs'; -export type { DocsServiceConfig, ProjectDoc } from './docs'; +export { DocsModule } from './docs/index.js'; +export type { DocsServiceConfig, ProjectDoc } from './docs/index.js'; // ===== Shared Utilities ===== -export { FileStorageProvider, MemoryStorageProvider } from './shared'; +export { FileStorageProvider, MemoryStorageProvider } from './shared/index.js'; export type { StorageProvider, BaseEntity, @@ -129,7 +129,7 @@ export type { DateRange, Priority, ServiceStats, -} from './shared'; +} from './shared/index.js'; export { generateId, getTodayISO, @@ -142,5 +142,5 @@ export { isTomorrow, parseGermanDateKeyword, getRelativeDateLabel, -} from './shared'; -export { PRIORITY_VALUES } from './shared'; +} from './shared/index.js'; +export { PRIORITY_VALUES } from './shared/index.js';