From 41d2f5f572fbc8ce27048843f9c5c6b70a45450b Mon Sep 17 00:00:00 2001 From: Cyril Sobierajewicz Date: Tue, 12 May 2020 10:59:05 +0200 Subject: Add an upper bound to the `dhall-json` versions providing `yaml-to-dhall` --- preinstall.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) 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 => const dhallVersion = readVersion("dhall"); const dhallJsonVersion = readVersion("dhall-json"); -const isLowerThan = (version, upperBound) => +const isLesserThan = (version, upperBound) => semver.valid(version) && semver.lt(version, upperBound); +const isGreaterThan = (version, lowerBound) => + semver.valid(version) && semver.gt(version, lowerBound); -if (isLowerThan(dhallJsonVersion, "1.2.8")) { +if (isLesserThan(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\`.`); } -if (isLowerThan(dhallJsonVersion, "1.3.0")) { - 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\`.`); +if (isLesserThan(dhallJsonVersion, "1.3.0") || isGreaterThan(dhallJsonVersion, "1.5.0")) { + 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\`.`); } const release = `https://github.com/dhall-lang/dhall-haskell/releases/download/${dhallVersion}/dhall-json-${dhallJsonVersion}`; @@ -87,7 +89,7 @@ if (process.platform === "win32") { } else { const isDarwin = process.platform === 'darwin'; - if (isDarwin && isLowerThan(dhallJsonVersion, "1.4.0")) { + if (isDarwin && isLesserThan(dhallJsonVersion, "1.4.0")) { throw new Error(`Static macOS binaries aren’t provided by \`dhall-json@<1.4.0\`.`); } -- cgit v1.2.3 From 77388d8ab80dc1ecce8b6a34b35f3b00b6058f9f Mon Sep 17 00:00:00 2001 From: Cyril Sobierajewicz Date: Tue, 12 May 2020 11:00:30 +0200 Subject: Version 2.0.1 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 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 @@ { "name": "dhall-json", - "version": "1.0.0", + "version": "2.0.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 3a7dfd0..5d7cb78 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dhall-json", - "version": "2.0.0", + "version": "2.0.1", "description": "NPM package for `dhall-json`, based on https://github.com/justinwoo/npm-psc-package-bin-simple.", "os": [ "darwin", -- cgit v1.2.3