From 24e022052448093bb541eb0c615c5c8918c8edea Mon Sep 17 00:00:00 2001 From: Faraazuddin Mohammed Date: Sun, 10 May 2026 02:16:48 -0400 Subject: [PATCH] fix(cli): add prepack hook so chmod +x runs at publish time in CI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- .changeset/cli-prepack-chmod.md | 11 +++++++++++ packages/cli/package.json | 1 + 2 files changed, 12 insertions(+) create mode 100644 .changeset/cli-prepack-chmod.md diff --git a/.changeset/cli-prepack-chmod.md b/.changeset/cli-prepack-chmod.md new file mode 100644 index 0000000..04caebe --- /dev/null +++ b/.changeset/cli-prepack-chmod.md @@ -0,0 +1,11 @@ +--- +"tokenometer": patch +"@tokenometer/core": patch +--- + +Fix CLI bin missing execute bit when published from CI. Root `npm run +build` runs `tsc -b` without recursing into workspace scripts, so the +chmod added in the CLI's build script never ran in CI. Added a `prepack` +hook in `packages/cli/package.json` that chmods `dist/index.js` right +before `npm publish` packs the tarball — runs regardless of how the +build was invoked. diff --git a/packages/cli/package.json b/packages/cli/package.json index 29f2d9b..969cf9e 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -76,6 +76,7 @@ }, "scripts": { "build": "tsc -b && chmod +x dist/index.js", + "prepack": "chmod +x dist/index.js", "clean": "rm -rf dist" }, "dependencies": {