From d40d83256fa804ac39da045e3c8f7128ef6b033c Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 17 Apr 2023 13:59:57 +0200 Subject: [PATCH] fix the case where a range is specified --- libs/remix-url-resolver/src/resolve.ts | 6 +++++- package.json | 2 +- yarn.lock | 7 +++++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/libs/remix-url-resolver/src/resolve.ts b/libs/remix-url-resolver/src/resolve.ts index 96ced4dd64..6598708ddc 100644 --- a/libs/remix-url-resolver/src/resolve.ts +++ b/libs/remix-url-resolver/src/resolve.ts @@ -1,5 +1,6 @@ // eslint-disable-next-line no-unused-vars import axios, { AxiosResponse } from 'axios' +import semver from 'semver' import { BzzNode as Bzz } from '@erebos/bzz-node' export interface Imported { @@ -171,7 +172,10 @@ export class RemixURLResolver { // package.json version = deps[pkg] } - if (version) url = url.replace(pkg, `${pkg}@${version}`) + if (version) { + const versionSemver = semver.minVersion(version) + url = url.replace(pkg, `${pkg}@${versionSemver.version}`) + } } } } catch (e) { diff --git a/package.json b/package.json index 3039f466e5..8d6abcb696 100644 --- a/package.json +++ b/package.json @@ -342,7 +342,7 @@ "request": "^2.83.0", "rimraf": "^2.6.1", "selenium-standalone": "^8.2.3", - "semver": "^6.3.0", + "semver": "^7.4.0", "solc": "0.7.4", "stream-browserify": "^3.0.0", "stream-http": "^3.2.0", diff --git a/yarn.lock b/yarn.lock index ba4025ff0f..b355a8d151 100644 --- a/yarn.lock +++ b/yarn.lock @@ -23663,6 +23663,13 @@ semver@^7.3.7: dependencies: lru-cache "^6.0.0" +semver@^7.4.0: + version "7.4.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.4.0.tgz#8481c92feffc531ab1e012a8ffc15bdd3a0f4318" + integrity sha512-RgOxM8Mw+7Zus0+zcLEUn8+JfoLpj/huFTItQy2hsM4khuC1HYRDp0cU482Ewn/Fcy6bCjufD8vAj7voC66KQw== + dependencies: + lru-cache "^6.0.0" + semver@~7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/semver/-/semver-7.0.0.tgz#5f3ca35761e47e05b206c6daff2cf814f0316b8e"