-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added cli fallback to download binary
- Loading branch information
Showing
2 changed files
with
24 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,23 @@ | ||
#!/usr/bin/env node | ||
|
||
const childProcess = require('child_process') | ||
const {getBinaryPath} = require('../index') | ||
const {isPlatformSpecificPackageInstalled, downloadBinaryFromNpm} = require('../install') | ||
|
||
require('child_process').execFileSync(getBinaryPath(), process.argv.slice(2), { | ||
stdio: 'inherit' | ||
}) | ||
// Skip downloading the binary if it was already installed via optionalDependencies | ||
if (!isPlatformSpecificPackageInstalled()) { | ||
console.log('Platform specific package not found. Will manually download binary...') | ||
downloadBinaryFromNpm() | ||
.then(() => { | ||
childProcess.execFileSync(getBinaryPath(), process.argv.slice(2), { | ||
stdio: 'inherit' | ||
}) | ||
}) | ||
.catch((error) => { | ||
console.log('Failed to download and execute the binary:', error) | ||
}) | ||
} else { | ||
childProcess.execFileSync(getBinaryPath(), process.argv.slice(2), { | ||
stdio: 'inherit' | ||
}) | ||
} |
This file contains 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