aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorCyril Sobierajewicz <38043722+cyrilfretlink@users.noreply.github.com>2019-08-02 10:50:34 +0200
committerGitHub <noreply@github.com>2019-08-02 10:50:34 +0200
commit715fe0113813acb9e0cca251719c6394d4c3ab94 (patch)
tree86830459a93498765b6c49a25c439a798e45f56b
parent8a8fafde7315a33a81aebe01ed2bb8b5249bc62a (diff)
parent939a82d6a05ceb0cee9dc6d0882ce79e39af1609 (diff)
downloadnode-dhall-json-bin-715fe0113813acb9e0cca251719c6394d4c3ab94.tar.gz
node-dhall-json-bin-715fe0113813acb9e0cca251719c6394d4c3ab94.tar.zst
node-dhall-json-bin-715fe0113813acb9e0cca251719c6394d4c3ab94.zip
Merge pull request #1 from cyrilfretlink/yaml-to-dhall
Add `yaml-to-dhall`
-rw-r--r--package.json5
-rw-r--r--preinstall.js9
2 files changed, 11 insertions, 3 deletions
diff --git a/package.json b/package.json
index 88b0204..d55964a 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
1{ 1{
2 "name": "dhall-json", 2 "name": "dhall-json",
3 "version": "1.0.0", 3 "version": "1.0.1",
4 "description": "NPM package for `dhall-json`, based on https://github.com/justinwoo/npm-psc-package-bin-simple.", 4 "description": "NPM package for `dhall-json`, based on https://github.com/justinwoo/npm-psc-package-bin-simple.",
5 "os": [ 5 "os": [
6 "linux", 6 "linux",
@@ -15,7 +15,8 @@
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 "json-to-dhall": "bin/json-to-dhall.exe",
19 "yaml-to-dhall": "bin/yaml-to-dhall.exe"
19 }, 20 },
20 "scripts": { 21 "scripts": {
21 "preinstall": "node ./preinstall.js" 22 "preinstall": "node ./preinstall.js"
diff --git a/preinstall.js b/preinstall.js
index 01db9e0..d53bca2 100644
--- a/preinstall.js
+++ b/preinstall.js
@@ -59,9 +59,16 @@ const readVersion = name =>
59 59
60const dhallVersion = readVersion("dhall"); 60const dhallVersion = readVersion("dhall");
61const dhallJsonVersion = readVersion("dhall-json"); 61const dhallJsonVersion = readVersion("dhall-json");
62if (semver.valid(dhallJsonVersion) && semver.lt(dhallJsonVersion, "1.2.8")) { 62
63const isLowerThan = (version, upperBound) =>
64 semver.valid(version) && semver.lt(version, upperBound);
65
66if (isLowerThan(dhallJsonVersion, "1.2.8")) {
63 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\`.`); 67 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\`.`);
64} 68}
69if (isLowerThan(dhallJsonVersion, "1.3.0")) {
70 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\`.`);
71}
65 72
66const release = `https://github.com/dhall-lang/dhall-haskell/releases/download/${dhallVersion}/dhall-json-${dhallJsonVersion}`; 73const release = `https://github.com/dhall-lang/dhall-haskell/releases/download/${dhallVersion}/dhall-json-${dhallJsonVersion}`;
67 74