]> git.immae.eu Git - github/fretlink/node-dhall-json-bin.git/commitdiff
Add `yaml-to-dhall`
authorCyril Sobierajewicz <cyril.sobierajewicz@fretlink.com>
Thu, 1 Aug 2019 15:58:29 +0000 (17:58 +0200)
committerCyril Sobierajewicz <cyril.sobierajewicz@fretlink.com>
Thu, 1 Aug 2019 16:14:11 +0000 (18:14 +0200)
package.json
preinstall.js

index 88b020412721c9f944503f44af1f6106d2419150..71a1cdb91fd1b19b36c5f39112012bd9993bc758 100644 (file)
@@ -15,7 +15,8 @@
   "bin": {
     "dhall-to-json": "bin/dhall-to-json.exe",
     "dhall-to-yaml": "bin/dhall-to-yaml.exe",
-    "json-to-dhall": "bin/json-to-dhall.exe"
+    "json-to-dhall": "bin/json-to-dhall.exe",
+    "yaml-to-dhall": "bin/yaml-to-dhall.exe"
   },
   "scripts": {
     "preinstall": "node ./preinstall.js"
index 01db9e0f8128f76e3dfd2ea0157fb0bd7d8d16a3..d53bca25827bca92282f3b542604d15237edfe04 100644 (file)
@@ -59,9 +59,16 @@ const readVersion = name =>
 
 const dhallVersion = readVersion("dhall");
 const dhallJsonVersion = readVersion("dhall-json");
-if (semver.valid(dhallJsonVersion) && semver.lt(dhallJsonVersion, "1.2.8")) {
+
+const isLowerThan = (version, upperBound) =>
+  semver.valid(version) && semver.lt(version, upperBound);
+
+if (isLowerThan(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\`.`);
+}
 
 const release = `https://github.com/dhall-lang/dhall-haskell/releases/download/${dhallVersion}/dhall-json-${dhallJsonVersion}`;