diff options
author | Cyril Sobierajewicz <38043722+cyrilfretlink@users.noreply.github.com> | 2019-08-02 11:11:40 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-02 11:11:40 +0200 |
commit | 3ad6fbb588c5a21ad3cc00322b2fc43c8ff81403 (patch) | |
tree | 08ca7d86a4058702a97830f1b3bc75b7b260f7fd /preinstall.js | |
parent | 715fe0113813acb9e0cca251719c6394d4c3ab94 (diff) | |
parent | db0557cd2aef9a59cf581d3ff8c57125eaf5ca81 (diff) | |
download | node-dhall-json-bin-3ad6fbb588c5a21ad3cc00322b2fc43c8ff81403.tar.gz node-dhall-json-bin-3ad6fbb588c5a21ad3cc00322b2fc43c8ff81403.tar.zst node-dhall-json-bin-3ad6fbb588c5a21ad3cc00322b2fc43c8ff81403.zip |
Merge pull request #2 from cyrilfretlink/macos
Add support for macOS
Diffstat (limited to 'preinstall.js')
-rw-r--r-- | preinstall.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/preinstall.js b/preinstall.js index d53bca2..91c3a52 100644 --- a/preinstall.js +++ b/preinstall.js | |||
@@ -85,7 +85,13 @@ if (process.platform === "win32") { | |||
85 | res.pipe(unzipper.Extract({ path: bindir })) | 85 | res.pipe(unzipper.Extract({ path: bindir })) |
86 | ); | 86 | ); |
87 | } else { | 87 | } else { |
88 | get("x86_64-linux.tar.bz2", res => | 88 | const isDarwin = process.platform === 'darwin'; |
89 | |||
90 | if (isDarwin && isLowerThan(dhallJsonVersion, "1.4.0")) { | ||
91 | throw new Error(`Static macOS binaries aren’t provided by \`dhall-json@<1.4.0\`.`); | ||
92 | } | ||
93 | |||
94 | get(`x86_64-${isDarwin ? 'macos' : 'linux'}.tar.bz2`, res => | ||
89 | res.pipe(unbz2()).pipe(tar.x({ C: __dirname }).on("finish", () => { | 95 | res.pipe(unbz2()).pipe(tar.x({ C: __dirname }).on("finish", () => { |
90 | fs.readdir(bindir, (err, names) => { | 96 | fs.readdir(bindir, (err, names) => { |
91 | if (err) throw err; | 97 | if (err) throw err; |