Skip to content

Fix TypeScript declaration publishing#1

Closed
andrei-hasna wants to merge 1 commit into
mainfrom
fix/types-declaration-publishing
Closed

Fix TypeScript declaration publishing#1
andrei-hasna wants to merge 1 commit into
mainfrom
fix/types-declaration-publishing

Conversation

@andrei-hasna

Copy link
Copy Markdown
Contributor

Summary

  • generate root package declarations during build, reusing SDK declarations for the root export and emitting storage declarations
  • add explicit ./storage types metadata and a prepack build hook so plain npm pack includes declarations from a clean checkout
  • add package validation that checks packed metadata targets and relative declaration imports

Validation

  • rm -rf dist && npm pack --dry-run --json
  • bun run validate:pack
  • npm publish --dry-run --json
  • bun test
  • ./node_modules/.bin/biome check package.json tsconfig.types.json scripts/build-types.ts scripts/validate-package.ts
  • packed tarball consumer TypeScript checks for @hasna/logs and @hasna/logs/storage under NodeNext and Bundler
  • Bun runtime package-name import smoke test

Review

  • adversarial reviewer found direct clean npm pack bypassed validation; reconciled with prepack: bun run build and revalidated clean pack output
  • remaining low risk: validator skips bare external declaration specifiers; current public exported declarations typecheck from packed consumers

@andrei-hasna

Copy link
Copy Markdown
Contributor Author

Closing as superseded / already fixed on main.

This PR (2026-06-23, "Fix TypeScript declaration publishing") is obsolete: its intent is fully implemented on current main (0.4.5) and shipped in the published npm package.

Evidence:

  • main already carries the ./storage types export metadata this PR adds, plus a ./api typed export the PR predates.
  • main already emits declarations during build via build:js + build:types (tsc tsconfig.build.json + sdk types), and already contains evolved versions of scripts/build-types.ts, scripts/validate-package.ts, and tsconfig.types.json.
  • The published @hasna/logs@0.4.4 tarball (npm pack --dry-run) includes 89 .d.ts files — including dist/index.d.ts, dist/storage.d.ts, and dist/api.d.ts — so declaration publishing is verifiably working in production.
  • The branch is CONFLICTING/DIRTY and built on a stale build structure (single build script, no build:js/build:types split, no ./api, old src file list, no pg external). Rebasing would require a full rewrite for zero net functional gain.

Only element not on main: the prepack/prepublishOnly safety hooks. If desired, those belong in a fresh small PR against current main, not this obsolete conflicting branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant