diff options
author | Cyril Sobierajewicz <cyril.sobierajewicz@fretlink.com> | 2019-05-18 00:17:02 +0200 |
---|---|---|
committer | Cyril Sobierajewicz <cyril.sobierajewicz@fretlink.com> | 2019-05-20 13:51:27 +0200 |
commit | 6337a3be1c44fa988f28d8f7747f1edd75dbbaf5 (patch) | |
tree | e820ac0b10104231c7789a93389f7a36ddf025f0 | |
parent | 03aaa7d3bbf9ff2176fe3b69138f37f5f265d186 (diff) | |
download | node-dhall-json-bin-6337a3be1c44fa988f28d8f7747f1edd75dbbaf5.tar.gz node-dhall-json-bin-6337a3be1c44fa988f28d8f7747f1edd75dbbaf5.tar.zst node-dhall-json-bin-6337a3be1c44fa988f28d8f7747f1edd75dbbaf5.zip |
Add `json-to-dhall`
-rw-r--r-- | package-lock.json | 5 | ||||
-rw-r--r-- | package.json | 4 | ||||
-rw-r--r-- | preinstall.js | 4 |
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"); | |||
4 | const path = require("path"); | 4 | const path = require("path"); |
5 | 5 | ||
6 | const { https } = require("follow-redirects"); | 6 | const { https } = require("follow-redirects"); |
7 | const semver = require("semver"); | ||
7 | const tar = require("tar"); | 8 | const tar = require("tar"); |
8 | const unbz2 = require("unbzip2-stream"); | 9 | const unbz2 = require("unbzip2-stream"); |
9 | const unzipper = require("unzipper"); | 10 | const unzipper = require("unzipper"); |
@@ -18,6 +19,9 @@ if (!dhallVersion) throw new Error("Missing DHALL_VERSION environment variable." | |||
18 | 19 | ||
19 | const dhallJsonVersion = trim(pkg["dhall-json-version"] || process.env.DHALL_JSON_VERSION); | 20 | const dhallJsonVersion = trim(pkg["dhall-json-version"] || process.env.DHALL_JSON_VERSION); |
20 | if (!dhallJsonVersion) throw new Error("Missing DHALL_JSON_VERSION environment variable."); | 21 | if (!dhallJsonVersion) throw new Error("Missing DHALL_JSON_VERSION environment variable."); |
22 | if (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 | ||
22 | const release = `https://github.com/dhall-lang/dhall-haskell/releases/download/${dhallVersion}/dhall-json-${dhallJsonVersion}`; | 26 | const release = `https://github.com/dhall-lang/dhall-haskell/releases/download/${dhallVersion}/dhall-json-${dhallJsonVersion}`; |
23 | 27 | ||