fix(cli): add prepack hook so chmod +x runs at publish time in CI#25
Merged
Conversation
PR #23 added `chmod +x dist/index.js` to the CLI's build script. That works for `npm run build --workspace=packages/cli` and local development, but CI's release job runs root `npm run build` which is just `tsc -b` and does NOT recurse into workspace npm scripts. Result: published 0.1.1 tarball still had `dist/index.js` without the execute bit, smoke test failed again with `sh: 1: tokenometer: not found`. Add `prepack` script in packages/cli/package.json. `prepack` runs right before `npm publish` packs the tarball — guaranteed to run regardless of how the build was invoked. Belt and suspenders alongside the build-script chmod. Patch changeset for v0.1.2. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
faraa2m
added a commit
that referenced
this pull request
May 11, 2026
PR #23 added `chmod +x dist/index.js` to the CLI's build script. That works for `npm run build --workspace=packages/cli` and local development, but CI's release job runs root `npm run build` which is just `tsc -b` and does NOT recurse into workspace npm scripts. Result: published 0.1.1 tarball still had `dist/index.js` without the execute bit, smoke test failed again with `sh: 1: tokenometer: not found`. Add `prepack` script in packages/cli/package.json. `prepack` runs right before `npm publish` packs the tarball — guaranteed to run regardless of how the build was invoked. Belt and suspenders alongside the build-script chmod. Patch changeset for v0.1.2. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
PR #23's chmod was in the CLI's `build` script. Root `npm run build` (= `tsc -b`) doesn't recurse into workspace npm scripts, so CI never ran it. Published 0.1.1 still had `dist/index.js` without +x. Smoke test still fails:
```
$ npx --yes tokenometer@0.1.1 --version
sh: 1: tokenometer: not found
```
Fix
`prepack` script in `packages/cli/package.json`. Runs before npm packs the tarball — fires regardless of how build was invoked. Build-script chmod stays as belt-and-suspenders.
After merge
🤖 Generated with Claude Code