aboutsummaryrefslogtreecommitdiffhomepage
path: root/preinstall.js
diff options
context:
space:
mode:
Diffstat (limited to 'preinstall.js')
-rw-r--r--preinstall.js4
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");
4const path = require("path"); 4const path = require("path");
5 5
6const { https } = require("follow-redirects"); 6const { https } = require("follow-redirects");
7const semver = require("semver");
7const tar = require("tar"); 8const tar = require("tar");
8const unbz2 = require("unbzip2-stream"); 9const unbz2 = require("unbzip2-stream");
9const unzipper = require("unzipper"); 10const unzipper = require("unzipper");
@@ -18,6 +19,9 @@ if (!dhallVersion) throw new Error("Missing DHALL_VERSION environment variable."
18 19
19const dhallJsonVersion = trim(pkg["dhall-json-version"] || process.env.DHALL_JSON_VERSION); 20const dhallJsonVersion = trim(pkg["dhall-json-version"] || process.env.DHALL_JSON_VERSION);
20if (!dhallJsonVersion) throw new Error("Missing DHALL_JSON_VERSION environment variable."); 21if (!dhallJsonVersion) throw new Error("Missing DHALL_JSON_VERSION environment variable.");
22if (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
22const release = `https://github.com/dhall-lang/dhall-haskell/releases/download/${dhallVersion}/dhall-json-${dhallJsonVersion}`; 26const release = `https://github.com/dhall-lang/dhall-haskell/releases/download/${dhallVersion}/dhall-json-${dhallJsonVersion}`;
23 27