diff options
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 | ||