chore: add prepublishOnly hook so dist/ is always built before publish - #96
Open
Shawnchee wants to merge 1 commit into
Open
chore: add prepublishOnly hook so dist/ is always built before publish#96Shawnchee wants to merge 1 commit into
Shawnchee wants to merge 1 commit into
Conversation
dist/ is gitignored and built manually, so a forgotten build before npm publish would ship an empty package. Build it automatically via a Java-free bundle step on publish
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.
Problem
The published package is entirely
dist/—main,module, andtypingsall resolve there andfilesis["dist"]. Butdist/is gitignored and only produced by a manualnpm run build(a step inPUBLISH.md). Nothing enforces that build, so a publish from a clean checkout / one where the build step is skipped / ships a package with no codeChange
prepublishOnlyruns automatically beforenpm publish/pnpm publish, sodist/is always built and packedDesign notes
prepublishOnly, notprepare—preparealso runs on everynpm install, pushing the build toolchain onto consumers/contributors;prepublishOnlyruns only at publish timebundle(tsup), not the fullbuild—generated/is committed, sodist/builds without invokingopenapi-gen(which needs Java) and without regenerating tracked sources at publish time.bundleis factored out ofbuildso the tsup command isn't duplicatednpm install;buildbehaves exactly as before