Skip to content

fix(cli): add prepack hook so chmod +x runs at publish time in CI#25

Merged
faraa2m merged 1 commit into
mainfrom
fix/cli-prepack-chmod
May 10, 2026
Merged

fix(cli): add prepack hook so chmod +x runs at publish time in CI#25
faraa2m merged 1 commit into
mainfrom
fix/cli-prepack-chmod

Conversation

@faraa2m
Copy link
Copy Markdown
Owner

@faraa2m faraa2m commented May 10, 2026

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

  1. Workflow opens Version Packages PR for v0.1.2.
  2. Merge → publishes — this time the tarball has +x → smoke test passes → vsce + ovsx publish.
    🤖 Generated with Claude Code

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>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 10, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
tokenometer Ready Ready Preview, Comment May 10, 2026 6:17am

@faraa2m faraa2m merged commit 377ebff into main May 10, 2026
7 checks passed
@faraa2m faraa2m deleted the fix/cli-prepack-chmod branch May 10, 2026 06:18
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant