Repository navigation
fix(build): match dts-bundle module name to the published package name - #2
Merged
Merged
Conversation
dts-bundle was invoked with --name caching, a leftover from before the package was renamed to the scoped @learningmachine/caching. The bundled dist/caching.d.ts declared 'caching' (and 'caching/cache', etc.) instead of '@learningmachine/caching', so consumers importing from the real package name got 'TS2306: File ... is not a module' — TypeScript had no declarations for the module they were actually importing. Pass --out caching.d.ts explicitly so the output path stays the same (dts-bundle derives it from --name otherwise, which would nest the file under a '@learningmachine/' directory and break the build script's cp step).
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
Fixes the
dts-bundleinvocation inbuildso the bundledcaching.d.tsdeclares the ambient module under the package's real, scoped name (@learningmachine/caching) instead of the old unscopedcaching.Background
dts-bundle --name cachinghas been unchanged since this 2021 commit renamed the package fromcachingto@learningmachine/caching— the--nameflag was never updated to match. The bug sat dormant because the only previously-published artifact (manually published to npmjs.org in 2021) wasn't built with this script.Today's first-ever
semantic-releaserun on this repo published a fresh1.0.0to Cloudsmith, built from currentmaster— which hit this bug for the first time. Consumers (lm-frontend) importing from@learningmachine/cachinggot:because
dist/caching.d.tsdeclareddeclare module 'caching' { ... }— a module name that doesn't match what's actually being imported.Fix
--name caching→--name @learningmachine/caching, so the bundled ambient module declarations match the real import specifier.--out caching.d.tsexplicitly:dts-bundlederives the output path from--namewhen--outisn't given, which would've nested the file under a@learningmachine/directory and broken the build script'scp build-temp/caching.d.ts dist/step.Testing
npm run buildlocally: confirmeddist/caching.d.tsnow declares@learningmachine/cachingand its submodules correctly;dist/index.js/dist/index-cjs.jsare byte-identical to before (only the type-declaration generation changed).dist/into a locallm-frontendcheckout'snode_modules/@learningmachine/cachingand ran the exact failing CI command,npm run build:issuing— completed successfully with noTS2306or any othercaching-related errors (previously failed with 5 errors across 5 files).Next steps after merge
Merging will trigger this repo's
semantic-releasestep and publish a new version to Cloudsmith.lm-frontend's lockfile will need to be updated to pick up that new version once published.