feat(telemetry): publish-prep — assemble-dist script + corrected exports#320
Merged
Conversation
…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>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Resolves the deferred follow-up from PR #319: the hybrid
@nx/js:tsc+@nx/angular:packagebuild produces disjoint outputs that don't match the sourcepackage.jsonexports 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 ofnx run telemetry:build. Flattensdist/libs/telemetry/src/*up one level, removes the ng-packagr-generatedbrowser/package.json(it conflicted with the root manifest), writesbrowser/index.d.tsas a clean re-export, re-emits the canonical rootpackage.jsonwith a corrected exports map, and verifies every exports map path resolves to a real file (fails the build otherwise).libs/telemetry/package.jsonexports map — corrected to use.jsextensions matching@nx/js:tsc's actual output and the script's canonical map (was incorrectly using.mjspaths the Node entry doesn't produce).libs/telemetry/project.json—buildtarget now runs the assemble script instead oftrue, withoutputsdeclared so Nx caching is correct.Result
After
nx run telemetry:build:npm pack(fromdist/libs/telemetry/): 41 files, 9.4 KB tarballSix 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
@ngaf/telemetry/browservia the proper published-package shape.@ngaf/telemetry@<next-bump>alongside the other@ngaf/*libs.Test Plan
dist/libs/telemetry/package.jsonexports map references real files (the script's final verification)npm pack ./dist/libs/telemetryproduces a coherent tarball (manual verification)🤖 Generated with Claude Code