refactor: remove core-events from main (scaffoldable via gen core-package events)

- Delete packages/core-events/ (15 files)
- Strip @repo/core-events from all 5 feature package.json + apps/web-next/package.json
- Strip @repo/core-events from apps/web-next/next.config.mjs transpilePackages
- Strip E1 + J no-restricted-syntax blocks from core-eslint/base.js (anchor remains)
- Update bind-production.ts: drop bus construction + IEventBus import; rename
  resolveEventsAndJobsProduction → resolveJobsProduction (queue only),
  resolveEventsAndJobsDevSeed → resolveJobsDevSeed (queue only);
  ctx no longer has bus field; BindProductionContext generic arg narrowed
- Update bind-production.test.ts: assert ctx.bus is undefined, drop
  PayloadJobsEventBus/InMemoryEventBus instanceof checks
- Update sign-up-welcome-email.test.ts: assert mailer stays empty without bus
- Inline userSignedUpEvent in auth (drop defineEvent import from core-events)
- Drop InMemoryEventBus fallback from auth/di/module.ts

Feature binders' bus?.subscribe/publish calls remain as no-ops. Scaffold
@repo/core-events back via: pnpm turbo gen core-package events

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-09 14:00:35 +02:00
parent 681fe6ada1
commit a9f27f0d7e
29 changed files with 54 additions and 500 deletions

View File

@@ -20,7 +20,6 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@repo/core-events": "workspace:*",
"@repo/core-shared": "workspace:*",
"@trpc/server": "^11.0.0",
"inversify": "^6.2.0",

View File

@@ -1,5 +1,4 @@
import { ContainerModule, type interfaces } from "inversify";
import { InMemoryEventBus } from "@repo/core-events";
import type { IUsersRepository } from "../application/repositories/users.repository.interface";
import type { IAuthenticationService } from "../application/services/authentication.service.interface";
@@ -45,13 +44,13 @@ export const AuthModule = new ContainerModule((bind: interfaces.Bind) => {
);
bind<ISignUpUseCase>(AUTH_SYMBOLS.ISignUpUseCase).toDynamicValue((ctx) =>
// Default fallback uses a fresh InMemoryEventBus — real cross-feature
// wiring runs through bindProductionAuth / bindDevSeedAuth where the
// bindAll() dispatcher passes a shared bus instance.
// No default bus — real cross-feature wiring runs through
// bindProductionAuth / bindDevSeedAuth where bindAll() passes a shared
// bus instance when @repo/core-events is scaffolded.
signUpUseCase(
ctx.container.get<IUsersRepository>(AUTH_SYMBOLS.IUsersRepository),
ctx.container.get<IAuthenticationService>(AUTH_SYMBOLS.IAuthenticationService),
new InMemoryEventBus(),
undefined,
),
);

View File

@@ -1,6 +1,5 @@
// packages/auth/src/events/user-signed-up.event.ts
import { z } from "zod";
import { defineEvent } from "@repo/core-events";
export const userSignedUpEventSchema = z
.object({
@@ -12,7 +11,9 @@ export const userSignedUpEventSchema = z
export type UserSignedUpEvent = z.infer<typeof userSignedUpEventSchema>;
export const userSignedUpEvent = defineEvent(
"auth.user.signed-up",
userSignedUpEventSchema,
);
// Inline event descriptor — core-events is optional. The shape { name, schema }
// satisfies EventBusProtocol.publish / subscribe when the bus is present.
export const userSignedUpEvent = {
name: "auth.user.signed-up" as const,
schema: userSignedUpEventSchema,
};