fix(install): replace bash-specific syntax with cross-platform Node.js#95
Merged
pioug merged 1 commit intonfroidure:mainfrom Feb 19, 2026
Merged
Conversation
Contributor
Author
|
Hi @nfroidure! Just a friendly ping on this PR. It replaces the bash-specific install script with a cross-platform Node.js equivalent, fixing install failures on Windows, Bun, Alpine Docker, and CI environments. Would you have a chance to take a look when you get a moment? Happy to adjust anything. Thanks! |
Collaborator
|
@YevheniiKotyrlo What about a separate script file like in |
8f01f8d to
deeb2c4
Compare
Contributor
Author
|
Good suggestion — updated the PR to use a separate |
deeb2c4 to
91befd2
Compare
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
Replace bash-specific install script with a cross-platform Node.js script in a separate file, following the same pattern used by sharp and npm ecosystem best practices for portable package scripts.
Problem
The current install script uses bash subshell syntax:
((node-gyp configure && node-gyp build) > builderror.log) || (exit 0)This syntax fails silently or errors in multiple environments:
1. Bun Package Manager (Windows)
oven-sh/bun#11124 - Bun's shell doesn't support subshells with redirections:
2. Alpine Linux / Docker (BusyBox ash)
Alpine's default shell is
ash, notbash. The((...))subshell syntax causes:This affects Docker deployments using
node:alpineimages.3. Windows (cmd.exe / PowerShell)
Windows doesn't have bash. Complex bash syntax fails in cmd.exe, the default npm script shell on Windows.
4. Related ttf2woff2 Issues
Solution
Move the install logic to a dedicated
install/try-build.jsscript:Why this works everywhere
Node.js
execSyncdelegates to the platform's native shell:/bin/sh -ccmd.exe /d /s /cBoth shells support
&&and2>&1. The complexity is handled by Node.js, not the package manager's shell.Changes
install/try-build.js— new file with the build logicpackage.json— updatedinstallscript + addedinstalltofilesarrayComparison
Testing
Verified on:
builderror.logcreated on both success and failurenpm pack --dry-runconfirmsinstall/try-build.jsincluded in tarballNo breaking changes. The behavior is identical — only the implementation is more portable and readable.