CLI · build

cem build

Compile your app for production through a triple-guard safety pipeline that catches architecture drift before tsc ever runs.

bash
cem build

The pipeline

  ◆  Running Middleware Convention Guard…
  ✔  Middleware naming convention valid.

  ◆  Running Architecture Guard…
  ✔  Architecture validation passed.

  ◆  Compiling TypeScript…
  ✔  Build successful.  924ms

1. Middleware Convention Guard

Every file in src/app/middlewares/ must end with .middleware.ts. Rename one to requestLogger.ts and the build aborts:

  ✖  Middleware naming violation: 'requestLogger.ts'
     ·  Expected: 'requestLogger.middleware.ts'
     ·  Rename the file and update any imports.

  ✖  Build aborted — all middleware files must follow the
     <name>.middleware.ts convention.

2. Architecture Guard

Scans src/app/modules/ for:

  • Files missing the module prefix (e.g. controller.ts instead of task.controller.ts).
  • Orphan modules — folders not wired into the router.
  • Missing core files (controller, route, service).

3. TypeScript compile

Standard tsc emits dist/. If anything fails, the error is printed inline under the failing step.