The package ships a default app template and a shared “project” baseline.
SMOZ keeps side‑effect registers in app/generated/
:
lambda.ts
openapi.ts
serverless.ts
(non‑HTTP)Generate/update:
npx smoz register
Templates do not commit generated files under app/generated/
(including register.*.ts
). Instead, each template ships an ambient declarations file that declares the three register modules so TypeScript can typecheck without artifacts:
@/app/generated/register.functions
@/app/generated/register.openapi
@/app/generated/register.serverless
For the default template this file is: templates/default/types/registers.d.ts
.
When a template needs to ensure register side effects are evaluated at runtime (e.g., in serverless.ts
or the OpenAPI builder), import the register module as a namespace and reference it via void
. This satisfies TypeScript’s noUncheckedSideEffectImports
while still executing module side effects:
import * as __register_functions from '@/app/generated/register.functions';
void __register_functions;
In real apps, smoz init
seeds empty placeholders in app/generated/
and smoz register
keeps them up to date. Teams often commit the generated register.*.ts
files so CI typecheck remains stable.
The template includes a script to build app/generated/openapi.json
:
npm run openapi
It imports register.openapi.ts
, collects paths, and writes the document.
Always normalize file system separators when deriving paths from import.meta.url
or from Node helpers. Example:
import { fileURLToPath } from 'node:url';
import { toPosixPath } from '@karmaniverous/smoz';
export const APP_ROOT_ABS = toPosixPath(
fileURLToPath(new URL('..', import.meta.url)),
);
npm run templates:lint
A single ESLint flat config discovers all templates (no per‑template wiring).npm run templates:typecheck
A small script finds templates/*/tsconfig.json
and runs tsc -p --noEmit
per template. Adding a new template directory requires no script changes.fn.openapi
fn.serverless(extras)
Create a new folder under templates/*
with a tsconfig.json
. Lint/typecheck will pick it up automatically via the unified config and the typecheck script.
Yes—this can still be a good practice for downstream apps.
smoz register
before typecheck/build/package, you don’t need to commit app/generated/register.*.ts
.app/generated/register.*.ts
.