"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",
],
"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"
"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"
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");
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}`;