Skip to content

Investigate Root Cause of Globally Installed Binary Executing Source Instead of Build Output #16

Description

@johnlindquist

Problem:
Users observed that the globally installed wt command (installed via pnpm i -g @johnlindquist/worktree) was executing the TypeScript source file (src/index.ts) instead of the compiled JavaScript output (build/index.js).

Investigation Steps:

  • Reviewed package.json (bin, files), tsconfig.json (outDir), .npmignore, and .gitignore. Configuration appeared correct.
  • Analyzed the publish.yml GitHub Actions workflow.
  • Examined logs from a successful workflow run (14380850320) for version 2.7.10.
  • Confirmed the build step completed successfully.
  • Confirmed the pre-publish tarball inspection (tar -tvf) showed the correct structure (package/build/index.js) with execute permissions.
  • Performed a fresh global install: pnpm i -g @johnlindquist/worktree@2.7.10.
  • Verified the installed binary path using which wt.
  • Inspected the pnpm shim file (cat $(which wt)), confirming it correctly targets and executes .../node_modules/@johnlindquist/worktree/build/index.js.

Conclusion:
The configuration (package.json, build process, packaging) in the analyzed successful release (2.7.10) is correct. The globally installed binary shim generated by pnpm now correctly executes the intended build/index.js file.

Possible Root Causes:

  1. Stale Cache/Link: An older, incorrectly packaged version might have been cached or linked by pnpm, and the update didn't fully clear it until the explicit reinstall.
  2. Local Development Link Interference: A pnpm link --global from the local development environment might have been active, overriding the globally installed package version and pointing to the source files.

Resolution:
Explicitly reinstalling the globally package (pnpm i -g @johnlindquist/worktree@<version>) ensures the correct version is used and the pnpm shim points to the built artifact (build/index.js).

Action:
Close this issue, as the primary problem seems resolved and the current configuration/workflow produces the correct package. Monitor future releases in case the issue reappears.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions