]> git.immae.eu Git - github/fretlink/node-dhall-json-bin.git/commitdiff
Merge pull request #1 from cyrilfretlink/yaml-to-dhall
authorCyril Sobierajewicz <38043722+cyrilfretlink@users.noreply.github.com>
Fri, 2 Aug 2019 08:50:34 +0000 (10:50 +0200)
committerGitHub <noreply@github.com>
Fri, 2 Aug 2019 08:50:34 +0000 (10:50 +0200)
 Add `yaml-to-dhall`

package.json
preinstall.js

index 88b020412721c9f944503f44af1f6106d2419150..d55964a200909a0898dd5e88bf198f609353d2ef 100644 (file)
@@ -1,6 +1,6 @@
 {
   "name": "dhall-json",
-  "version": "1.0.0",
+  "version": "1.0.1",
   "description": "NPM package for `dhall-json`, based on https://github.com/justinwoo/npm-psc-package-bin-simple.",
   "os": [
     "linux",
@@ -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}`;