Skip to content

feat(telemetry): publish-prep — assemble-dist script + corrected exports#320

Merged
blove merged 1 commit into
mainfrom
worktree-gtm+telemetry-publish-prep
May 15, 2026
Merged

feat(telemetry): publish-prep — assemble-dist script + corrected exports#320
blove merged 1 commit into
mainfrom
worktree-gtm+telemetry-publish-prep

Conversation

@blove
Copy link
Copy Markdown
Contributor

@blove blove commented May 15, 2026

Summary

Resolves the deferred follow-up from PR #319: the hybrid @nx/js:tsc + @nx/angular:package build produces disjoint outputs that don't match the source package.json exports map. Until this PR, @ngaf/telemetry's dist couldn't be cleanly published.

What this adds

  • libs/telemetry/scripts/assemble-dist.mjs — runs as the final step of nx run telemetry:build. Flattens dist/libs/telemetry/src/* up one level, removes the ng-packagr-generated browser/package.json (it conflicted with the root manifest), writes browser/index.d.ts as a clean re-export, re-emits the canonical root package.json with a corrected exports map, and verifies every exports map path resolves to a real file (fails the build otherwise).
  • Source libs/telemetry/package.json exports map — corrected to use .js extensions matching @nx/js:tsc's actual output and the script's canonical map (was incorrectly using .mjs paths the Node entry doesn't produce).
  • libs/telemetry/project.jsonbuild target now runs the assemble script instead of true, with outputs declared so Nx caching is correct.

Result

After nx run telemetry:build:

  • Tests: 45 pass
  • Lint: clean
  • npm pack (from dist/libs/telemetry/): 41 files, 9.4 KB tarball
  • All 6 exports map paths resolve in the tarball

Six subpath exports verified to resolve:

```
. → ./index.js
./shared → ./shared/events.js
./node → ./node/index.js
./node/postinstall → ./node/postinstall.js
./browser → ./browser/fesm2022/ngaf-telemetry.mjs
./README.md → ./README.md
```

What this unblocks

  • Spec 1C (cockpit instrumentation) can now consume @ngaf/telemetry/browser via the proper published-package shape.
  • The next fixed-group release will publish @ngaf/telemetry@<next-bump> alongside the other @ngaf/* libs.

Test Plan

  • CI passes: lint, test, build (with assemble step)
  • dist/libs/telemetry/package.json exports map references real files (the script's final verification)
  • npm pack ./dist/libs/telemetry produces a coherent tarball (manual verification)

🤖 Generated with Claude Code

…lish

Spec 1B left a known follow-up: the hybrid build produced disjoint
outputs that didn't match the source package.json exports map.
@nx/js:tsc wrote to dist/libs/telemetry/src/* and @nx/angular:package
wrote to dist/libs/telemetry/browser/*.

This PR adds libs/telemetry/scripts/assemble-dist.mjs which the
telemetry:build target now runs as its final step. The script:

1. Flattens dist/libs/telemetry/src/* up one level so paths in
   ./node/* and ./shared/* resolve.
2. Removes the conflicting ng-packagr-generated browser/package.json.
3. Writes browser/index.d.ts as a clean re-export from fesm2022/types/.
4. Re-emits a canonical dist/libs/telemetry/package.json with a
   corrected exports map.
5. Verifies every exports map path resolves to an actual file (fails
   the build if not).

Also corrects the SOURCE libs/telemetry/package.json exports map to
match what the script writes, and fixes scripts.postinstall to use
.js (the actual @nx/js:tsc output extension), not .mjs.

After this PR, @ngaf/telemetry is publish-ready. npm pack produces a
41-file 9.4 KB tarball with all six subpath exports resolving:
  .                  → ./index.js
  ./shared           → ./shared/events.js
  ./node             → ./node/index.js
  ./node/postinstall → ./node/postinstall.js
  ./browser          → ./browser/fesm2022/ngaf-telemetry.mjs
  ./README.md        → ./README.md

Unblocks Spec 1C (cockpit instrumentation) which needs to consume
@ngaf/telemetry/browser via the published package shape.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 15, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cacheplane Ready Ready Preview, Comment May 15, 2026 4:28pm

Request Review

@blove blove merged commit 06246df into main May 15, 2026
16 checks passed
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