Repository navigation
docs(logger): document public API and drop unknown from SupportedOutput - #283
Conversation
|
Do we need to update readme for that? There's skill for generating readmes afair |
|
Sprawdziłem to. Czy istnieje generator README? Nie. W repo nie ma żadnego mechanizmu generowania README — brak skilla do generowania README, brak skryptu ( Generowane czy pisane ręcznie? Czy potrzebna aktualizacja README? Nie. Zmiany z tego PR-a nie dotykają treści widocznej w README:
Nie wprowadzałem żadnych zmian w README ani niczego nie pushowałem. |
|
There's rule for that https://github.com/leancodepl/js_corelibrary/blob/main/.cursor/rules/readme.mdc |
|
Masz rację — jest reguła Co wymaga reguła: struktura README z sekcjami Decyzja: README pakietu
Trzymałem się zakresu tego PR (dokumentacja publicznego API loggera + zmiana typu) — nie przepisywałem README innych pakietów. |
CI "Build & Test" — analiza niepowodzeniaCo padło: krok Typecheck ( Przyczyna: to błąd istniejący wcześniej, niezwiązany z tym PR. Dlaczego ujawnił się dopiero teraz: na Nie wprowadzam zmiany w kodzie (zgodnie z klasyfikacją: failure pre-existing). Rekomendowana, jednoliniowa i bezpieczna naprawa odblokowująca PR (zweryfikowana lokalnie — // packages/logger/tsconfig.spec.json
"references": [{ "path": "./tsconfig.lib.json" }]Najlepiej w osobnym PR/commicie naprawkowym (dotyczy konfiguracji, nie tematu tej dokumentacji). Po jego scaleniu wystarczy rebase tego PR na |
85d1448 to
15d6c1d
Compare
|
@claude zrebasuj na najnowszego maina |
The readme.mdc rule requires every exported function/class to have a README API entry (Installation + API sections with parameter/return docs) alongside its JSDoc. This PR added JSDoc to the public API but the logger README had neither section, so add them, sourcing the descriptions from the just-added TSDoc. Existing prose is retained under a Usage Examples section. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DXXPnGepYUGie3we1X9PTR
15d6c1d to
53bf8ad
Compare
|
Zrebasowano gałąź na najnowszy |
Requested by Sebastian Konowrocki · Slack thread
Before:
@leancodepl/logger's public API had no TSDoc, so editors showed no hover docs forcreateLogger,withContext,withMiddleware, thecreateCliLogger/createJsonLogger/createNestJsonLoggerpresets, or the log-level helpers. The core typeSupportedOutput = boolean | number | object | string | unknownsilently collapsed tounknown(any union containingunknownis justunknown), defeating the generic output inference the logger is built around.After: The public symbols carry TSDoc matching the
@leancodepl/utilsdocumentation bar (summary,@template/@param/@returns,@example).SupportedOutputis nowboolean | number | object | string, so output types are actually inferred instead of widening tounknown. No runtime behavior changes; the logger still builds and all tests pass.How:
packages/logger/src/lib/*.ts:logger.ts(types +createLogger,isContextualMessage),cliLogger.ts,jsonLogger.ts,nestLogger.ts,logLevels.ts.unknownmember fromSupportedOutput.nestLogger.tsadapts NestJS's untyped (any) logger inputs toSupportedOutputat the boundary via a small, documentedasSupportedOutputhelper. The values are forwarded unchanged — downstream serialization (formatNestMessage) already handles every runtime type — so this only reconciles the static types without altering behavior, and avoids a blanketas any.Verified locally:
nx run logger:typecheckreports no new errors from this change (the only remaininglogger:typecheckfailures —TS6307spec-project file-list andTS7031inlogger.spec.ts— pre-exist onmain);nx run logger:buildsucceeds;nx run logger:testpasses (10/10).Generated by Claude Code