]> git.immae.eu Git - github/fretlink/node-dhall-json-bin.git/commitdiff
Merge pull request #3 from cyrilfretlink/yaml-to-dhall-upper-bound pre-1.6.0-1.28.0
authorCyril Sobierajewicz <38043722+cyrilfretlink@users.noreply.github.com>
Tue, 12 May 2020 09:51:51 +0000 (11:51 +0200)
committerGitHub <noreply@github.com>
Tue, 12 May 2020 09:51:51 +0000 (11:51 +0200)
Add an upper bound to the `dhall-json` versions providing `yaml-to-dhall`

package-lock.json
package.json
preinstall.js

index 2617e324aa0c22b5cedfa3abd7d5b98ef7179f4d..2769f8a6aed214180aa8d18b090e3700208c24f3 100644 (file)
@@ -1,6 +1,6 @@
 {
   "name": "dhall-json",
-  "version": "1.0.0",
+  "version": "2.0.1",
   "lockfileVersion": 1,
   "requires": true,
   "dependencies": {
index 3a7dfd02773cebc4ba4f49e752ac99382e8d1775..5d7cb78c3b9052669c097ee85ef0ea58055f2e75 100644 (file)
@@ -1,6 +1,6 @@
 {
   "name": "dhall-json",
-  "version": "2.0.0",
+  "version": "2.0.1",
   "description": "NPM package for `dhall-json`, based on https://github.com/justinwoo/npm-psc-package-bin-simple.",
   "os": [
     "darwin",
index 91c3a523f0ac26616a2d79147d88621e1f78774c..292b73b961ff8d518baac93cfd48de5f6e11e2c9 100644 (file)
@@ -60,14 +60,16 @@ const readVersion = name =>
 const dhallVersion = readVersion("dhall");
 const dhallJsonVersion = readVersion("dhall-json");
 
-const isLowerThan = (version, upperBound) =>
+const isLesserThan = (version, upperBound) =>
   semver.valid(version) && semver.lt(version, upperBound);
+const isGreaterThan = (version, lowerBound) =>
+  semver.valid(version) && semver.gt(version, lowerBound);
 
-if (isLowerThan(dhallJsonVersion, "1.2.8")) {
+if (isLesserThan(dhallJsonVersion, "1.2.8")) {
   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\`.`);
 }
-if (isLowerThan(dhallJsonVersion, "1.3.0")) {
-  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\`.`);
+if (isLesserThan(dhallJsonVersion, "1.3.0") || isGreaterThan(dhallJsonVersion, "1.5.0")) {
+  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 >1.5.0\`.`);
 }
 
 const release = `https://github.com/dhall-lang/dhall-haskell/releases/download/${dhallVersion}/dhall-json-${dhallJsonVersion}`;
@@ -87,7 +89,7 @@ if (process.platform === "win32") {
 } else {
   const isDarwin = process.platform === 'darwin';
 
-  if (isDarwin && isLowerThan(dhallJsonVersion, "1.4.0")) {
+  if (isDarwin && isLesserThan(dhallJsonVersion, "1.4.0")) {
     throw new Error(`Static macOS binaries aren’t provided by \`dhall-json@<1.4.0\`.`);
   }