aboutsummaryrefslogtreecommitdiffhomepage
path: root/preinstall.js
diff options
context:
space:
mode:
Diffstat (limited to 'preinstall.js')
-rw-r--r--preinstall.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/preinstall.js b/preinstall.js
index 01db9e0..d53bca2 100644
--- a/preinstall.js
+++ b/preinstall.js
@@ -59,9 +59,16 @@ const readVersion = name =>
59 59
60const dhallVersion = readVersion("dhall"); 60const dhallVersion = readVersion("dhall");
61const dhallJsonVersion = readVersion("dhall-json"); 61const dhallJsonVersion = readVersion("dhall-json");
62if (semver.valid(dhallJsonVersion) && semver.lt(dhallJsonVersion, "1.2.8")) { 62
63const isLowerThan = (version, upperBound) =>
64 semver.valid(version) && semver.lt(version, upperBound);
65
66if (isLowerThan(dhallJsonVersion, "1.2.8")) {
63 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\`.`); 67 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\`.`);
64} 68}
69if (isLowerThan(dhallJsonVersion, "1.3.0")) {
70 throw new Error(`This release of the \`${pkg.name}\` npm package installs \`yaml-to-dhall\`, which isn’t provided by \`dhall-json@<1.3.0\`.`);
71}
65 72
66const release = `https://github.com/dhall-lang/dhall-haskell/releases/download/${dhallVersion}/dhall-json-${dhallJsonVersion}`; 73const release = `https://github.com/dhall-lang/dhall-haskell/releases/download/${dhallVersion}/dhall-json-${dhallJsonVersion}`;
67 74