From 4e6881904dca8ef55059618318b1463d9386d41f Mon Sep 17 00:00:00 2001 From: John Kattenhorn Date: Fri, 17 Apr 2026 10:35:27 +0100 Subject: [PATCH] fix(install): add prepare script so git installs build dist/ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Consumers installing via `npm install -g github:LarsCowe/bmalph` (or any fork thereof) run npm's `prepare` lifecycle, not `prepack`. Without a prepare script, `dist/` is never built at install time and the CLI fails at launch (missing compiled output). The `[ -f tsconfig.json ]` guard skips compilation in the published tarball case where tsconfig.json is excluded (via .npmignore or the `files` whitelist), so the script is a no-op for regular `npm install bmalph` consumers. Test plan: 1. From a clean directory: `npm install -g github:LarsCowe/bmalph#pr-prepare-script` 2. `bmalph --version` should print the installed version (previously: `/usr/bin/bmalph: cannot execute` because `dist/` missing). 3. Regular npm registry installs (`npm install bmalph`) unchanged — tsconfig.json not in the tarball, guard trips, no-op. --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 01fb105..af99695 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "clean": "rm -rf dist", "rebuild": "npm run clean && npm run build", "prepack": "npm run build", + "prepare": "[ -f tsconfig.json ] && npm run build || true", "prepublishOnly": "npm run lint && npm run build && npm run test:all", "update-bundled": "bash scripts/update-bundled.sh" },