diff options
author | Cyril Sobierajewicz <38043722+cyrilfretlink@users.noreply.github.com> | 2020-05-12 11:51:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-12 11:51:51 +0200 |
commit | e265ce577dfea922bc3e6ac89f33cab8d104dde2 (patch) | |
tree | 7743949150f73aefba1722eccc404451725ad9eb | |
parent | 3ad6fbb588c5a21ad3cc00322b2fc43c8ff81403 (diff) | |
parent | 77388d8ab80dc1ecce8b6a34b35f3b00b6058f9f (diff) | |
download | node-dhall-json-bin-e265ce577dfea922bc3e6ac89f33cab8d104dde2.tar.gz node-dhall-json-bin-e265ce577dfea922bc3e6ac89f33cab8d104dde2.tar.zst node-dhall-json-bin-e265ce577dfea922bc3e6ac89f33cab8d104dde2.zip |
Merge pull request #3 from cyrilfretlink/yaml-to-dhall-upper-boundpre-1.6.0-1.28.0
Add an upper bound to the `dhall-json` versions providing `yaml-to-dhall`
-rw-r--r-- | package-lock.json | 2 | ||||
-rw-r--r-- | package.json | 2 | ||||
-rw-r--r-- | preinstall.js | 12 |
3 files changed, 9 insertions, 7 deletions
diff --git a/package-lock.json b/package-lock.json index 2617e32..2769f8a 100644 --- a/package-lock.json +++ b/package-lock.json | |||
@@ -1,6 +1,6 @@ | |||
1 | { | 1 | { |
2 | "name": "dhall-json", | 2 | "name": "dhall-json", |
3 | "version": "1.0.0", | 3 | "version": "2.0.1", |
4 | "lockfileVersion": 1, | 4 | "lockfileVersion": 1, |
5 | "requires": true, | 5 | "requires": true, |
6 | "dependencies": { | 6 | "dependencies": { |
diff --git a/package.json b/package.json index 3a7dfd0..5d7cb78 100644 --- a/package.json +++ b/package.json | |||
@@ -1,6 +1,6 @@ | |||
1 | { | 1 | { |
2 | "name": "dhall-json", | 2 | "name": "dhall-json", |
3 | "version": "2.0.0", | 3 | "version": "2.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 | "darwin", | 6 | "darwin", |
diff --git a/preinstall.js b/preinstall.js index 91c3a52..292b73b 100644 --- a/preinstall.js +++ b/preinstall.js | |||
@@ -60,14 +60,16 @@ const readVersion = name => | |||
60 | const dhallVersion = readVersion("dhall"); | 60 | const dhallVersion = readVersion("dhall"); |
61 | const dhallJsonVersion = readVersion("dhall-json"); | 61 | const dhallJsonVersion = readVersion("dhall-json"); |
62 | 62 | ||
63 | const isLowerThan = (version, upperBound) => | 63 | const isLesserThan = (version, upperBound) => |
64 | semver.valid(version) && semver.lt(version, upperBound); | 64 | semver.valid(version) && semver.lt(version, upperBound); |
65 | const isGreaterThan = (version, lowerBound) => | ||
66 | semver.valid(version) && semver.gt(version, lowerBound); | ||
65 | 67 | ||
66 | if (isLowerThan(dhallJsonVersion, "1.2.8")) { | 68 | if (isLesserThan(dhallJsonVersion, "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\`.`); | 69 | 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\`.`); |
68 | } | 70 | } |
69 | if (isLowerThan(dhallJsonVersion, "1.3.0")) { | 71 | if (isLesserThan(dhallJsonVersion, "1.3.0") || isGreaterThan(dhallJsonVersion, "1.5.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\`.`); | 72 | 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 >1.5.0\`.`); |
71 | } | 73 | } |
72 | 74 | ||
73 | const release = `https://github.com/dhall-lang/dhall-haskell/releases/download/${dhallVersion}/dhall-json-${dhallJsonVersion}`; | 75 | const release = `https://github.com/dhall-lang/dhall-haskell/releases/download/${dhallVersion}/dhall-json-${dhallJsonVersion}`; |
@@ -87,7 +89,7 @@ if (process.platform === "win32") { | |||
87 | } else { | 89 | } else { |
88 | const isDarwin = process.platform === 'darwin'; | 90 | const isDarwin = process.platform === 'darwin'; |
89 | 91 | ||
90 | if (isDarwin && isLowerThan(dhallJsonVersion, "1.4.0")) { | 92 | if (isDarwin && isLesserThan(dhallJsonVersion, "1.4.0")) { |
91 | throw new Error(`Static macOS binaries aren’t provided by \`dhall-json@<1.4.0\`.`); | 93 | throw new Error(`Static macOS binaries aren’t provided by \`dhall-json@<1.4.0\`.`); |
92 | } | 94 | } |
93 | 95 | ||