aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--package-lock.json5
-rw-r--r--package.json4
-rw-r--r--preinstall.js4
3 files changed, 12 insertions, 1 deletions
diff --git a/package-lock.json b/package-lock.json
index 2637fdc..2617e32 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -267,6 +267,11 @@
267 "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", 267 "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
268 "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" 268 "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
269 }, 269 },
270 "semver": {
271 "version": "6.0.0",
272 "resolved": "https://registry.npmjs.org/semver/-/semver-6.0.0.tgz",
273 "integrity": "sha512-0UewU+9rFapKFnlbirLi3byoOuhrSsli/z/ihNnvM24vgF+8sNBiI1LZPBSH9wJKUwaUbw+s3hToDLCXkrghrQ=="
274 },
270 "setimmediate": { 275 "setimmediate": {
271 "version": "1.0.5", 276 "version": "1.0.5",
272 "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", 277 "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz",
diff --git a/package.json b/package.json
index f81e02c..7d55765 100644
--- a/package.json
+++ b/package.json
@@ -14,7 +14,8 @@
14 ], 14 ],
15 "bin": { 15 "bin": {
16 "dhall-to-json": "bin/dhall-to-json.exe", 16 "dhall-to-json": "bin/dhall-to-json.exe",
17 "dhall-to-yaml": "bin/dhall-to-yaml.exe" 17 "dhall-to-yaml": "bin/dhall-to-yaml.exe",
18 "json-to-dhall": "bin/json-to-dhall.exe"
18 }, 19 },
19 "scripts": { 20 "scripts": {
20 "preinstall": "node ./preinstall.js" 21 "preinstall": "node ./preinstall.js"
@@ -30,6 +31,7 @@
30 "homepage": "https://github.com/cyrilfretlink/node-dhall-json#readme", 31 "homepage": "https://github.com/cyrilfretlink/node-dhall-json#readme",
31 "dependencies": { 32 "dependencies": {
32 "follow-redirects": "^1.7.0", 33 "follow-redirects": "^1.7.0",
34 "semver": "^6.0.0",
33 "tar": "^4.4.8", 35 "tar": "^4.4.8",
34 "unbzip2-stream": "^1.3.3", 36 "unbzip2-stream": "^1.3.3",
35 "unzipper": "^0.9.12" 37 "unzipper": "^0.9.12"
diff --git a/preinstall.js b/preinstall.js
index 071f159..3fa2382 100644
--- a/preinstall.js
+++ b/preinstall.js
@@ -4,6 +4,7 @@ const fs = require("fs");
4const path = require("path"); 4const path = require("path");
5 5
6const { https } = require("follow-redirects"); 6const { https } = require("follow-redirects");
7const semver = require("semver");
7const tar = require("tar"); 8const tar = require("tar");
8const unbz2 = require("unbzip2-stream"); 9const unbz2 = require("unbzip2-stream");
9const unzipper = require("unzipper"); 10const unzipper = require("unzipper");
@@ -18,6 +19,9 @@ if (!dhallVersion) throw new Error("Missing DHALL_VERSION environment variable."
18 19
19const dhallJsonVersion = trim(pkg["dhall-json-version"] || process.env.DHALL_JSON_VERSION); 20const dhallJsonVersion = trim(pkg["dhall-json-version"] || process.env.DHALL_JSON_VERSION);
20if (!dhallJsonVersion) throw new Error("Missing DHALL_JSON_VERSION environment variable."); 21if (!dhallJsonVersion) throw new Error("Missing DHALL_JSON_VERSION environment variable.");
22if (semver.valid(dhallJsonVersion) && semver.lt(dhallJsonVersion, "1.2.8")) {
23 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\`.`);
24}
21 25
22const release = `https://github.com/dhall-lang/dhall-haskell/releases/download/${dhallVersion}/dhall-json-${dhallJsonVersion}`; 26const release = `https://github.com/dhall-lang/dhall-haskell/releases/download/${dhallVersion}/dhall-json-${dhallJsonVersion}`;
23 27