aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorCyril Sobierajewicz <cyril.sobierajewicz@fretlink.com>2019-08-01 18:06:12 +0200
committerCyril Sobierajewicz <cyril.sobierajewicz@fretlink.com>2019-08-02 10:54:10 +0200
commit045515b287b7eb0142278b83939497770c2e0659 (patch)
tree7409b8b32c9efe8cec981c70dc81ab39a3d48273
parent715fe0113813acb9e0cca251719c6394d4c3ab94 (diff)
downloadnode-dhall-json-bin-045515b287b7eb0142278b83939497770c2e0659.tar.gz
node-dhall-json-bin-045515b287b7eb0142278b83939497770c2e0659.tar.zst
node-dhall-json-bin-045515b287b7eb0142278b83939497770c2e0659.zip
Add support for macOS
-rw-r--r--README.md6
-rw-r--r--package.json1
-rw-r--r--preinstall.js8
3 files changed, 10 insertions, 5 deletions
diff --git a/README.md b/README.md
index 4e4fc3b..8cf297d 100644
--- a/README.md
+++ b/README.md
@@ -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
8There’s two installation modes: 6There’s two installation modes:
9 7
10### Locked 8### Locked
11 9
12``` 10```
13npm install --save-optional fretlink/node-dhall-json-bin#v<dhall-json version>-<dhall version>-<package version> 11npm install fretlink/node-dhall-json-bin#v<dhall-json version>-<dhall version>-<package version>
14``` 12```
15 13
16This 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. 14This 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```
23npm install --save-optional fretlink/node-dhall-json-bin 21npm install fretlink/node-dhall-json-bin
24``` 22```
25 23
26This 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). 24This 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..e01f821 100644
--- a/package.json
+++ b/package.json
@@ -3,6 +3,7 @@
3 "version": "1.0.1", 3 "version": "1.0.1",
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;