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 | |
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
-rw-r--r-- | README.md | 6 | ||||
-rw-r--r-- | package.json | 3 | ||||
-rw-r--r-- | preinstall.js | 8 |
3 files changed, 11 insertions, 6 deletions
@@ -3,14 +3,12 @@ NPM package for `dhall-json`, based on https://github.com/justinwoo/npm-psc-pack | |||
3 | 3 | ||
4 | ## Installation | 4 | ## Installation |
5 | 5 | ||
6 | :warning: This package should be installed as an optional dependency until static macOS builds are available from [`dhall-haskell` releases](https://github.com/dhall-lang/dhall-haskell/releases). | ||
7 | |||
8 | There’s two installation modes: | 6 | There’s two installation modes: |
9 | 7 | ||
10 | ### Locked | 8 | ### Locked |
11 | 9 | ||
12 | ``` | 10 | ``` |
13 | npm install --save-optional fretlink/node-dhall-json-bin#v<dhall-json version>-<dhall version>-<package version> | 11 | npm install fretlink/node-dhall-json-bin#v<dhall-json version>-<dhall version>-<package version> |
14 | ``` | 12 | ``` |
15 | 13 | ||
16 | This will install a specific version of `dhall-json`. Replace `<dhall-json version>`, `<dhall version>` and `<package version>` with appropriate versions of `dhall-json`, `dhall` and this package. | 14 | This will install a specific version of `dhall-json`. Replace `<dhall-json version>`, `<dhall version>` and `<package version>` with appropriate versions of `dhall-json`, `dhall` and this package. |
@@ -20,7 +18,7 @@ See [the releases](https://github.com/fretlink/node-dhall-json-bin/releases). | |||
20 | ### Dynamic | 18 | ### Dynamic |
21 | 19 | ||
22 | ``` | 20 | ``` |
23 | npm install --save-optional fretlink/node-dhall-json-bin | 21 | npm install fretlink/node-dhall-json-bin |
24 | ``` | 22 | ``` |
25 | 23 | ||
26 | This will install a version of `dhall-json` matching the `DHALL_JSON_VERSION` and `DHALL_VERSION` environment variables or the `dhall-json:dhall-json-version` and `dhall-json:dhall-version` [npm configuration settings](https://docs.npmjs.com/misc/config#per-package-config-settings). | 24 | This will install a version of `dhall-json` matching the `DHALL_JSON_VERSION` and `DHALL_VERSION` environment variables or the `dhall-json:dhall-json-version` and `dhall-json:dhall-version` [npm configuration settings](https://docs.npmjs.com/misc/config#per-package-config-settings). |
diff --git a/package.json b/package.json index d55964a..3a7dfd0 100644 --- a/package.json +++ b/package.json | |||
@@ -1,8 +1,9 @@ | |||
1 | { | 1 | { |
2 | "name": "dhall-json", | 2 | "name": "dhall-json", |
3 | "version": "1.0.1", | 3 | "version": "2.0.0", |
4 | "description": "NPM package for `dhall-json`, based on https://github.com/justinwoo/npm-psc-package-bin-simple.", | 4 | "description": "NPM package for `dhall-json`, based on https://github.com/justinwoo/npm-psc-package-bin-simple.", |
5 | "os": [ | 5 | "os": [ |
6 | "darwin", | ||
6 | "linux", | 7 | "linux", |
7 | "win32" | 8 | "win32" |
8 | ], | 9 | ], |
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; |