Conversation
…ckout `packages/core` depends on `@reactuses/ts-document` as `workspace:*`, and that package declares `"main": "lib/index.js"`. `lib/` is build output: it is gitignored and produced only by `tsc`, which was referenced solely by `prepublishOnly`. Nothing ran it on install, so `pnpm --filter @reactuses/core gend` failed with MODULE_NOT_FOUND for any contributor who had not built it by hand. Adding `prepare` makes pnpm build the package during `pnpm install`, which is the lifecycle hook intended for exactly this case. Fixes childrentime#233 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This was referenced Sep 22, 2026
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.
Description
Fixes #233.
pnpm --filter @reactuses/core gendfails from a clean install withMODULE_NOT_FOUNDfor@reactuses/ts-document.packages/coredepends on it asworkspace:*, so it always resolves topackages/ts-document, which declares"main": "lib/index.js".lib/is build output — gitignored (.gitignore:28), nothing under it tracked — and the only script that produces it istsc, referenced solely byprepublishOnly. That runs onnpm publish, not on install, and neither the package nor the root manifest definedprepareorpostinstall. Solib/never existed for any contributor who had not run the build by hand.The fix is one line:
"prepare": "npm run tsc", the lifecycle hook intended for exactly this case. pnpm runs it for workspace projects duringpnpm install.This matters because
CLAUDE.mdmakes regeneration mandatory ("If you change aninterface.ts, re-rungendand commit the result"), while the remark plugin drops the%%API%%marker silently when the generated file is missing — so a contributor either hitsMODULE_NOT_FOUNDor ships a docs page with no signature table and nothing fails.Options considered
prepareinpackages/ts-document/package.json— chosen. Standard lifecycle hook, scoped to the package that owns the build, andtscis alreadyrm -rf lib/ && tsc, so it is idempotent.postinstallcallingpnpm --filter @reactuses/ts-document run tsc— works, but moves one package's build concern into the root manifest.Verification
Reproduced and verified locally on
48561e0:pnpm lintpasses.pnpm test(core): 74 suites, 431 tests passing.pnpm-lock.yamlunchanged — adding a script does not affect resolution.One pre-existing failure, unrelated to this change and reproducible on
mainat48561e0:pnpm --filter @reactuses/ts-document testfails withTypeError: Cannot read properties of undefined (reading 'testEnvironmentOptions'), because jest 27.5.1 in that package resolvesjest-environment-node29.7.0 from the root. Untouched here since it is out of scope, but it does meanprepublishOnlywould fail today.Type of Change
Checklist
Notes on the unticked boxes: no tests added — this is a one-line lifecycle script, verified by the clean-install reproduction above rather than by a unit test. No docs update needed. "All existing tests pass" refers to lint and the core suite; see the pre-existing
ts-documentjest failure noted above.AI disclosure: investigation, the clean-install verification, and this description were done with Claude Code.
🤖 Generated with Claude Code