Repository navigation
fix(publish): include dist/ in npm tarball + add publish-guard CI - #2
Merged
Merged
Conversation
- Add prepack script (clean + build) so npm pack + npm publish both emit dist/
- Tighten prepublishOnly to run tests before prepack
- Make clean cross-platform (node:fs.rmSync instead of rm -rf)
- Add publish-guard workflow: pack on tag/PR, fail if dist/ missing
- Verifies dist/index.js, index.d.ts, lambda/sse-writer.js, providers/openai-compatible.js
v2.0.0 was published without dist/ because prepublishOnly did not run during
npm pack, and the clean script was not cross-platform. v2.0.1 will include it.
Downstream consumer (Sociedad Opita PR #9) needs
\import { streamText } from '@opita/ocais'\ to work after fresh install.
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.
Bug
@opita/ocais@2.0.0published WITHOUTdist/directory in the npm tarball. Verified via localnpm pack: only 3 files (LICENSE,README.md,package.json). Downstream consumers (e.g., Sociedad Opitaapi/src/api.tsline 15:import { streamText, openai, createSSEWriter } from "@opita/ocais") fail at runtime.Root cause
Maintainer's
package.jsonhadprepublishOnly: "npm run clean && npm run build"but noprepackhook, no tests inprepublishOnly, no CI guard, andcleanused Unix-onlyrm -rf dist(breaks on Windows).Fix
prepackscript (NEW):npm run clean && npm run build— fires onnpm packANDnpm publishprepublishOnly: nownpm test && npm run prepack— gated with testsclean: cross-platformnode:fs.rmSync(no morerm -rfWindows bug)publish-guard.yml(NEW): CI workflow runsci + build + test + packon everyv*tag and PR touchingpackage.json; fails if any ofdist/index.js,dist/index.d.ts,dist/lambda/sse-writer.js, ordist/providers/openai-compatible.jsmissing from tarballVerification
Impact
v2.0.1will be the first release with properdist/in the tarballpnpm installcleanly without manual workaroundsMigration
Test plan
git tag v2.0.1 && git push --tagspublish-guardworkflow validates v2.0.1 tarball on the tag push^2.0.1)