Skip to content

Comments

fix(package): build dist/ on prepare so git installs work#197

Open
ramonclaudio wants to merge 1 commit intotobi:mainfrom
ramonclaudio:fix/prepare-build-on-install
Open

fix(package): build dist/ on prepare so git installs work#197
ramonclaudio wants to merge 1 commit intotobi:mainfrom
ramonclaudio:fix/prepare-build-on-install

Conversation

@ramonclaudio
Copy link

@ramonclaudio ramonclaudio commented Feb 16, 2026

npm install from a cloned repo breaks because dist/ is gitignored and prepare only runs git hooks. the shim needs dist/qmd.js and it doesn't exist.

Changes

Only touches package.json (+2/-4):

  • prepare tries tsc when dist/ is missing, exits 1 if it's still not there
  • typescript moved from peerDependencies to devDependencies
  • registry installs skip the build (dist/ already ships in the tarball)

no shim changes, no new runtime deps.

Test Plan

fresh clone, npm install, dist/ gets created, ./qmd --version and ./qmd status both work.

npm install -g github:tobi/qmd still breaks. npm doesn't install devDeps before prepare on global git installs (npm/cli#8440), same with bun (oven-sh/bun#10297). can't fix from package.json. now it prints dist/ missing and exits 1 instead of silently doing nothing.

The `qmd` shim expects `dist/qmd.js` but git installs
(`npm install -g https://github.com/tobi/qmd`) don't run
the build step, so `dist/` never exists.

- Add `tsc` to `prepare` — npm runs this after installing
  deps (including devDeps) for git-based installs
- Move `typescript` from peerDependencies to devDependencies
  so `tsc` is guaranteed available during `prepare`
- `2>/dev/null || true` degrades gracefully when tsc is
  unavailable (registry installs already ship dist/)

Fixes tobi#182
@ramonclaudio ramonclaudio force-pushed the fix/prepare-build-on-install branch from 49310c0 to 881109b Compare February 20, 2026 15:45
@ramonclaudio ramonclaudio changed the title fix: build dist/ during prepare so git installs work fix(package): build dist/ on prepare so git installs work Feb 20, 2026
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