aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorCyril Sobierajewicz <38043722+cyrilfretlink@users.noreply.github.com>2019-08-02 11:11:40 +0200
committerGitHub <noreply@github.com>2019-08-02 11:11:40 +0200
commit3ad6fbb588c5a21ad3cc00322b2fc43c8ff81403 (patch)
tree08ca7d86a4058702a97830f1b3bc75b7b260f7fd
parent715fe0113813acb9e0cca251719c6394d4c3ab94 (diff)
parentdb0557cd2aef9a59cf581d3ff8c57125eaf5ca81 (diff)
downloadnode-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.md6
-rw-r--r--package.json3
-rw-r--r--preinstall.js8
3 files changed, 11 insertions, 6 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..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;