]> git.immae.eu Git - github/fretlink/node-dhall-json-bin.git/commitdiff
Add `json-to-dhall`
authorCyril Sobierajewicz <cyril.sobierajewicz@fretlink.com>
Fri, 17 May 2019 22:17:02 +0000 (00:17 +0200)
committerCyril Sobierajewicz <cyril.sobierajewicz@fretlink.com>
Mon, 20 May 2019 11:51:27 +0000 (13:51 +0200)
package-lock.json
package.json
preinstall.js

index 2637fdc54cff84a0556145a9840a0a012546f565..2617e324aa0c22b5cedfa3abd7d5b98ef7179f4d 100644 (file)
       "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
       "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
     },
+    "semver": {
+      "version": "6.0.0",
+      "resolved": "https://registry.npmjs.org/semver/-/semver-6.0.0.tgz",
+      "integrity": "sha512-0UewU+9rFapKFnlbirLi3byoOuhrSsli/z/ihNnvM24vgF+8sNBiI1LZPBSH9wJKUwaUbw+s3hToDLCXkrghrQ=="
+    },
     "setimmediate": {
       "version": "1.0.5",
       "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz",
index f81e02cf96ccb44af0e08b67df4a0b242f4d357a..7d557657bc98fe012829ab1dd5774dc0acf9ff44 100644 (file)
@@ -14,7 +14,8 @@
   ],
   "bin": {
     "dhall-to-json": "bin/dhall-to-json.exe",
-    "dhall-to-yaml": "bin/dhall-to-yaml.exe"
+    "dhall-to-yaml": "bin/dhall-to-yaml.exe",
+    "json-to-dhall": "bin/json-to-dhall.exe"
   },
   "scripts": {
     "preinstall": "node ./preinstall.js"
@@ -30,6 +31,7 @@
   "homepage": "https://github.com/cyrilfretlink/node-dhall-json#readme",
   "dependencies": {
     "follow-redirects": "^1.7.0",
+    "semver": "^6.0.0",
     "tar": "^4.4.8",
     "unbzip2-stream": "^1.3.3",
     "unzipper": "^0.9.12"
index 071f1590eb2c9e922dc61abf5fd0083878e88855..3fa23826d370bbdd3021e1814e2595bf4e27f319 100644 (file)
@@ -4,6 +4,7 @@ const fs = require("fs");
 const path = require("path");
 
 const { https } = require("follow-redirects");
+const semver = require("semver");
 const tar = require("tar");
 const unbz2 = require("unbzip2-stream");
 const unzipper = require("unzipper");
@@ -18,6 +19,9 @@ if (!dhallVersion) throw new Error("Missing DHALL_VERSION environment variable."
 
 const dhallJsonVersion = trim(pkg["dhall-json-version"] || process.env.DHALL_JSON_VERSION);
 if (!dhallJsonVersion) throw new Error("Missing DHALL_JSON_VERSION environment variable.");
+if (semver.valid(dhallJsonVersion) && semver.lt(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\`.`);
+}
 
 const release = `https://github.com/dhall-lang/dhall-haskell/releases/download/${dhallVersion}/dhall-json-${dhallJsonVersion}`;