diff options
author | Cyril Sobierajewicz <cyril.sobierajewicz@fretlink.com> | 2019-05-18 00:17:02 +0200 |
---|---|---|
committer | Cyril Sobierajewicz <cyril.sobierajewicz@fretlink.com> | 2019-05-20 13:51:27 +0200 |
commit | 6337a3be1c44fa988f28d8f7747f1edd75dbbaf5 (patch) | |
tree | e820ac0b10104231c7789a93389f7a36ddf025f0 /preinstall.js | |
parent | 03aaa7d3bbf9ff2176fe3b69138f37f5f265d186 (diff) | |
download | node-dhall-json-bin-6337a3be1c44fa988f28d8f7747f1edd75dbbaf5.tar.gz node-dhall-json-bin-6337a3be1c44fa988f28d8f7747f1edd75dbbaf5.tar.zst node-dhall-json-bin-6337a3be1c44fa988f28d8f7747f1edd75dbbaf5.zip |
Add `json-to-dhall`
Diffstat (limited to 'preinstall.js')
-rw-r--r-- | preinstall.js | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/preinstall.js b/preinstall.js index 071f159..3fa2382 100644 --- a/preinstall.js +++ b/preinstall.js | |||
@@ -4,6 +4,7 @@ const fs = require("fs"); | |||
4 | const path = require("path"); | 4 | const path = require("path"); |
5 | 5 | ||
6 | const { https } = require("follow-redirects"); | 6 | const { https } = require("follow-redirects"); |
7 | const semver = require("semver"); | ||
7 | const tar = require("tar"); | 8 | const tar = require("tar"); |
8 | const unbz2 = require("unbzip2-stream"); | 9 | const unbz2 = require("unbzip2-stream"); |
9 | const unzipper = require("unzipper"); | 10 | const unzipper = require("unzipper"); |
@@ -18,6 +19,9 @@ if (!dhallVersion) throw new Error("Missing DHALL_VERSION environment variable." | |||
18 | 19 | ||
19 | const dhallJsonVersion = trim(pkg["dhall-json-version"] || process.env.DHALL_JSON_VERSION); | 20 | const dhallJsonVersion = trim(pkg["dhall-json-version"] || process.env.DHALL_JSON_VERSION); |
20 | if (!dhallJsonVersion) throw new Error("Missing DHALL_JSON_VERSION environment variable."); | 21 | if (!dhallJsonVersion) throw new Error("Missing DHALL_JSON_VERSION environment variable."); |
22 | if (semver.valid(dhallJsonVersion) && semver.lt(dhallJsonVersion, "1.2.8")) { | ||
23 | throw new Error(`This release of the \`${pkg.name}\` npm package installs \`json-to-dhall\`, which isn’t provided by \`dhall-json@<1.2.8\`.`); | ||
24 | } | ||
21 | 25 | ||
22 | const release = `https://github.com/dhall-lang/dhall-haskell/releases/download/${dhallVersion}/dhall-json-${dhallJsonVersion}`; | 26 | const release = `https://github.com/dhall-lang/dhall-haskell/releases/download/${dhallVersion}/dhall-json-${dhallJsonVersion}`; |
23 | 27 | ||