feat: on-demand binary download fallback for npm distribution#92
Merged
Conversation
When the platform-specific optional dependency is not installed (e.g. --no-optional, --ignore-scripts, strict lockfiles), the bin shim now downloads the correct binary from the npm registry on first run. Three-layer resilience: 1. optionalDependencies (normal path) 2. postinstall script (best-effort pre-warm) 3. On-demand download in bin/archgate.cjs (ultimate fallback)
Deploying archgate-cli with
|
| Latest commit: |
02f87ad
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://762da0e8.archgate-cli.pages.dev |
| Branch Preview URL: | https://feat-npm-binary-fallback-dow.archgate-cli.pages.dev |
234b8b6 to
77a2472
Compare
The oniguruma WASM engine crashes with "call_indirect to a null table entry" when Astro builds under Bun on Cloudflare Pages. Switch expressive-code to the pure-JS regex engine which doesn't require WASM.
Merged
rhuanbarreto
added a commit
that referenced
this pull request
Mar 20, 2026
* feat: on-demand binary download fallback for npm distribution When the platform-specific optional dependency is not installed (e.g. --no-optional, --ignore-scripts, strict lockfiles), the bin shim now downloads the correct binary from the npm registry on first run. Three-layer resilience: 1. optionalDependencies (normal path) 2. postinstall script (best-effort pre-warm) 3. On-demand download in bin/archgate.cjs (ultimate fallback) * fix: use Shiki JS engine to avoid WASM crash on Cloudflare Pages The oniguruma WASM engine crashes with "call_indirect to a null table entry" when Astro builds under Bun on Cloudflare Pages. Switch expressive-code to the pure-JS regex engine which doesn't require WASM.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--no-optional,--ignore-scripts, strict lockfiles, CI quirks), the bin shim now downloads the correct binary from the npm registry on first runoptionalDependencies— normal path viarequire.resolve()postinstallscript — best-effort pre-warm that triggers the download during install (skipped silently if blocked)bin/archgate.cjs— ultimate fallback that fetches the platform tarball fromregistry.npmjs.orgusing only Node.js built-ins (https,zlib)Test plan
npm install archgate— verify optional dep path works as beforenpm install --no-optional archgate— verify postinstall downloads binarynpm install --ignore-scripts --no-optional archgate— verify firstarchgate --versiontriggers on-demand download