@namesmt/utils-lambda — AWS Lambda helpers and types: request/trigger event types, fake API
Gateway events, gzip/brotli response compression, payload decoding. Node >= 22, ESM only, #src/*
import aliases, tsdown build, Vitest tests.
pnpm run lint # eslint (@antfu/eslint-config) — it also owns formatting
pnpm run test # vitest in watch mode
pnpm run test:types # tsc --noEmit --skipLibCheck
pnpm run check # lint + test:types + vitest run --coverage — the release gate
pnpm run build # tsdown -> dist/index.mjs + dist/index.d.mts
pnpm exec vitest run # one-shot suite, without coverage
pnpm run release:check 0.2.0 # version must be semver and greater than the current one
pnpm run release:preview # print the changelog the next release would getsrc/index.tsre-exports./typesand./utils.src/utils.ts— runtime helpers (fakeEvent*,eventMethodUrl,pickEventContextV2,compressV2*,decompress*,decodeResponseV2*,decodePayload).src/types.ts— event unions (LambdaEvent,LambdaRequestEvent,LambdaTriggerEvent,CommonTriggerEventsMap) plus the localLatticeProxyEventV2types.src/utils.test.ts— tests sit next to their source, not intest/.tsdown.config.ts/vitest.config.ts— build/test config;dist/is built, never committed..github/workflows/ci.ymlruns lint + types +pnpm teston push/PR tomain;release.ymlis manual (below).scripts/holds the two release helpers.
- Conventional commits (
feat:,fix:,chore:, …) — the changelog is derived from them. - ESLint via
@antfu/eslint-configowns formatting: no Prettier, single quotes, 2-space indent, sorted imports with no blank lines.lint-stagedrunseslint --fixon commit. - ESM only:
"type": "module"with animport-onlyexportsmap; do not add a CJS build. - Keep the local
LatticeProxyEventV2types insrc/types.tsuntil@types/aws-lambdaships them.
Version-first and manual: dispatch Actions → Release → Run workflow with the version — that is the only publish path, a pushed tag publishes nothing.
release.yml runs pnpm run check, builds, then npx -y changelogen@latest bumps package.json, writes CHANGELOG.md, commits and tags v<version>, after which the run pushes, creates the GitHub release and publishes via OIDC trusted publishing.
dry-run skips only the push, GitHub release and npm publish — the changelogen version bump, commit and tag are still created locally.
One-time trusted-publisher setup is in the README.
pnpm testwatches locally; usepnpm exec vitest runfor a one-shot.release.ymlruns on Node 24,ci.ymlon Node 22.prepublishOnlyrunspnpm run build, so a manualnpm publishrebuilds after the workflow's build.- changelogen
--cleanfails whengit status --porcelainis non-empty; ignored files such asdist/do not count. compressV2*anddecompress*only understandbrandgzip; any otheraccept-encodingorcontentEncodingthrows, so callers must gate on the header rather than pass it through.