Skip to content

fix(npm): replace broken postinstall with lazy-download shim#34

Merged
seanseannery merged 4 commits intomainfrom
fix/npm-install-test-ci
Mar 7, 2026
Merged

fix(npm): replace broken postinstall with lazy-download shim#34
seanseannery merged 4 commits intomainfrom
fix/npm-install-test-ci

Conversation

@seanseannery
Copy link
Owner

Key Changes

  • Replace npm postinstall script with a lazy-download shim (install/shim.js) that downloads the platform binary on first use to ~/.opsfile/ops
  • Fix install smoke test to install from local working tree instead of GitHub main (which still had the broken postinstall)
  • Move npm test before brew test with cleanup between them to avoid bin path conflicts
  • Add GITHUB_TOKEN auth headers to install.sh and npm_install.js to avoid GitHub API rate limits in CI
  • Separate install smoke tests into their own CI job on macos-latest with setup-node

Why do we need this?

The npm install via postinstall script was broken — npm runs lifecycle scripts in a temp directory that gets removed, causing ENOENT: process.cwd failures. The shim approach avoids lifecycle scripts entirely by deferring the binary download to first invocation.

Additionally, the smoke test was always installing from GitHub main (not the branch being tested), so the fix could never actually be validated until merged — a chicken-and-egg problem.

New modules or other dependencies introduced

  • install/shim.js — new Node.js shim script (no external dependencies, uses only https, fs, path, os, child_process)

How was this tested?

  • make test-install locally: 3/3 passed (curl, npm, brew)
  • CI release workflow on this branch: Test ✓, Install smoke tests ✓ (Release job fails at Homebrew push step as expected on a feature branch)

seanseannery added 4 commits March 7, 2026 02:39
…npmrc

Test was installing from GitHub main (which still has broken postinstall),
now installs from local working tree. Removed .npmrc script-shell workaround
that was only needed for the old postinstall approach.
@seanseannery seanseannery merged commit cde0f7a into main Mar 7, 2026
6 of 7 checks passed
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